Re: [PATCH 0/2] Device detection upon systemd-udev renaming

2014-05-06 Thread Patrik Flykt

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


[PATCH 0/2] Device detection upon systemd-udev renaming

2014-04-29 Thread Eduardo Abinader
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)

Patch(2/2): while preparing this patch, noticed segfault in 
scan_callback, when removing wifi dongle. Thus the second 
patch refers to this occurrence.

Eduardo Abinader (2):
  Don't ignore RTM_NEWLINK, when ifname has changed
  Avoid invalid read in scan_callback

 gsupplicant/supplicant.c |  3 +++
 include/device.h |  1 +
 src/detect.c | 15 +--
 src/device.c | 20 
 4 files changed, 37 insertions(+), 2 deletions(-)

-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman