[PATCH] interface name size limit for Monitor interface

Jouni Malinen j
Thu Oct 13 04:00:33 PDT 2011


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



More information about the Hostap mailing list