Bug 14537 - hald ignores virtual network devices (e.g. vlan and bridge ifaces)
Summary: hald ignores virtual network devices (e.g. vlan and bridge ifaces)
Status: RESOLVED FIXED
Alias: None
Product: hal
Classification: Unclassified
Component: hald (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-18 02:19 UTC by Kees Cook
Modified: 2008-10-20 06:20 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
additional failure debugging (743 bytes, patch)
2008-02-18 02:19 UTC, Kees Cook
Details | Splinter Review
additional device detection failure debugging (743 bytes, patch)
2008-02-18 10:49 UTC, Kees Cook
Details | Splinter Review
do not ignore virtual network devices (2.26 KB, patch)
2008-02-18 10:51 UTC, Kees Cook
Details | Splinter Review
do not ignore virtual network devices (761 bytes, patch)
2008-02-18 11:06 UTC, Kees Cook
Details | Splinter Review

Description Kees Cook 2008-02-18 02:19:13 UTC
hald does not store information about vlan or bridge interfaces due to the lack of matching parent sysfs paths and "device" symlink.

The udev event for a vlan iface coming up:

UEVENT[1203328216.070578] add      /devices/virtual/net/eth0.8 (net)
ACTION=add
DEVPATH=/devices/virtual/net/eth0.8
SUBSYSTEM=net
INTERFACE=eth0.8
IFINDEX=18
SEQNUM=4778

UDEV  [1203328216.071750] add      /devices/virtual/net/eth0.8 (net)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/virtual/net/eth0.8
SUBSYSTEM=net
INTERFACE=eth0.8
IFINDEX=18
SEQNUM=4778
UDEVD_EVENT=1
MATCHADDR=xx:xx:xx:yy:yy:yy
MATCHIFTYPE=1
COMMENT=net device

hald debug during event:
01:50:16.072 [I] osspec.c:230: SEQNUM=4778, ACTION=add, SUBSYSTEM=net, DEVPATH=/sys/devices/virtual/net/eth0.8, DEVNAME=, IFINDEX=18 
01:50:16.072 [I] hotplug.c:142: /sys/devices/virtual/net/eth0.8 is a device (subsystem) 
01:50:16.072 [I] device.c:3975: add_dev: subsys=net sysfs_path=/sys/devices/virtual/net/eth0.8 dev= parent_dev=0x00000000 

Note the "parent_dev=0x00000000" part -- this causes net_add to immediately fail:
        if (parent_dev == NULL)
                goto error;

I think a possible work-around for this (at least for vlan interfaces) would be to find the parent based on MAC address.  This is arguable a problem with kernel sysfs tree:
http://www.mail-archive.com/netdev@vger.kernel.org/msg11698.html

Additionally, it would be very handy to have more debugging during hald device addition failures (see attachment).
Comment 1 Kees Cook 2008-02-18 02:19:51 UTC
Created attachment 14372 [details] [review]
additional failure debugging
Comment 2 Kees Cook 2008-02-18 02:25:19 UTC
Also, it seems that using the "device" symlink is deprecated by the kernel, as documented in the Linux kernel's Documentation/sysfs-rules.txt file (e.g. "Assuming the existence of the "device"-link for a device in /sys/devices/ is a bug in the application.")
Comment 3 Kees Cook 2008-02-18 10:49:55 UTC
Created attachment 14390 [details] [review]
additional device detection failure debugging

Fixed debug patch to actually compile.  ;)
Comment 4 Kees Cook 2008-02-18 10:51:59 UTC
Created attachment 14391 [details] [review]
do not ignore virtual network devices

This is a proposed patch to allow hal to see all network devices, including virtual ones.  As done with other virtual devices, the parent is recorded as "/org/freedesktop/Hal/devices/computer".
Comment 5 Kees Cook 2008-02-18 11:06:30 UTC
Created attachment 14392 [details] [review]
do not ignore virtual network devices

Cleaned up patch -- using MAC address detection for parent-finding was simply wrong.
Comment 6 Danny Kukawka 2008-02-21 12:36:24 UTC
(In reply to comment #2)
> Also, it seems that using the "device" symlink is deprecated by the kernel, as
> documented in the Linux kernel's Documentation/sysfs-rules.txt file (e.g.
> "Assuming the existence of the "device"-link for a device in /sys/devices/ is a
> bug in the application.")

And what prints: ls -alF /sys/class/net 
Comment 7 Kees Cook 2008-02-21 12:42:47 UTC
$ ls -alF /sys/class/net
total 0
drwxr-xr-x  2 root root 0 Feb 20 23:00 ./
drwxr-xr-x 38 root root 0 Feb 20 23:00 ../
lrwxrwxrwx  1 root root 0 Feb 20 23:00 br0 -> ../../devices/virtual/net/br0/
lrwxrwxrwx  1 root root 0 Feb 20 23:00 eth0 -> ../../devices/pci0000:00/0000:00:19.0/net/eth0/
lrwxrwxrwx  1 root root 0 Feb 20 23:00 eth0.10 -> ../../devices/virtual/net/eth0.10/
lrwxrwxrwx  1 root root 0 Feb 20 23:00 eth0.3 -> ../../devices/virtual/net/eth0.3/
lrwxrwxrwx  1 root root 0 Feb 20 23:00 lo -> ../../devices/virtual/net/lo/
lrwxrwxrwx  1 root root 0 Feb 20 23:00 vnet0 -> ../../devices/virtual/net/vnet0/
Comment 8 Kees Cook 2008-03-05 09:19:27 UTC
Note that this patch, as it stands, creates some additional work in existing clients that process the list of network interfaces (e.g. network-manager).  They need to be adjusted to deal with virtual network interfaces too.
Comment 9 Danny Kukawka 2008-10-20 06:20:54 UTC
commit d4f1c6eb85ccb45d45641f30d6ea04dbb046fa28
Author: Danny Kukawka <danny.kukawka@web.de>
Date:   Mon Oct 20 15:18:26 2008 +0200

    add support for virtual network devices

    Added support for virtual network devices as e.g. openvpn tunnel
    interfaces or loopback devices. Added new net subnamespace
    net.loopback for ARPHRD_LOOPBACK interfaces.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.