bug fix (wrong paramether id)
[sliver-openvswitch.git] / lib / rtnetlink-link.c
index 60b71be..07350a6 100644 (file)
@@ -45,6 +45,8 @@ rtnetlink_link_parse(struct ofpbuf *buf,
     static const struct nl_policy policy[] = {
         [IFLA_IFNAME] = { .type = NL_A_STRING, .optional = false },
         [IFLA_MASTER] = { .type = NL_A_U32,    .optional = true },
+        [IFLA_MTU]    = { .type = NL_A_U32,    .optional = true },
+        [IFLA_ADDRESS] = { .type = NL_A_UNSPEC, .optional = true },
     };
 
     static struct nlattr *attrs[ARRAY_SIZE(policy)];
@@ -67,6 +69,16 @@ rtnetlink_link_parse(struct ofpbuf *buf,
         change->master_ifindex = (attrs[IFLA_MASTER]
                                   ? nl_attr_get_u32(attrs[IFLA_MASTER])
                                   : 0);
+        change->mtu            = (attrs[IFLA_MTU]
+                                  ? nl_attr_get_u32(attrs[IFLA_MTU])
+                                  : 0);
+
+        if (attrs[IFLA_ADDRESS] &&
+            nl_attr_get_size(attrs[IFLA_ADDRESS]) == ETH_ALEN) {
+            memcpy(change->addr, nl_attr_get(attrs[IFLA_ADDRESS]), ETH_ALEN);
+        } else {
+            memset(change->addr, 0, ETH_ALEN);
+        }
     }
 
     return parsed;