]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Use shorter monitor interface name for P2P GO
authorJithu Jance <mails4jj@gmail.com>
Sat, 15 Oct 2011 10:07:30 +0000 (13:07 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 15 Oct 2011 10:07:30 +0000 (13:07 +0300)
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.

src/drivers/driver_nl80211.c

index 6dfad0ac8cf865212d8e810760489692f9abb991..42dec8d8b32c66e0d6526ad969dd15675db3bc1e 100644 (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 =