<br><div class="gmail_quote"><span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:&#39;Times New Roman&#39;;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="font-family:monospace;font-size:13px">Currently the P2P Interface name[p2p-%s-%d] is reset when the P2P Interface name reaches the &quot;IFNAMSIZ&quot; 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. So we need to reset p2p interface name early enough to take care of extra characters in monitor interface name. This will make sure that &quot;%d&quot; enumeration is in sync for p2p and monitor interface. This patch also reduces the monitor interface name length to increase the reset window [&quot;mon.&quot; to &quot;m.&quot;].<br>
<br>---<br> src/drivers/driver.h            |    2 ++<br> src/drivers/driver_nl80211.c    |    2 +-<br> wpa_supplicant/p2p_supplicant.c |    2 +-<br>

 3 files changed, 4 insertions(+), 2 deletions(-)<br><br>diff --git a/src/drivers/driver.h b/src/drivers/driver.h<br>index f51df4e..c52cae4 100644<br>--- a/src/drivers/driver.h<br>+++ b/src/drivers/driver.h<br>@@ -35,6 +35,8 @@<br>


 #define HOSTAPD_CHAN_HT40MINUS 0x00000020<br> #define HOSTAPD_CHAN_HT40 0x00000040<br><br>+#define WPA_MONITOR_IFNAME_PREFIX      &quot;m.&quot;<br>+<br> /**<br>  * struct hostapd_channel_data - Channel information<br>  */<br>


diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c<br>index 6dfad0a..031b40b 100644<br>--- a/src/drivers/driver_nl80211.c<br>+++ b/src/drivers/driver_nl80211.c<br>@@ -4698,7 +4698,7 @@ nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv)<br>


        int optval;<br>        socklen_t optlen;<br><br>-       snprintf(buf, IFNAMSIZ, &quot;mon.%s&quot;, drv-&gt;first_bss.ifname);<br>+       snprintf(buf, IFNAMSIZ, &quot;%s%s&quot;, WPA_MONITOR_IFNAME_PREFIX, drv-&gt;first_bss.ifname);<br>


        buf[IFNAMSIZ - 1] = &#39;\0&#39;;<br><br>        drv-&gt;monitor_ifidx =<br>diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c<br>index 92bfc41..fa18d64 100644<br>--- a/wpa_supplicant/p2p_supplicant.c<br>


+++ b/wpa_supplicant/p2p_supplicant.c<br>@@ -803,7 +803,7 @@ static int wpas_p2p_add_group_interface(struct wpa_supplicant *wpa_s,<br><br>        os_snprintf(ifname, sizeof(ifname), &quot;p2p-%s-%d&quot;, wpa_s-&gt;ifname,<br>


                    wpa_s-&gt;p2p_group_idx);<br>-       if (os_strlen(ifname) &gt;= IFNAMSIZ &amp;&amp;<br>+       if (os_strlen(ifname) + os_strlen(WPA_MONITOR_IFNAME_PREFIX)  &gt;= IFNAMSIZ &amp;&amp;<br>            os_strlen(wpa_s-&gt;ifname) &lt; IFNAMSIZ) {<br>


                /* Try to avoid going over the IFNAMSIZ length limit */<br>                os_snprintf(ifname, sizeof(ifname), &quot;p2p-%d&quot;,<br><font color="#888888">--<span> </span><br>1.7.4.1<br><br><br><br>
- Jithu Jance.</font></span></span>
</div><br><br clear="all"><br><br>