[PATCH] interface name size limit for Monitor interface

JJ mails4jj
Thu Oct 13 10:14:13 PDT 2011


HI Jouni & Johannes,

Thanks a lot for your suggestions. I have generated a patch according to the
comments below. Please see whether this is okay.

> 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.

I would be fine with this approach, too. And renaming "mon." to "m." is
also fine in general.

> 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.

This is probably the quickest acceptable change, so it sounds like a
good first step.


---
 src/drivers/driver_nl80211.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6dfad0a..40b0295 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4697,8 +4697,20 @@ nl80211_create_monitor_interface(struct
wpa_driver_nl80211_data *drv)
        struct sockaddr_ll ll;
        int optval;
        socklen_t optlen;
+       char *ifname = NULL;
+
+       if ((ifname = os_strstr(drv->first_bss.ifname, "p2p-"))) {
+               /* 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. */
+               ifname += os_strlen("p2p-");
+       } else {
+               /* Non-P2P interface with AP functionality, if any.*/
+               ifname = drv->first_bss.ifname;
+       }
+       snprintf(buf, IFNAMSIZ, "mon-%s", ifname);

-       snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss.ifname);
        buf[IFNAMSIZ - 1] = '\0';

        drv->monitor_ifidx =
-- 
1.7.4.1












On Thu, Oct 13, 2011 at 4:30 PM, Jouni Malinen <j at w1.fi> wrote:

> On Thu, Oct 13, 2011 at 12:21:52PM +0530, JJ wrote:
> > 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-wlan0-10----------> mon.p2p-wlan0-10 [size=16]
>
> Ah, I see.
>
> > 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.
>
> There is not really any particular need for continuing to increment the
> counter in p2p-<ifname>-# continuously, i.e., that could be optimized to
> find the smaller number that provides a unique interface. The other
> option and maybe the best approach here would be to make the if_add()
> driver_ops in driver_nl80211.c force a shorter ifname if needed (return
> the new name by writing it to force_ifname). This is done by some other
> driver wrappers already for P2P use cases. The benefit here would be in
> hiding the monitor interface detail from the generic code.
>
> > 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.
>
> Yeah, that is kind of nice for debugging purposes.
>
> > 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.
>
> I would be fine with this approach, too. And renaming "mon." to "m." is
> also fine in general.
>
> > 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.
>
> This is probably the quickest acceptable change, so it sounds like a
> good first step.
>
> --
> 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/aabcf11f/attachment.htm 



More information about the Hostap mailing list