[3/13] Handle networking devices with no mac address.
Cornelia Huck
cohuck at de.ibm.com
Mon Jun 27 01:45:37 PDT 2005
[3/13] Handle networking devices with no mac address.
For networking devices without a mac address (e.g. S/390 netiucv), addition
in HAL fails since the udi is based on it. Instead, fall back to basing the
udi on the physical device's udi.
classdev.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
Index: hald/linux2/classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.26
diff -u -r1.26 classdev.c
--- hald/linux2/classdev.c 29 Mar 2005 20:25:13 -0000 1.26
+++ hald/linux2/classdev.c 23 Jun 2005 13:59:57 -0000
@@ -193,8 +193,8 @@
ifname = hal_util_get_last_element (sysfs_path);
hal_device_property_set_string (d, "net.interface", ifname);
- if (!hal_util_set_string_from_file (d, "net.address", sysfs_path, "address"))
- goto error;
+ hal_util_set_string_from_file (d, "net.address", sysfs_path, "address");
+
if (!hal_util_set_int_from_file (d, "net.linux.ifindex", sysfs_path, "ifindex", 10))
goto error;
@@ -294,10 +294,16 @@
net_compute_udi (HalDevice *d)
{
gchar udi[256];
+ const gchar *id;
+ id = hal_device_property_get_string (d, "net.address");
+ if (!id)
+ /* Need to fall back to something else if mac not available. */
+ id = hal_util_get_last_element(
+ hal_device_property_get_string(d, "net.physical_device"));
hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
"/org/freedesktop/Hal/devices/net_%s",
- hal_device_property_get_string (d, "net.address"));
+ id);
hal_device_set_udi (d, udi);
hal_device_property_set_string (d, "info.udi", udi);
return TRUE;
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list