Hi Jouni,<br><br>Thanks for your valuable suggestions. Please find my comments in-line.<br><br><div class="gmail_quote">On Thu, Oct 13, 2011 at 2:10 AM, Jouni Malinen <span dir="ltr"><<a href="mailto:j@w1.fi">j@w1.fi</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Mon, Oct 10, 2011 at 10:29:53AM +0530, JJ wrote:<br>
> Currently the P2P Interface name[p2p-%s-%d] is reset when the P2P Interface<br>
> name reaches the "IFNAMSIZ" limit. Monitor interface name is derived from<br>
> p2p interface name with the addition of few characters [mon.p2p-%s-%d] and<br>
> hence Monitor interface name hits IFNAMSIZ limit before P2P Interface name.<br>
> So we need to reset p2p interface name early enough to take care of extra<br>
> characters in monitor interface name. This will make sure that "%d"<br>
> enumeration is in sync for p2p and monitor interface. This patch also<br>
> reduces the monitor interface name length to increase the reset window<br>
> ["mon." to "m."].<br>
<br>
</div>Are you really hitting IFNAMSIZ (16) size limit? May I ask what's the base<br>
interface name is in this case? ;-)<br></blockquote><div><br>We are not hitting interface size limit for p2p interface. But we are hitting the IFNAMSIZ for monitor interface<br>corresponding to P2P GO. The base interface name is "wlan0". so the p2p interface name would start from<br>
p2p-wlan0-0.<br><br>P2P IF NAME CORRESPONDING MON. IF NAME<br>- - - - - - - - - - - - - - - - - - - - - - -- - - - - -- - - - - - - -- - - - <br>p2p-wlan0-0 ----------> mon.p2p-wlan0-0 [size=15]<br>p2p-wlan0-1 -----------> mon.p2p-wlan0-1<br>
<br>...<br>p2p-wlan0-10----------> mon.p2p-wlan0-10 [size=16]<br><br>so after around 10 teardowns of P2P Group Owner, the monitor interface name reaches size limit. But currently, Interface name is reset only when the p2p interface reaches the IFNAMSIZ. Due to this the monitor interface name gets truncated [for e.g monitor interface would show mon.p2p-wlan0-1 for mon.p2p-wlan0-11], till the RESET happens. <br>
<br>Since monitor interface name is derived from p2p interface name, ideally group index [%d] should be in sync so that a monitor interface can be associated with a corresponding p2p interface. so in my<br>previous approach i had reset p2p interface in advance to take care of the monitor interface size limit. I agree with you that this change is only required for driver_nl80211 and hence it is not a clean<br>
approach to mention the WPA_MONITOR_IFNAME_PREFIX in p2p_supplicant.c.<br><br>Another approach would be to name monitor interface as mon-%s-%d [for e.g mon-wlan0-0], by replacing "p2p" with "mon" for monitor interface [instead of appending "mon." to p2p-wlan0-0]. This way<br>
size of monitor interface would be same as p2p interface. Hence monitor interface would reach size limit when exactly when p2p interface reaches size limit.<br>In this approach when p2p interface reaches the size limit, it would be reset to p2p-%d and hence the corresponding monitor will be mon-%d. This way<br>
the %d will always be in sync between monitor interface and corresponding GO interface. This change will only affect driver_nl80211.c. By this approach, it will take long time for the interface<br>to get reset and even if it gets reset. It will be in sync with P2P Interface GROUP INDEX.<br>
<br>P2P IF NAME CORRESPONDING MON. IF NAME<br>
- - - - - - - - - - - - - - - - - - - - - - -- - - - - -- - - - - - - -- - - - <br>
p2p-wlan0-0 -----------> mon-wlan0-0<br>
p2p-wlan0-1 ------------> mon-wlan0-1<br>
<br>
...<br>
p2p-wlan0-99999------>mon-wlan0-99999 [size=15]<br><br>p2p-100000 -----------> mon-100000<br><br>If you feel this approach is okay, i shall generate a patch and send it to you. Kindly share your thoughts on this.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
> diff --git a/src/drivers/driver.h b/src/drivers/driver.h<br>
<div class="im">> @@ -35,6 +35,8 @@<br>
> #define HOSTAPD_CHAN_HT40MINUS 0x00000020<br>
> #define HOSTAPD_CHAN_HT40 0x00000040<br>
><br>
> +#define WPA_MONITOR_IFNAME_PREFIX "m."<br>
<br>
</div>The monitor interface is specific to nl80211 and this does not belong in<br>
driver.h.<br>
<br>
> diff --git a/wpa_supplicant/p2p_supplicant.c<br>
<div class="im">> @@ -803,7 +803,7 @@ static int wpas_p2p_add_group_interface(struct<br>
> wpa_supplicant *wpa_s,<br>
><br>
> os_snprintf(ifname, sizeof(ifname), "p2p-%s-%d", wpa_s->ifname,<br>
> wpa_s->p2p_group_idx);<br>
> - if (os_strlen(ifname) >= IFNAMSIZ &&<br>
> + if (os_strlen(ifname) + os_strlen(WPA_MONITOR_IFNAME_PREFIX) >=<br>
> IFNAMSIZ &&<br>
> os_strlen(wpa_s->ifname) < IFNAMSIZ) {<br>
<br>
</div>This code needs to be generic, i.e., it cannot depend on any specific<br>
driver wrapper like driver_nl80211.c (which is where that<br>
WPA_MONITOR_IFNAME_PREFIX belongs to). As such, if there is really need<br>
for doing this, the driver wrapper API would need to be extended to<br>
provide a capability information in struct wpa_driver_capa to indicate<br>
maximum length of the interface name.<br>
<font color="#888888"><br>
--<br>
Jouni Malinen PGP id EFC895FA<br>
_______________________________________________<br>
HostAP mailing list<br>
<a href="mailto:HostAP@lists.shmoo.com">HostAP@lists.shmoo.com</a><br>
<a href="http://lists.shmoo.com/mailman/listinfo/hostap" target="_blank">http://lists.shmoo.com/mailman/listinfo/hostap</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br><br><span style="font-family:courier new,monospace;color:rgb(102, 102, 102)">- <b><font size="2">Jithu Jance.</font></b></span><br><br>