From e405df7e784a7f9b0720a0e3349ef14516379b4e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 29 Jan 2019 20:07:49 -0500 Subject: [PATCH 1/3] zebra: some v6 attributes were being written twice Some v6 attributes for the netlink_route_build_singlepath code were being written two times for the NEXTHOP_TYPE_IPV6_IFINDEX nexthop type. Signed-off-by: Donald Sharp --- zebra/rt_netlink.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index ce2d25862d..b6ec7352ab 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1150,23 +1150,6 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, "nexthop via if %u(%u)", routedesc, nexthop->ifindex, nexthop->vrf_id); } - - if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { - if (cmd == RTM_NEWROUTE) { - if (!IN6_IS_ADDR_UNSPECIFIED(&nexthop->rmap_src.ipv6)) - addattr_l(nlmsg, req_size, RTA_PREFSRC, - &nexthop->rmap_src.ipv6, bytelen); - else if (!IN6_IS_ADDR_UNSPECIFIED(&nexthop->src.ipv6)) - addattr_l(nlmsg, req_size, RTA_PREFSRC, - &nexthop->src.ipv6, bytelen); - } - - if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug( - "netlink_route_multipath() (%s): " - "nexthop via if %u(%u)", - routedesc, nexthop->ifindex, nexthop->vrf_id); - } } /* This function takes a nexthop as argument and From 275565fb5a35a9edca2d4f845cb9460e0fcfe325 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 29 Jan 2019 20:17:36 -0500 Subject: [PATCH 2/3] zebra: some v4 attributes were being written 2 times When the nexthop->type is NEXTHOP_TYPE_IPV4_IFINDEX we were writing the RTA_PREFSRC 2 times for the build_singlepath and build_multipath functions. Signed-off-by: Donald Sharp --- zebra/rt_netlink.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index b6ec7352ab..a70d686687 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1133,8 +1133,7 @@ static void _netlink_route_build_singlepath(const char *routedesc, int bytelen, if (nexthop->type != NEXTHOP_TYPE_BLACKHOLE) addattr32(nlmsg, req_size, RTA_OIF, nexthop->ifindex); - if (nexthop->type == NEXTHOP_TYPE_IFINDEX - || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { + if (nexthop->type == NEXTHOP_TYPE_IFINDEX) { if (cmd == RTM_NEWROUTE) { if (nexthop->rmap_src.ipv4.s_addr) addattr_l(nlmsg, req_size, RTA_PREFSRC, @@ -1321,8 +1320,7 @@ static void _netlink_route_build_multipath(const char *routedesc, int bytelen, rtnh->rtnh_ifindex = nexthop->ifindex; /* ifindex */ - if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX - || nexthop->type == NEXTHOP_TYPE_IFINDEX) { + if (nexthop->type == NEXTHOP_TYPE_IFINDEX) { if (nexthop->rmap_src.ipv4.s_addr) *src = &nexthop->rmap_src; else if (nexthop->src.ipv4.s_addr) From b0538fc8b72eed7a7859a7670cf4e1c73b3bf3ff Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 29 Jan 2019 20:29:20 -0500 Subject: [PATCH 3/3] lib, zebra: Fix 'show ip route' char collision Apparently 'f' means both OpenFabric and a Failed kernel route installation. Let's switch the 'f' for the failed kernel route installation to 'r - rejected route'. Signed-off-by: Donald Sharp --- lib/route_types.pl | 2 +- zebra/zebra_vty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/route_types.pl b/lib/route_types.pl index 7435272761..f297096633 100755 --- a/lib/route_types.pl +++ b/lib/route_types.pl @@ -121,7 +121,7 @@ sub codelist { } $str =~ s/ $//; push @lines, $str . "\\n\" \\\n"; - push @lines, " \" > - selected route, * - FIB route, q - queued route, f - failed route\\n\\n\""; + push @lines, " \" > - selected route, * - FIB route, q - queued route, r - rejected route\\n\\n\""; return join("", @lines); } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 14288d7bc4..34ca5e7bd3 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -174,7 +174,7 @@ static char re_status_output_char(struct route_entry *re, struct nexthop *nhop) if (CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED)) return 'q'; - return 'f'; + return 'r'; } if (CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED))