1 Subject: [PATCH] Route metrics decode bug.
2 Array was not being offset correctly.
4 See http://bugs.archlinux.org/task/5669
6 Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
8 ip/iproute.c | 10 ++++------
9 1 files changed, 4 insertions(+), 6 deletions(-)
11 diff --git a/ip/iproute.c b/ip/iproute.c
12 index 24e7a86..16c398a 100644
15 @@ -142,7 +142,7 @@ int print_route(const struct sockaddr_nl
16 static int ip6_multiple_tables;
22 if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) {
23 fprintf(stderr, "Not a route: %08x %08x %08x\n",
24 @@ -446,7 +446,6 @@ #endif
25 fprintf(fp, "%s%x> ", first ? "<" : "", flags);
26 if (tb[RTA_CACHEINFO]) {
27 struct rta_cacheinfo *ci = RTA_DATA(tb[RTA_CACHEINFO]);
31 if (ci->rta_expires != 0)
32 @@ -473,7 +472,6 @@ #endif
33 if (tb[RTA_CACHEINFO])
34 ci = RTA_DATA(tb[RTA_CACHEINFO]);
35 if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) {
39 if (r->rtm_flags & RTM_F_CLONED)
40 @@ -506,13 +504,13 @@ #endif
41 mxlock = *(unsigned*)RTA_DATA(mxrta[RTAX_LOCK]);
43 for (i=2; i<= RTAX_MAX; i++) {
49 - if (i-2 < sizeof(mx_names)/sizeof(char*))
50 - fprintf(fp, " %s", mx_names[i-2]);
52 + if (i < sizeof(mx_names)/sizeof(char*) && mx_names[i])
53 + fprintf(fp, " %s", mx_names[i]);
55 fprintf(fp, " metric %d", i);