P2P: Limit P2P_DEVICE name to appropriate ifname size
Otherwise the WPA_IF_P2P_DEVICE cannot be created if the base ifname is long enough. As this is not a netdev device, it is acceptable if the name is not completely unique. As such, simply insert a NUL byte at the appropriate place. Signed-off-by: Benjamin Berg <bberg@redhat.com>
This commit is contained in:
parent
566ea1b7ce
commit
c0b88d1291
1 changed files with 4 additions and 0 deletions
|
@ -3984,6 +3984,10 @@ int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s,
|
||||||
wpa_s->ifname);
|
wpa_s->ifname);
|
||||||
if (os_snprintf_error(sizeof(ifname), ret))
|
if (os_snprintf_error(sizeof(ifname), ret))
|
||||||
return -1;
|
return -1;
|
||||||
|
/* Cut length at the maximum size. Note that we don't need to ensure
|
||||||
|
* collision free names here as the created interface is not a netdev.
|
||||||
|
*/
|
||||||
|
ifname[IFNAMSIZ - 1] = '\0';
|
||||||
force_name[0] = '\0';
|
force_name[0] = '\0';
|
||||||
wpa_s->pending_interface_type = WPA_IF_P2P_DEVICE;
|
wpa_s->pending_interface_type = WPA_IF_P2P_DEVICE;
|
||||||
ret = wpa_drv_if_add(wpa_s, WPA_IF_P2P_DEVICE, ifname, NULL, NULL,
|
ret = wpa_drv_if_add(wpa_s, WPA_IF_P2P_DEVICE, ifname, NULL, NULL,
|
||||||
|
|
Loading…
Reference in a new issue