[PATCH] interface name size limit for Monitor interface

JJ mails4jj
Wed Oct 12 23:51:52 PDT 2011


Hi Jouni,

Thanks for your valuable suggestions. Please find my comments in-line.

On Thu, Oct 13, 2011 at 2:10 AM, Jouni Malinen <j at w1.fi> wrote:

> On Mon, Oct 10, 2011 at 10:29:53AM +0530, JJ wrote:
> > 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.
> > 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 "%d"
> > enumeration is in sync for p2p and monitor interface. This patch also
> > reduces the monitor interface name length to increase the reset window
> > ["mon." to "m."].
>
> Are you really hitting IFNAMSIZ (16) size limit? May I ask what's the base
> interface name is in this case? ;-)
>

We are not hitting interface size limit for p2p interface. But we are
hitting the IFNAMSIZ for monitor interface
corresponding to P2P GO. The base interface name is "wlan0". so the p2p
interface name would start from
p2p-wlan0-0.

P2P IF NAME           CORRESPONDING MON. IF NAME
- - - - - - - - - - - - -      -  - - - - - - - - -- - - - - -- - - - - - -
-- - - -
p2p-wlan0-0  ----------> mon.p2p-wlan0-0 [size=15]
p2p-wlan0-1 -----------> mon.p2p-wlan0-1

...
p2p-wlan0-10----------> mon.p2p-wlan0-10 [size=16]

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.

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
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
approach to mention the WPA_MONITOR_IFNAME_PREFIX in p2p_supplicant.c.

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
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.
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
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
to get reset and even if it gets reset. It will be in sync with P2P
Interface GROUP INDEX.

P2P IF NAME           CORRESPONDING MON. IF NAME
- - - - - - - - - - - - -      -  - - - - - - - - -- - - - - -- - - - - - -
-- - - -
p2p-wlan0-0  -----------> mon-wlan0-0
p2p-wlan0-1 ------------> mon-wlan0-1

...
p2p-wlan0-99999------>mon-wlan0-99999 [size=15]

p2p-100000  -----------> mon-100000

If you feel this approach is okay, i shall generate a patch and send it to
you. Kindly share your thoughts on this.


>
> > diff --git a/src/drivers/driver.h b/src/drivers/driver.h
> > @@ -35,6 +35,8 @@
> >  #define HOSTAPD_CHAN_HT40MINUS 0x00000020
> >  #define HOSTAPD_CHAN_HT40 0x00000040
> >
> > +#define WPA_MONITOR_IFNAME_PREFIX      "m."
>
> The monitor interface is specific to nl80211 and this does not belong in
> driver.h.
>
> > diff --git a/wpa_supplicant/p2p_supplicant.c
> > @@ -803,7 +803,7 @@ static int wpas_p2p_add_group_interface(struct
> > wpa_supplicant *wpa_s,
> >
> >         os_snprintf(ifname, sizeof(ifname), "p2p-%s-%d", wpa_s->ifname,
> >                     wpa_s->p2p_group_idx);
> > -       if (os_strlen(ifname) >= IFNAMSIZ &&
> > +       if (os_strlen(ifname) + os_strlen(WPA_MONITOR_IFNAME_PREFIX)  >=
> > IFNAMSIZ &&
> >             os_strlen(wpa_s->ifname) < IFNAMSIZ) {
>
> This code needs to be generic, i.e., it cannot depend on any specific
> driver wrapper like driver_nl80211.c (which is where that
> WPA_MONITOR_IFNAME_PREFIX belongs to). As such, if there is really need
> for doing this, the driver wrapper API would need to be extended to
> provide a capability information in struct wpa_driver_capa to indicate
> maximum length of the interface name.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>



-- 

- *Jithu Jance.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20111013/e849b7d7/attachment.htm 



More information about the Hostap mailing list