Skip to content

Commit

Permalink
lib, zebra: Notice when a nexthop is set linkdown
Browse files Browse the repository at this point in the history
When a nexthop is set RTNH_F_LINKDOWN, start noticing
that this flag is set.  Allow FRR to know about this
flag but at this point do not do anything with it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Jun 23, 2022
1 parent 52e8a7c commit c704cb4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/nexthop.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ struct nexthop {
#define NEXTHOP_FLAG_HAS_BACKUP (1 << 6) /* Backup nexthop index is set */
#define NEXTHOP_FLAG_SRTE (1 << 7) /* SR-TE color used for BGP traffic */
#define NEXTHOP_FLAG_EVPN (1 << 8) /* nexthop is EVPN */
#define NEXTHOP_FLAG_LINKDOWN (1 << 9) /* is not removed on link down */

#define NEXTHOP_IS_ACTIVE(flags) \
(CHECK_FLAG(flags, NEXTHOP_FLAG_ACTIVE) \
Expand Down
3 changes: 3 additions & 0 deletions zebra/rt_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ parse_nexthop_unicast(ns_id_t ns_id, struct rtmsg *rtm, struct rtattr **tb,
if (rtm->rtm_flags & RTNH_F_ONLINK)
SET_FLAG(nh.flags, NEXTHOP_FLAG_ONLINK);

if (rtm->rtm_flags & RTNH_F_LINKDOWN)
SET_FLAG(nh.flags, NEXTHOP_FLAG_LINKDOWN);

if (num_labels)
nexthop_add_labels(&nh, ZEBRA_LSP_STATIC, num_labels, labels);

Expand Down
9 changes: 9 additions & 0 deletions zebra/zebra_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ static void show_nexthop_detail_helper(struct vty *vty,
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK))
vty_out(vty, " onlink");

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_LINKDOWN))
vty_out(vty, " linkdown");

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
vty_out(vty, " (recursive)");

Expand Down Expand Up @@ -657,6 +660,9 @@ static void show_route_nexthop_helper(struct vty *vty,
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK))
vty_out(vty, " onlink");

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_LINKDOWN))
vty_out(vty, " linkdown");

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
vty_out(vty, " (recursive)");

Expand Down Expand Up @@ -837,6 +843,9 @@ static void show_nexthop_json_helper(json_object *json_nexthop,
json_object_boolean_true_add(json_nexthop,
"onLink");

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_LINKDOWN))
json_object_boolean_true_add(json_nexthop, "linkDown");

if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
json_object_boolean_true_add(json_nexthop,
"recursive");
Expand Down

0 comments on commit c704cb4

Please sign in to comment.