diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2021-03-17 18:12:26 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2021-04-13 08:58:49 +0200 |
commit | d603c0774ebac58557d8814bdbc2ad16249c21a1 (patch) | |
tree | d8f12549091b1b2a96d14aac67d677644c8ed677 /zebra/rt_netlink.c | |
parent | nhrp: avoid crashing when terminating interface contexts (diff) | |
download | frr-d603c0774ebac58557d8814bdbc2ad16249c21a1.tar.xz frr-d603c0774ebac58557d8814bdbc2ad16249c21a1.zip |
nhrp, zebra, lib: enforce usage of zapi_neigh_ip structure
zapi_nbr structure is renamed to zapi_neigh_ip.
Initially used to set a neighbor ip entry for gre interfaces, this
structure is used to get events from the zebra layer to nhrp layer.
The ndm state has been added, as it is needed on both sides.
The zebra dplane layer is slightly modified.
Also, to clarify what ZEBRA_NEIGH_ADD/DEL means, a rename is done:
it is called now ZEBRA_NEIGH_IP_ADD/DEL, and it signified that this
zapi interface permits to set link operations by associating ip
addresses to link addresses.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r-- | zebra/rt_netlink.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index b641d0700..dc0c83967 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -3390,9 +3390,18 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id) l2_len = RTA_PAYLOAD(tb[NDA_LLADDR]); memcpy(&mac, RTA_DATA(tb[NDA_LLADDR]), l2_len); } - if (l2_len == IPV4_MAX_BYTELEN || l2_len == 0) + if (l2_len == IPV4_MAX_BYTELEN || l2_len == 0) { + union sockunion link_layer_ipv4; + + if (l2_len) { + sockunion_family(&link_layer_ipv4) = AF_INET; + memcpy((void *)sockunion_get_addr(&link_layer_ipv4), + &mac, l2_len); + } else + sockunion_family(&link_layer_ipv4) = AF_UNSPEC; zsend_nhrp_neighbor_notify(cmd, ifp, &ip, ndm->ndm_state, - &mac, l2_len); + &link_layer_ipv4); + } if (h->nlmsg_type == RTM_GETNEIGH) return 0; |