diff options
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index d3588885f097..c73ae5039e46 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2504,9 +2504,9 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add) | |||
2504 | int attrlen; | 2504 | int attrlen; |
2505 | int err = 0, last_err = 0; | 2505 | int err = 0, last_err = 0; |
2506 | 2506 | ||
2507 | remaining = cfg->fc_mp_len; | ||
2507 | beginning: | 2508 | beginning: |
2508 | rtnh = (struct rtnexthop *)cfg->fc_mp; | 2509 | rtnh = (struct rtnexthop *)cfg->fc_mp; |
2509 | remaining = cfg->fc_mp_len; | ||
2510 | 2510 | ||
2511 | /* Parse a Multipath Entry */ | 2511 | /* Parse a Multipath Entry */ |
2512 | while (rtnh_ok(rtnh, remaining)) { | 2512 | while (rtnh_ok(rtnh, remaining)) { |
@@ -2536,15 +2536,19 @@ beginning: | |||
2536 | * next hops that have been already added. | 2536 | * next hops that have been already added. |
2537 | */ | 2537 | */ |
2538 | add = 0; | 2538 | add = 0; |
2539 | remaining = cfg->fc_mp_len - remaining; | ||
2539 | goto beginning; | 2540 | goto beginning; |
2540 | } | 2541 | } |
2541 | } | 2542 | } |
2542 | /* Because each route is added like a single route we remove | 2543 | /* Because each route is added like a single route we remove |
2543 | * this flag after the first nexthop (if there is a collision, | 2544 | * these flags after the first nexthop: if there is a collision, |
2544 | * we have already fail to add the first nexthop: | 2545 | * we have already failed to add the first nexthop: |
2545 | * fib6_add_rt2node() has reject it). | 2546 | * fib6_add_rt2node() has rejected it; when replacing, old |
2547 | * nexthops have been replaced by first new, the rest should | ||
2548 | * be added to it. | ||
2546 | */ | 2549 | */ |
2547 | cfg->fc_nlinfo.nlh->nlmsg_flags &= ~NLM_F_EXCL; | 2550 | cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | |
2551 | NLM_F_REPLACE); | ||
2548 | rtnh = rtnh_next(rtnh, &remaining); | 2552 | rtnh = rtnh_next(rtnh, &remaining); |
2549 | } | 2553 | } |
2550 | 2554 | ||