[systemd-devel] [PATCH] Set mac address in link initialization
Dave Reisner
dreisner at archlinux.org
Wed Jun 4 10:48:21 PDT 2014
505f8da7325 left link->mac uninitialized, causing MACAddress based
[Match] sections to fail to match anything.
https://bugs.freedesktop.org/show_bug.cgi?id=79638
---
src/network/networkd-link.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 6e6fb83..f3bab9f 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1683,8 +1683,18 @@ int link_initialized(Link *link, struct udev_device *device) {
if (link->state != LINK_STATE_INITIALIZING)
return 0;
- if (device)
+ if (device) {
+ const char *mac_address = udev_device_get_sysattr_value(
+ device, "address");
+
+ if (mac_address) {
+ struct ether_addr *hwaddr = ether_aton(mac_address);
+ if (hwaddr)
+ memcpy(&link->mac, hwaddr, sizeof(struct ether_addr));
+ }
+
link->udev_device = udev_device_ref(device);
+ }
log_debug_link(link, "udev initialized link");
--
2.0.0
More information about the systemd-devel
mailing list