network: NDA_LLADDR attribute can also take struct in_addr

This commit is contained in:
Yu Watanabe
2019-07-11 22:22:29 +09:00
parent 5dc3dbe855
commit 49808e0e2d
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -663,7 +663,7 @@ static const NLTypeSystem rtnl_route_type_system = {
static const NLType rtnl_neigh_types[] = {
[NDA_DST] = { .type = NETLINK_TYPE_IN_ADDR },
[NDA_LLADDR] = { .type = NETLINK_TYPE_ETHER_ADDR },
[NDA_LLADDR] = { /* struct ether_addr or struct in_addr */ },
[NDA_CACHEINFO] = { .type = NETLINK_TYPE_CACHE_INFO, .size = sizeof(struct nda_cacheinfo) },
[NDA_PROBES] = { .type = NETLINK_TYPE_U32 },
[NDA_VLAN] = { .type = NETLINK_TYPE_U16 },
+1 -1
View File
@@ -519,7 +519,7 @@ static int get_gateway_description(
if (!in_addr_equal(fam, &gw, gateway))
continue;
r = sd_netlink_message_read_ether_addr(m, NDA_LLADDR, &mac);
r = sd_netlink_message_read(m, NDA_LLADDR, sizeof(mac), &mac);
if (r < 0)
continue;
+1 -1
View File
@@ -143,7 +143,7 @@ int fdb_entry_configure(Link *link, FdbEntry *fdb_entry) {
if (r < 0)
return rtnl_log_create_error(r);
r = sd_netlink_message_append_ether_addr(req, NDA_LLADDR, fdb_entry->mac_addr);
r = sd_netlink_message_append_data(req, NDA_LLADDR, fdb_entry->mac_addr, sizeof(struct ether_addr));
if (r < 0)
return rtnl_log_create_error(r);
+1 -1
View File
@@ -133,7 +133,7 @@ int neighbor_configure(Neighbor *neighbor, Link *link, link_netlink_message_hand
if (r < 0)
return log_error_errno(r, "Could not set flags: %m");
r = sd_netlink_message_append_ether_addr(req, NDA_LLADDR, &neighbor->mac);
r = sd_netlink_message_append_data(req, NDA_LLADDR, &neighbor->mac, sizeof(neighbor->mac));
if (r < 0)
return log_error_errno(r, "Could not append NDA_LLADDR attribute: %m");