]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: When using Nexthop groups, use v6 RR semantics
authorDonald Sharp <sharpd@nvidia.com>
Mon, 6 Nov 2023 13:56:50 +0000 (08:56 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 6 Nov 2023 13:56:50 +0000 (08:56 -0500)
The nexthop group route replace operation was made consistent
across all versions of the kernel.  A v6 route replacement
does not need to do a delete than add when using nexthop
groups

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/rt_netlink.c
zebra/zebra_vty.c

index 3351b0395073ede854ce4d58561dfe6c763bf1df..58116c656375507246730198f57a60b2679620bf 100644 (file)
@@ -2209,7 +2209,8 @@ ssize_t netlink_route_multipath_msg_encode(int cmd, struct zebra_dplane_ctx *ctx
        req->n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST;
 
        if (((cmd == RTM_NEWROUTE) &&
-            ((p->family == AF_INET) || zrouter.v6_rr_semantics)) ||
+            ((p->family == AF_INET) || kernel_nexthops_supported() ||
+             zrouter.v6_rr_semantics)) ||
            force_rr)
                req->n.nlmsg_flags |= NLM_F_REPLACE;
 
@@ -3095,7 +3096,8 @@ netlink_put_route_update_msg(struct nl_batch *bth, struct zebra_dplane_ctx *ctx)
        } else if (dplane_ctx_get_op(ctx) == DPLANE_OP_ROUTE_INSTALL) {
                cmd = RTM_NEWROUTE;
        } else if (dplane_ctx_get_op(ctx) == DPLANE_OP_ROUTE_UPDATE) {
-               if (p->family == AF_INET || zrouter.v6_rr_semantics) {
+               if (p->family == AF_INET || kernel_nexthops_supported() ||
+                   zrouter.v6_rr_semantics) {
                        /* Single 'replace' operation */
 
                        /*
index fce358f9ff6c827e9a2a9644ebee2570503616f4..8c972487372823f186e75064d06e089b8e0f5955 100644 (file)
@@ -4028,6 +4028,17 @@ static int config_write_protocol(struct vty *vty)
        return 1;
 }
 
+static inline bool zebra_vty_v6_rr_semantics_used(void)
+{
+       if (zebra_nhg_kernel_nexthops_enabled())
+               return true;
+
+       if (zrouter.v6_rr_semantics)
+               return true;
+
+       return false;
+}
+
 DEFUN (show_zebra,
        show_zebra_cmd,
        "show zebra",
@@ -4048,7 +4059,8 @@ DEFUN (show_zebra,
        ttable_add_row(table, "EVPN|%s", is_evpn_enabled() ? "On" : "Off");
        ttable_add_row(table, "Kernel socket buffer size|%d", rcvbufsize);
        ttable_add_row(table, "v6 Route Replace Semantics|%s",
-                      zrouter.v6_rr_semantics ? "Replace" : "Delete then Add");
+                      zebra_vty_v6_rr_semantics_used() ? "Replace"
+                                                       : "Delete then Add");
 
 #ifdef GNU_LINUX
        if (!vrf_is_backend_netns())