All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2-master] iproute: Parse last nexthop in a multipath route
@ 2018-05-01 13:16 Ido Schimmel
  2018-05-01 14:59 ` David Ahern
  2018-05-02  2:37 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: Ido Schimmel @ 2018-05-01 13:16 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, mlxsw, Ido Schimmel

Continue parsing a multipath payload as long as another nexthop can fit
in the payload.

# ip route add 192.0.2.0/24 nexthop dev dummy0 nexthop dev dummy1

Before:
# ip route show 192.0.2.0/24
192.0.2.0/24
        nexthop dev dummy0 weight 1

After:
# ip route show 192.0.2.0/24
192.0.2.0/24
        nexthop dev dummy0 weight 1
        nexthop dev dummy1 weight 1

Fixes: f48e14880a0e ("iproute: refactor multipath print")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index 44351bc51b4b..56dd9f25e38e 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -650,7 +650,7 @@ static void print_rta_multipath(FILE *fp, const struct rtmsg *r,
 	int len = RTA_PAYLOAD(rta);
 	int first = 1;
 
-	while (len > sizeof(*nh)) {
+	while (len >= sizeof(*nh)) {
 		struct rtattr *tb[RTA_MAX + 1];
 
 		if (nh->rtnh_len > len)
-- 
2.14.3

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

* Re: [PATCH iproute2-master] iproute: Parse last nexthop in a multipath route
  2018-05-01 13:16 [PATCH iproute2-master] iproute: Parse last nexthop in a multipath route Ido Schimmel
@ 2018-05-01 14:59 ` David Ahern
  2018-05-02  2:37 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2018-05-01 14:59 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: stephen, mlxsw

On 5/1/18 7:16 AM, Ido Schimmel wrote:
> Continue parsing a multipath payload as long as another nexthop can fit
> in the payload.
> 
> # ip route add 192.0.2.0/24 nexthop dev dummy0 nexthop dev dummy1
> 
> Before:
> # ip route show 192.0.2.0/24
> 192.0.2.0/24
>         nexthop dev dummy0 weight 1
> 
> After:
> # ip route show 192.0.2.0/24
> 192.0.2.0/24
>         nexthop dev dummy0 weight 1
>         nexthop dev dummy1 weight 1
> 
> Fixes: f48e14880a0e ("iproute: refactor multipath print")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> ---
>  ip/iproute.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: David Ahern <dsahern@gmail.com>

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

* Re: [PATCH iproute2-master] iproute: Parse last nexthop in a multipath route
  2018-05-01 13:16 [PATCH iproute2-master] iproute: Parse last nexthop in a multipath route Ido Schimmel
  2018-05-01 14:59 ` David Ahern
@ 2018-05-02  2:37 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-05-02  2:37 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, dsahern, mlxsw

On Tue,  1 May 2018 16:16:35 +0300
Ido Schimmel <idosch@mellanox.com> wrote:

> Continue parsing a multipath payload as long as another nexthop can fit
> in the payload.
> 
> # ip route add 192.0.2.0/24 nexthop dev dummy0 nexthop dev dummy1
> 
> Before:
> # ip route show 192.0.2.0/24
> 192.0.2.0/24
>         nexthop dev dummy0 weight 1
> 
> After:
> # ip route show 192.0.2.0/24
> 192.0.2.0/24
>         nexthop dev dummy0 weight 1
>         nexthop dev dummy1 weight 1
> 
> Fixes: f48e14880a0e ("iproute: refactor multipath print")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>


Applied, thanks.

There  really ought to be test cases for this.

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

end of thread, other threads:[~2018-05-02  2:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01 13:16 [PATCH iproute2-master] iproute: Parse last nexthop in a multipath route Ido Schimmel
2018-05-01 14:59 ` David Ahern
2018-05-02  2:37 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.