Skip to content

Commit

Permalink
zebra: When using Nexthop groups, use v6 RR semantics
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
donaldsharp committed Nov 6, 2023
1 parent 7fe9333 commit 7e1b56b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 4 additions & 2 deletions zebra/rt_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 */

/*
Expand Down
14 changes: 13 additions & 1 deletion zebra/zebra_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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())
Expand Down

0 comments on commit 7e1b56b

Please sign in to comment.