diff mbox

[iproute2,2/2] ip: remove NLM_F_EXCL in case of ECMPv6 routes

Message ID 1350996176-4000-2-git-send-email-nicolas.dichtel@6wind.com
State Superseded, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Nicolas Dichtel Oct. 23, 2012, 12:42 p.m. UTC
ECMPv6 routes are added each one after the other by the kernel, so we should
avoid to set the flag NLM_F_EXCL.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 ip/iproute.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

stephen hemminger Oct. 25, 2012, 4:06 p.m. UTC | #1
On Tue, 23 Oct 2012 14:42:56 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:

> ECMPv6 routes are added each one after the other by the kernel, so we should
> avoid to set the flag NLM_F_EXCL.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>  ip/iproute.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/ip/iproute.c b/ip/iproute.c
> index c60156f..799a70e 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -694,8 +694,11 @@ int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
>  		rtnh = RTNH_NEXT(rtnh);
>  	}
>  
> -	if (rta->rta_len > RTA_LENGTH(0))
> +	if (rta->rta_len > RTA_LENGTH(0)) {
>  		addattr_l(n, 1024, RTA_MULTIPATH, RTA_DATA(rta), RTA_PAYLOAD(rta));
> +		if (r->rtm_family == AF_INET6)
> +			n->nlmsg_flags &= ~NLM_F_EXCL;
> +	}
>  	return 0;
>  }
>  

Shouldn't this be true for multipath IPv4 as well?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Dichtel Oct. 25, 2012, 4:20 p.m. UTC | #2
Le 25/10/2012 18:06, Stephen Hemminger a écrit :
> On Tue, 23 Oct 2012 14:42:56 +0200
> Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
>
>> ECMPv6 routes are added each one after the other by the kernel, so we should
>> avoid to set the flag NLM_F_EXCL.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> ---
>>   ip/iproute.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/ip/iproute.c b/ip/iproute.c
>> index c60156f..799a70e 100644
>> --- a/ip/iproute.c
>> +++ b/ip/iproute.c
>> @@ -694,8 +694,11 @@ int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
>>   		rtnh = RTNH_NEXT(rtnh);
>>   	}
>>
>> -	if (rta->rta_len > RTA_LENGTH(0))
>> +	if (rta->rta_len > RTA_LENGTH(0)) {
>>   		addattr_l(n, 1024, RTA_MULTIPATH, RTA_DATA(rta), RTA_PAYLOAD(rta));
>> +		if (r->rtm_family == AF_INET6)
>> +			n->nlmsg_flags &= ~NLM_F_EXCL;
>> +	}
>>   	return 0;
>>   }
>>
>
> Shouldn't this be true for multipath IPv4 as well?
>
In IPv4, the message is treating in one shot, because all nexthops are added in 
the route. In IPv6, each nexthop is added like a single route and then they are 
linked together.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
stephen hemminger Oct. 25, 2012, 4:25 p.m. UTC | #3
On Thu, 25 Oct 2012 18:20:49 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:

> Le 25/10/2012 18:06, Stephen Hemminger a écrit :
> > On Tue, 23 Oct 2012 14:42:56 +0200
> > Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> >
> >> ECMPv6 routes are added each one after the other by the kernel, so we should
> >> avoid to set the flag NLM_F_EXCL.
> >>
> >> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> >> ---
> >>   ip/iproute.c | 5 ++++-
> >>   1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/ip/iproute.c b/ip/iproute.c
> >> index c60156f..799a70e 100644
> >> --- a/ip/iproute.c
> >> +++ b/ip/iproute.c
> >> @@ -694,8 +694,11 @@ int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
> >>   		rtnh = RTNH_NEXT(rtnh);
> >>   	}
> >>
> >> -	if (rta->rta_len > RTA_LENGTH(0))
> >> +	if (rta->rta_len > RTA_LENGTH(0)) {
> >>   		addattr_l(n, 1024, RTA_MULTIPATH, RTA_DATA(rta), RTA_PAYLOAD(rta));
> >> +		if (r->rtm_family == AF_INET6)
> >> +			n->nlmsg_flags &= ~NLM_F_EXCL;
> >> +	}
> >>   	return 0;
> >>   }
> >>
> >
> > Shouldn't this be true for multipath IPv4 as well?
> >
> In IPv4, the message is treating in one shot, because all nexthops are added in 
> the route. In IPv6, each nexthop is added like a single route and then they are 
> linked together.

So it is a fundamental design flaw in how either v4 or v6 was implemented in
the kernel?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/ip/iproute.c b/ip/iproute.c
index c60156f..799a70e 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -694,8 +694,11 @@  int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
 		rtnh = RTNH_NEXT(rtnh);
 	}
 
-	if (rta->rta_len > RTA_LENGTH(0))
+	if (rta->rta_len > RTA_LENGTH(0)) {
 		addattr_l(n, 1024, RTA_MULTIPATH, RTA_DATA(rta), RTA_PAYLOAD(rta));
+		if (r->rtm_family == AF_INET6)
+			n->nlmsg_flags &= ~NLM_F_EXCL;
+	}
 	return 0;
 }