2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-19 14:37:21 +00:00

netdev-linux: Cache error code from ether-addr ioctl.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
Pravin B Shelar
2012-03-09 12:58:10 -08:00
parent 90a6637d5e
commit 44445cac40
3 changed files with 45 additions and 17 deletions

View File

@@ -46,6 +46,7 @@ rtnetlink_link_parse(struct ofpbuf *buf,
[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)];
@@ -72,6 +73,12 @@ rtnetlink_link_parse(struct ofpbuf *buf,
? 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;