Hi,
On Tue, 2014-04-29 at 20:18 -0400, Eduardo Abinader wrote:
The following two patches are related somehow in the
scenario where wifi dongle is removed and inserted again,
and systemd-udev renames device.
Sytemd-udev may have predefined device names, which does
not necessarily follow kernel device sequential
numbering. The renaming of the device causes the kernel
to issue a new RTM_NEWLINK, but keeping same ifindex, thus
falling in a scenario where connman is unable to handle
currently. Observe there is no RTM_DELLINK message being
issued in this rename action.
Patch(1/2): tried to rely on ifi_change, but I do not feel
secure to use it, as it is still stated to be set as
0xfff and reserved for future use, although have found
a pattern for the values filled in by rtnetlink by running and
also taking a look at kernel code.
(refer also to this link:
https://lists.connman.net/pipermail/connman/2012-September/011232.html)
I gave this a head scratching, seems there are a few more pieces in this
puzzle. Sent an RFC patch set regarding the issue as well, that one
eliminates device-interface completely. It may or may not be what we
want, at least it temporarily gets the problem solved by not storing
anything at all.
That RFC patch set exposes one interesting thing: the
connman_inet_ifname/connman_inet_ifindex function pair uses and ioctl to
get the desired name or index. This is information we'd readily have in
struct device, were we to track ifname changes properly. Those ioctls
are totally unnecessary, we should make our code better and use what we
already get for free.
My proposal on the whole affair would be this:
- provide proper and simple rtnl ifname tracking for the device
structure, perhaps by adding ifname to the newlink callback
function and keep the device in sync with all necessary blacklisting.
This basically keeps device-interface that RFC 2/3 eliminated.
- create something like connman_device_ifname/connman_device_ifindex
function pairs that query the device structures for the necessary
information.
- switch over from connman_inet_ifname/connman_inet_ifindex to the new
ones and eliminate these ioctl based ones
Problem is that I didn't look any further, perhaps the only argument
there is around when connman_device_ifname is used is the index, not the
whole device struct. Thus one may need to do another mapping between
ifname and device struct in order to get the index. Or something.
Any takers for this task?
Patch(2/2): while preparing this patch, noticed segfault in
scan_callback, when removing wifi dongle. Thus the second
patch refers to this occurrence.
Yep, this one I'll apply. Thanks!
Cheers,
Patrik
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman