netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/2] ip: Nexthop flags extensions
@ 2020-11-19 13:57 Ido Schimmel
  2020-11-19 13:57 ` [PATCH iproute2-next 1/2] ip route: Print "trap" nexthop indication Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ido Schimmel @ 2020-11-19 13:57 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, roopa, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@nvidia.com>

Patch #1 prints the recently added 'RTNH_F_TRAP' flag.

Patch #2 makes sure that nexthop flags are always printed for nexthop
objects. Even when the nexthop does not have a device, such as a
blackhole nexthop or a group.

Example output with netdevsim:

# ip nexthop
id 1 via 192.0.2.2 dev eth0 scope link trap
id 2 blackhole trap
id 3 group 2 trap

Example output with mlxsw:

# ip nexthop
id 1 via 192.0.2.2 dev swp3 scope link offload
id 2 blackhole offload
id 3 group 2 offload

Tested with fib_nexthops.sh that uses "ip nexthop" output:

Tests passed: 164
Tests failed:   0

Ido Schimmel (2):
  ip route: Print "trap" nexthop indication
  nexthop: Always print nexthop flags

 ip/ipnexthop.c | 3 +--
 ip/iproute.c   | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH iproute2-next 1/2] ip route: Print "trap" nexthop indication
  2020-11-19 13:57 [PATCH iproute2-next 0/2] ip: Nexthop flags extensions Ido Schimmel
@ 2020-11-19 13:57 ` Ido Schimmel
  2020-11-19 13:57 ` [PATCH iproute2-next 2/2] nexthop: Always print nexthop flags Ido Schimmel
  2020-11-22 19:47 ` [PATCH iproute2-next 0/2] ip: Nexthop flags extensions David Ahern
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2020-11-19 13:57 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, roopa, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@nvidia.com>

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 <idosch@nvidia.com>
---
 ip/iproute.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ip/iproute.c b/ip/iproute.c
index 05ec2c296579..ebb5f160fc44 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)
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH iproute2-next 2/2] nexthop: Always print nexthop flags
  2020-11-19 13:57 [PATCH iproute2-next 0/2] ip: Nexthop flags extensions Ido Schimmel
  2020-11-19 13:57 ` [PATCH iproute2-next 1/2] ip route: Print "trap" nexthop indication Ido Schimmel
@ 2020-11-19 13:57 ` Ido Schimmel
  2020-11-22 19:47 ` [PATCH iproute2-next 0/2] ip: Nexthop flags extensions David Ahern
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2020-11-19 13:57 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, roopa, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@nvidia.com>

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 <idosch@nvidia.com>
---
 ip/ipnexthop.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c
index 22c664918fcc..b7ffff77c160 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);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2-next 0/2] ip: Nexthop flags extensions
  2020-11-19 13:57 [PATCH iproute2-next 0/2] ip: Nexthop flags extensions Ido Schimmel
  2020-11-19 13:57 ` [PATCH iproute2-next 1/2] ip route: Print "trap" nexthop indication Ido Schimmel
  2020-11-19 13:57 ` [PATCH iproute2-next 2/2] nexthop: Always print nexthop flags Ido Schimmel
@ 2020-11-22 19:47 ` David Ahern
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2020-11-22 19:47 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: roopa, mlxsw, Ido Schimmel

On 11/19/20 6:57 AM, Ido Schimmel wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> Patch #1 prints the recently added 'RTNH_F_TRAP' flag.
> 
> Patch #2 makes sure that nexthop flags are always printed for nexthop
> objects. Even when the nexthop does not have a device, such as a
> blackhole nexthop or a group.
> 
> Example output with netdevsim:
> 
> # ip nexthop
> id 1 via 192.0.2.2 dev eth0 scope link trap
> id 2 blackhole trap
> id 3 group 2 trap
> 
> Example output with mlxsw:
> 
> # ip nexthop
> id 1 via 192.0.2.2 dev swp3 scope link offload
> id 2 blackhole offload
> id 3 group 2 offload
> 
> Tested with fib_nexthops.sh that uses "ip nexthop" output:
> 
> Tests passed: 164
> Tests failed:   0
> 
> Ido Schimmel (2):
>   ip route: Print "trap" nexthop indication
>   nexthop: Always print nexthop flags
> 
>  ip/ipnexthop.c | 3 +--
>  ip/iproute.c   | 2 ++
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 

applied to iproute2-next, without preferential treatment.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-22 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 13:57 [PATCH iproute2-next 0/2] ip: Nexthop flags extensions Ido Schimmel
2020-11-19 13:57 ` [PATCH iproute2-next 1/2] ip route: Print "trap" nexthop indication Ido Schimmel
2020-11-19 13:57 ` [PATCH iproute2-next 2/2] nexthop: Always print nexthop flags Ido Schimmel
2020-11-22 19:47 ` [PATCH iproute2-next 0/2] ip: Nexthop flags extensions David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).