From f2443d38837783010a31c9e175911ebada55ce73 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 3 Nov 2023 16:58:42 +0000 Subject: [PATCH] zebra: Move v6_rr_semantics to be part of zrouter structure Move global variable v6_rr_semantics from a global data structure into the zrouter data structure. Signed-off-by: Donald Sharp --- zebra/main.c | 4 +--- zebra/rib.h | 2 -- zebra/rt_netlink.c | 5 ++--- zebra/zebra_router.h | 2 ++ zebra/zebra_vty.c | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/zebra/main.c b/zebra/main.c index 1e833ce7f182..158d1b8c4c71 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -59,8 +59,6 @@ int retain_mode = 0; int graceful_restart; -bool v6_rr_semantics = false; - /* Receive buffer size for kernel control sockets */ #define RCVBUFSIZE_MIN 4194304 #ifdef HAVE_NETLINK @@ -385,7 +383,7 @@ int main(int argc, char **argv) vrf_configure_backend(VRF_BACKEND_NETNS); break; case OPTION_V6_RR_SEMANTICS: - v6_rr_semantics = true; + zrouter.v6_rr_semantics = true; break; case OPTION_ASIC_OFFLOAD: if (!strcmp(optarg, "notify_on_offload")) diff --git a/zebra/rib.h b/zebra/rib.h index e70b5c142363..665f286f67a7 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -627,8 +627,6 @@ extern void zebra_vty_init(void); extern pid_t pid; -extern bool v6_rr_semantics; - extern uint32_t rt_table_main_id; /* Name of hook calls */ diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index ec35842b0a7b..3351b0395073 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -2209,7 +2209,7 @@ 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) || v6_rr_semantics)) || + ((p->family == AF_INET) || zrouter.v6_rr_semantics)) || force_rr) req->n.nlmsg_flags |= NLM_F_REPLACE; @@ -3095,8 +3095,7 @@ 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 || v6_rr_semantics) { + if (p->family == AF_INET || zrouter.v6_rr_semantics) { /* Single 'replace' operation */ /* diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h index b700851df580..a926369ef8cd 100644 --- a/zebra/zebra_router.h +++ b/zebra/zebra_router.h @@ -209,6 +209,8 @@ struct zebra_router { bool notify_on_ack; bool v6_with_v4_nexthop; + bool v6_rr_semantics; + /* * If the asic is notifying us about successful nexthop * allocation/control. Some developers have made their diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index e7a59b47004a..45b5b75c3efd 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -4048,7 +4048,7 @@ 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", - v6_rr_semantics ? "Replace" : "Delete than Add"); + zrouter.v6_rr_semantics ? "Replace" : "Delete than Add"); #ifdef GNU_LINUX if (!vrf_is_backend_netns())