[PATCH 10/12] Fix off-by-one in print of wrandom algo.

Andreas Henriksson
2007-10-12T08:57:46Z

From: Norbert Buchmuller <norbi@nix.hu>

The 'wrandom' multipath algo is recognised when adding the route, but
not resolved when it is printed (prints 'unknown'):

ianus:~# ip ro add 1.2.3.4 mpath wrandom nexthop dev ppp0 weight 1 nexthop dev ppp1 weight 2
ianus:~# ip ro get to 1.2.3.4
1.2.3.4 mpath unknown dev ppp0 src 62.77.192.67
cache mtu 1492 advmss 1452 hoplimit 64
ianus:~# ip ro del 1.2.3.4 mpath wrandom nexthop dev ppp0 weight 1 nexthop dev ppp1 weight 2

See http://bugs.debian.org/428440 for more information.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
ip/iproute.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index d3a3243..3b5c4b1 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -365,7 +365,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
__u32 mp_alg = *(__u32*) RTA_DATA(tb[RTA_MP_ALGO]);
if (mp_alg > IP_MP_ALG_NONE) {
fprintf(fp, "mpath %s ",
- mp_alg < IP_MP_ALG_MAX ? mp_alg_names[mp_alg] : "unknown");
+ mp_alg <= IP_MP_ALG_MAX ? mp_alg_names[mp_alg] : "unknown");
}
}

--
1.5.3.4