diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2021-04-05 21:40:37 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2021-04-13 08:58:54 +0200 |
commit | 88217099de3d7ddaa7508d7506b12fd260fc3acb (patch) | |
tree | 5151782df2354678e585dbabbf1541bc479cf936 /zebra/rt_netlink.c | |
parent | nhrpd: remove useless typedef (diff) | |
download | frr-88217099de3d7ddaa7508d7506b12fd260fc3acb.tar.xz frr-88217099de3d7ddaa7508d7506b12fd260fc3acb.zip |
zebra, lib: replace ZEBRA_ROUTE_NEIGH with simplified version
do not add a new route type, and consider 0 as a value meaning
that zebra should be the owner.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r-- | zebra/rt_netlink.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index dc0c83967..d2ec7da57 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -258,7 +258,6 @@ static inline int zebra2proto(int proto) break; case ZEBRA_ROUTE_TABLE: case ZEBRA_ROUTE_NHG: - case ZEBRA_ROUTE_NEIGH: proto = RTPROT_ZEBRA; break; case ZEBRA_ROUTE_CONNECT: @@ -2831,13 +2830,17 @@ netlink_vxlan_flood_update_ctx(const struct zebra_dplane_ctx *ctx, int cmd, void *buf, size_t buflen) { struct ethaddr dst_mac = {.octet = {0}}; + int proto = RTPROT_ZEBRA; + + if (dplane_ctx_get_type(ctx) != 0) + proto = zebra2proto(dplane_ctx_get_type(ctx)); return netlink_neigh_update_msg_encode( ctx, cmd, (const void *)&dst_mac, ETH_ALEN, dplane_ctx_neigh_get_ipaddr(ctx), false, PF_BRIDGE, 0, NTF_SELF, (NUD_NOARP | NUD_PERMANENT), 0 /*nhg*/, false /*nfy*/, 0 /*nfy_flags*/, false /*ext*/, 0 /*ext_flags*/, buf, buflen, - zebra2proto(dplane_ctx_get_type(ctx))); + proto); } #ifndef NDA_RTA @@ -3203,6 +3206,10 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data, uint32_t update_flags; bool nfy = false; uint8_t nfy_flags = 0; + int proto = RTPROT_ZEBRA; + + if (dplane_ctx_get_type(ctx) != 0) + proto = zebra2proto(dplane_ctx_get_type(ctx)); cmd = dplane_ctx_get_op(ctx) == DPLANE_OP_MAC_INSTALL ? RTM_NEWNEIGH : RTM_DELNEIGH; @@ -3272,7 +3279,7 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data, ctx, cmd, (const void *)dplane_ctx_mac_get_addr(ctx), ETH_ALEN, &vtep_ip, true, AF_BRIDGE, 0, flags, state, nhg_id, nfy, nfy_flags, false /*ext*/, 0 /*ext_flags*/, data, datalen, - zebra2proto(dplane_ctx_get_type(ctx))); + proto); return total; } @@ -3727,6 +3734,10 @@ static ssize_t netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx, uint32_t update_flags; uint32_t ext_flags = 0; bool ext = false; + int proto = RTPROT_ZEBRA; + + if (dplane_ctx_get_type(ctx) != 0) + proto = zebra2proto(dplane_ctx_get_type(ctx)); ip = dplane_ctx_neigh_get_ipaddr(ctx); @@ -3777,7 +3788,7 @@ static ssize_t netlink_neigh_update_ctx(const struct zebra_dplane_ctx *ctx, return netlink_neigh_update_msg_encode( ctx, cmd, link_ptr, llalen, ip, true, family, RTN_UNICAST, flags, state, 0 /*nhg*/, false /*nfy*/, 0 /*nfy_flags*/, ext, - ext_flags, buf, buflen, zebra2proto(dplane_ctx_get_type(ctx))); + ext_flags, buf, buflen, proto); } static int netlink_neigh_table_update_ctx(const struct zebra_dplane_ctx *ctx, |