nl80211: Use shorter monitor interface name for P2P GO

Currently the P2P Interface name[p2p-%s-%d] is reset when the P2P
Interface name reaches the "IFNAMSIZ" limit. Monitor interface name is
derived from p2p interface name with the addition of few characters
[mon.p2p-%s-%d] and hence Monitor interface name hits IFNAMSIZ limit
before P2P Interface name. Rename the monitor interface name to
mon-%s-%d to reduce the length to same with p2p-%s-%d.
This commit is contained in:
Jithu Jance 2011-10-15 13:07:30 +03:00 committed by Jouni Malinen
parent 8666585b9e
commit 6758b1677a

View file

@ -4698,7 +4698,19 @@ nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv)
int optval;
socklen_t optlen;
snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss.ifname);
if (os_strncmp(drv->first_bss.ifname, "p2p-", 4) == 0) {
/*
* P2P interface name is of the format p2p-%s-%d. For monitor
* interface name corresponding to P2P GO, replace "p2p-" with
* "mon-" to retain the same interface name length and to
* indicate that it is a monitor interface.
*/
snprintf(buf, IFNAMSIZ, "mon-%s", drv->first_bss.ifname + 4);
} else {
/* Non-P2P interface with AP functionality. */
snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss.ifname);
}
buf[IFNAMSIZ - 1] = '\0';
drv->monitor_ifidx =