Add support for net.bridge capability
Marcel Holtmann
marcel at holtmann.org
Sat Feb 23 18:30:14 PST 2008
Hi David,
when using bridge devices in Linux, they get classified as normal
Ethernet devices. However I think we should clearly mark them as bridge
devices and assign net.bridge capability to them. The attached patch
does exactly this.
Regards
Marcel
-------------- next part --------------
add bridge classification support
This adds support to properly classify Linux bridge devices with
net.bridge capability. Otherwise they are classifed as normal
Ethernet devices with net.80203 capability.
---
commit f8b5ed1d0dd4d2cc33e3b07d6f8ee3c5e4a1ad03
tree 39d1144eba40defd33d219d93cfd0e2ac44ec922
parent 75a9042c1e31da76b7c448dc921d6dc744ca9a86
author Marcel Holtmann <marcel at holtmann.org> Sun, 24 Feb 2008 03:26:11 +0100
committer Marcel Holtmann <marcel at holtmann.org> Sun, 24 Feb 2008 03:26:11 +0100
doc/spec/hal-spec-properties.xml | 39 ++++++++++++++++++++++++++++++++++++++
hald/linux/device.c | 7 +++++++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index f3e5752..2cab39f 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -4638,6 +4638,45 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
<para>
</para>
</sect2>
+ <sect2 id="device-properties-net-bridge">
+ <title>
+ net.bridge namespace
+ </title>
+ <para>
+ Bridge ethernet networking devices is described in this namespace
+ for device objects with the capability
+ <literal>net.bridge</literal>.
+ Note that device
+ objects can only have the <literal>net.bridge</literal> capability
+ if they already have the capability <literal>net</literal>.
+ </para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Key (type)</entry>
+ <entry>Values</entry>
+ <entry>Mandatory</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <literal>net.bridge.mac_address</literal> (uint64)
+ </entry>
+ <entry>example: 0x0010605d8ef4</entry>
+ <entry>
+ Only if the <literal>net.bridge</literal> capability is set
+ </entry>
+ <entry>48-bit address</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ <para>
+ </para>
+ </sect2>
<sect2 id="device-properties-net-bluetooth">
<title>
net.bluetooth namespace
diff --git a/hald/linux/device.c b/hald/linux/device.c
index c566914..bbe9874 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -534,6 +534,7 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
if (media_type == ARPHRD_ETHER) {
const char *addr;
const char *parent_subsys;
+ char bridge_path[HAL_PATH_MAX];
char wireless_path[HAL_PATH_MAX];
char wiphy_path[HAL_PATH_MAX];
struct stat s;
@@ -555,6 +556,7 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
}
}
+ snprintf (bridge_path, HAL_PATH_MAX, "%s/bridge", sysfs_path);
snprintf (wireless_path, HAL_PATH_MAX, "%s/wireless", sysfs_path);
/* wireless dscape stack e.g. from rt2500pci driver*/
snprintf (wiphy_path, HAL_PATH_MAX, "%s/wiphy", sysfs_path);
@@ -571,6 +573,11 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
hal_device_property_set_string (d, "info.category", "net.80211");
hal_device_add_capability (d, "net.80211");
hal_device_property_set_uint64 (d, "net.80211.mac_address", mac_address);
+ } else if (stat (bridge_path, &s) == 0 && (s.st_mode & S_IFDIR)) {
+ hal_device_property_set_string (d, "info.product", "Bridge Interface");
+ hal_device_property_set_string (d, "info.category", "net.bridge");
+ hal_device_add_capability (d, "net.bridge");
+ hal_device_property_set_uint64 (d, "net.bridge.mac_address", mac_address);
} else {
hal_device_property_set_string (d, "info.product", "Networking Interface");
hal_device_property_set_string (d, "info.category", "net.80203");
More information about the hal
mailing list