From 3de35f41be3f4136a90d38f8f1e3f1016f334d02 Mon Sep 17 00:00:00 2001 From: Ido Schimmel Date: Thu, 19 Nov 2020 15:57:30 +0200 Subject: [PATCH 1/2] ip route: Print "trap" nexthop indication The kernel can now signal that a nexthop is trapping packets instead of forwarding them. Print the flag to help users understand the offload state of each nexthop. Signed-off-by: Ido Schimmel Signed-off-by: David Ahern --- ip/iproute.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ip/iproute.c b/ip/iproute.c index 05ec2c29..ebb5f160 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -362,6 +362,8 @@ void print_rt_flags(FILE *fp, unsigned int flags) print_string(PRINT_ANY, NULL, "%s ", "pervasive"); if (flags & RTNH_F_OFFLOAD) print_string(PRINT_ANY, NULL, "%s ", "offload"); + if (flags & RTNH_F_TRAP) + print_string(PRINT_ANY, NULL, "%s ", "trap"); if (flags & RTM_F_NOTIFY) print_string(PRINT_ANY, NULL, "%s ", "notify"); if (flags & RTNH_F_LINKDOWN) From 0788678991348642407381aa74456c9e71ca9974 Mon Sep 17 00:00:00 2001 From: Ido Schimmel Date: Thu, 19 Nov 2020 15:57:31 +0200 Subject: [PATCH 2/2] nexthop: Always print nexthop flags Currently, the nexthop flags are only printed when the nexthop has a nexthop device. The offload / trap indication is therefore not printed for nexthop groups. Instead, always print the nexthop flags, regardless if the nexthop has a nexthop device or not. Signed-off-by: Ido Schimmel Signed-off-by: David Ahern --- ip/ipnexthop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c index 22c66491..b7ffff77 100644 --- a/ip/ipnexthop.c +++ b/ip/ipnexthop.c @@ -263,8 +263,7 @@ int print_nexthop(struct nlmsghdr *n, void *arg) rtnl_rtprot_n2a(nhm->nh_protocol, b1, sizeof(b1))); } - if (tb[NHA_OIF]) - print_rt_flags(fp, nhm->nh_flags); + print_rt_flags(fp, nhm->nh_flags); if (tb[NHA_FDB]) print_null(PRINT_ANY, "fdb", "fdb", NULL);