chiark / gitweb /
networkd: link - intialize mac address
authorTom Gundersen <teg@jklm.no>
Wed, 4 Jun 2014 19:29:08 +0000 (21:29 +0200)
committerTom Gundersen <teg@jklm.no>
Wed, 4 Jun 2014 19:29:25 +0000 (21:29 +0200)
Otherwise .netwrok matching on MAC address will not work.

Based on patch by Dave Reisner, and bug originally reported by Max Pray.

src/network/networkd-link.c

index 6e6fb8393e97ffca32d5b67418439e678c8c7bcd..36534268916c0b0370ce34cbfd5501e83e2bf2d0 100644 (file)
@@ -75,6 +75,10 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
         if (!link->ifname)
                 return -ENOMEM;
 
         if (!link->ifname)
                 return -ENOMEM;
 
+        r = sd_rtnl_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
+        if (r < 0)
+                return r;
+
         r = asprintf(&link->state_file, "/run/systemd/netif/links/%"PRIu64,
                      link->ifindex);
         if (r < 0)
         r = asprintf(&link->state_file, "/run/systemd/netif/links/%"PRIu64,
                      link->ifindex);
         if (r < 0)