]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra, lib: replace ZEBRA_ROUTE_NEIGH with simplified version
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 5 Apr 2021 19:40:37 +0000 (21:40 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 13 Apr 2021 06:58:54 +0000 (08:58 +0200)
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>
lib/route_types.txt
zebra/rt_netlink.c
zebra/zebra_dplane.c
zebra/zebra_rib.c

index 32c7a89d3d01f6e40f2f46e0a969eefea7146f50..c48391545d0f4a36098ae9929f8d7b0191fd2e47 100644 (file)
@@ -85,7 +85,6 @@ ZEBRA_ROUTE_BFD,        bfd,       bfdd,   '-', 0, 0, 0,     "BFD",           bf
 ZEBRA_ROUTE_OPENFABRIC, openfabric, fabricd,  'f', 1, 1, 1,  "OpenFabric",    fabricd
 ZEBRA_ROUTE_VRRP,       vrrp,      vrrpd,  '-', 0, 0, 0,     "VRRP",          vrrpd
 ZEBRA_ROUTE_NHG,        zebra,     none,   '-', 0, 0, 0,     "Nexthop Group", none
-ZEBRA_ROUTE_NEIGH,      neigh,     none,   '-', 0, 0, 0,     "Neigh Entry",   none
 ZEBRA_ROUTE_SRTE,       srte,      none,   '-', 0, 0, 0,     "SR-TE",         none
 ZEBRA_ROUTE_ALL,        wildcard,  none,   '-', 0, 0, 0,     "-",             none
 
@@ -117,4 +116,3 @@ ZEBRA_ROUTE_BFD, "Bidirectional Fowarding Detection (BFD)"
 ZEBRA_ROUTE_VRRP, "Virtual Router Redundancy Protocol (VRRP)"
 ZEBRA_ROUTE_OPENFABRIC, "OpenFabric Routing Protocol"
 ZEBRA_ROUTE_NHG, "Zebra Nexthop Groups (NHG)"
-ZEBRA_ROUTE_NEIGH, "Zebra Neighbor Entry"
index dc0c83967495a52a0b914deb9dcbd955aae3c8e7..d2ec7da57cc13df091bfa51523eca862f256147f 100644 (file)
@@ -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,
index c7f396ebf97090d5d146c4576f77c3e97f20c0f0..c8ee8f9051223ddce792441f1291209229c2d8f1 100644 (file)
@@ -3688,7 +3688,7 @@ enum zebra_dplane_result dplane_rem_neigh_add(const struct interface *ifp,
 
        result = neigh_update_internal(
                DPLANE_OP_NEIGH_INSTALL, ifp, (const void *)mac, AF_ETHERNET,
-               ip, flags, DPLANE_NUD_NOARP, update_flags, ZEBRA_ROUTE_NEIGH);
+               ip, flags, DPLANE_NUD_NOARP, update_flags, 0);
 
        return result;
 }
@@ -3722,7 +3722,7 @@ enum zebra_dplane_result dplane_local_neigh_add(const struct interface *ifp,
 
        result = neigh_update_internal(DPLANE_OP_NEIGH_INSTALL, ifp,
                                       (const void *)mac, AF_ETHERNET, ip, ntf,
-                                      state, update_flags, ZEBRA_ROUTE_NEIGH);
+                                      state, update_flags, 0);
 
        return result;
 }
@@ -3739,7 +3739,7 @@ enum zebra_dplane_result dplane_rem_neigh_delete(const struct interface *ifp,
        update_flags |= DPLANE_NEIGH_REMOTE;
 
        result = neigh_update_internal(DPLANE_OP_NEIGH_DELETE, ifp, NULL,
-                                      AF_ETHERNET, ip, 0, 0, update_flags, ZEBRA_ROUTE_NEIGH);
+                                      AF_ETHERNET, ip, 0, 0, update_flags, 0);
 
        return result;
 }
@@ -3763,7 +3763,7 @@ enum zebra_dplane_result dplane_vtep_add(const struct interface *ifp,
        addr.ipaddr_v4 = *ip;
 
        result = neigh_update_internal(DPLANE_OP_VTEP_ADD, ifp, &mac,
-                                      AF_ETHERNET, &addr, 0, 0, 0, ZEBRA_ROUTE_NEIGH);
+                                      AF_ETHERNET, &addr, 0, 0, 0, 0);
 
        return result;
 }
@@ -3789,7 +3789,7 @@ enum zebra_dplane_result dplane_vtep_delete(const struct interface *ifp,
 
        result = neigh_update_internal(DPLANE_OP_VTEP_DELETE, ifp,
                                       (const void *)&mac, AF_ETHERNET, &addr,
-                                      0, 0, 0, ZEBRA_ROUTE_NEIGH);
+                                      0, 0, 0, 0);
 
        return result;
 }
@@ -3801,7 +3801,7 @@ enum zebra_dplane_result dplane_neigh_discover(const struct interface *ifp,
 
        result = neigh_update_internal(DPLANE_OP_NEIGH_DISCOVER, ifp, NULL,
                                       AF_ETHERNET, ip, DPLANE_NTF_USE,
-                                      DPLANE_NUD_INCOMPLETE, 0, ZEBRA_ROUTE_NEIGH);
+                                      DPLANE_NUD_INCOMPLETE, 0, 0);
 
        return result;
 }
index 11bc0a2c905aa3bacf2ebedbaa7329fa9c5a9a31..82a0e6d015701e1f74352d5fa98b2c55d86a25b1 100644 (file)
@@ -112,7 +112,6 @@ static const struct {
        [ZEBRA_ROUTE_OPENFABRIC] = {ZEBRA_ROUTE_OPENFABRIC, 115, 4},
        [ZEBRA_ROUTE_VRRP] = {ZEBRA_ROUTE_VRRP, 255, 6},
        [ZEBRA_ROUTE_SRTE] = {ZEBRA_ROUTE_SRTE, 255, 6},
-       [ZEBRA_ROUTE_NEIGH] = {ZEBRA_ROUTE_NEIGH, 255, 6},
        /* Any new route type added to zebra, should be mirrored here */
 
        /* no entry/default: 150 */