netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: netdev@vger.kernel.org, joe@perches.com, bernat@luffy.cx,
	eric.dumazet@gmail.com, yoshfuji@linux-ipv6.org,
	davem@davemloft.net
Subject: Re: [PATCH iproute2 2/2] ip: remove NLM_F_EXCL in case of ECMPv6 routes
Date: Thu, 25 Oct 2012 18:48:07 +0200	[thread overview]
Message-ID: <50896D47.7030500@6wind.com> (raw)
In-Reply-To: <20121025092526.5bb0a7ca@nehalam.linuxnetplumber.net>

Le 25/10/2012 18:25, Stephen Hemminger a écrit :
> 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?
>
The way to manage route is just different. Maybe a patch in the kernel is more 
appropriate:

 From b4979c97f33bc41a0fa095751bfcc05de074afec Mon Sep 17 00:00:00 2001
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Thu, 25 Oct 2012 18:45:47 +0200
Subject: [PATCH] ipv6/multipath: remove flag NLM_F_EXCL after the first
  nexthop

fib6_add_rt2node() will reject the nexthop if this flag is set, so
we perform the check only for the first nexthop.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
  net/ipv6/route.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c42650c..9c7b5d8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2449,6 +2449,12 @@ beginning:
  				goto beginning;
  			}
  		}
+		/* Because each route is added like a single route we remove
+		 * this flag after the first nexthop (if there is a collision,
+		 * we have already fail to add the first nexthop:
+		 * fib6_add_rt2node() has reject it).
+		 */
+		cfg->fc_nlinfo.nlh->nlmsg_flags &= ~NLM_F_EXCL;
  		rtnh = rtnh_next(rtnh, &remaining);
  	}

-- 
1.7.12

  reply	other threads:[~2012-10-25 16:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 17:30 IPv6 multipath routes Vincent Bernat
2012-09-06 17:30 ` [PATCH] Fix "ip -6 route add ... nexthop" Vincent Bernat
2012-09-06 17:53   ` Vincent Bernat
2012-09-12  8:29     ` [RFC PATCH net-next 0/1] Add support of ECMPv6 Nicolas Dichtel
2012-09-12  8:29       ` [RFC PATCH net-next 1/1] ipv6: add support of ECMP Nicolas Dichtel
2012-09-12  8:48         ` YOSHIFUJI Hideaki
2012-09-12  9:42           ` YOSHIFUJI Hideaki
2012-09-12  9:53             ` Nicolas Dichtel
2012-09-14  7:59             ` [RFC PATCH net-next v2 0/1] Add support of ECMPv6 Nicolas Dichtel
2012-09-14  7:59               ` [RFC PATCH net-next v2 1/1] ipv6: add support of ECMP Nicolas Dichtel
2012-09-14  9:40               ` [RFC PATCH net-next v2 0/1] Add support of ECMPv6 Vincent Bernat
2012-09-14 13:35                 ` Nicolas Dichtel
2012-09-14 13:37                   ` Nicolas Dichtel
2012-10-15 12:36                   ` Vincent Bernat
2012-10-15 19:54                     ` Vincent Bernat
2012-09-19  9:18               ` [PATCH net-next v3 " Nicolas Dichtel
2012-09-19  9:18                 ` [PATCH net-next v3 1/1] ipv6: add support of ECMP Nicolas Dichtel
2012-09-20 21:15                   ` David Miller
2012-09-21  9:59                     ` [PATCH net-next v4 0/1] Add support of ECMPv6 Nicolas Dichtel
2012-09-21  9:59                       ` [PATCH net-next v4 1/1] ipv6: add support of ECMP Nicolas Dichtel
2012-09-21 17:48                       ` [PATCH net-next v4 0/1] Add support of ECMPv6 David Miller
2012-09-24 12:28                         ` Nicolas Dichtel
2012-10-01 13:56                         ` [PATCH net-next v5 " Nicolas Dichtel
2012-10-01 13:56                           ` [PATCH net-next v5 1/1] ipv6: add support of ECMP Nicolas Dichtel
2012-10-01 16:47                             ` Joe Perches
2012-10-02 16:02                               ` [PATCH net-next v6 0/1] Add support of ECMPv6 Nicolas Dichtel
2012-10-02 16:02                                 ` [PATCH net-next v6 1/1] ipv6: add support of equal cost multipath (ECMP) Nicolas Dichtel
2012-10-02 16:06                                   ` Nicolas Dichtel
2012-10-02 16:14                                     ` Eric Dumazet
2012-10-19  9:13                                       ` [PATCH net-next v7 0/1] Add support of ECMPv6 nicolas.dichtel
2012-10-19  9:13                                         ` [PATCH net-next v7 1/1] ipv6: add support of equal cost multipath (ECMP) nicolas.dichtel
2012-10-22  0:41                                           ` David Miller
2012-10-22 13:42                                             ` [PATCH net-next v8 0/1] Add support of ECMPv6 nicolas.dichtel
2012-10-22 13:42                                               ` [PATCH net-next v8 1/1] ipv6: add support of equal cost multipath (ECMP) nicolas.dichtel
2012-10-23  6:39                                                 ` David Miller
2012-10-23 12:42                                                   ` [PATCH iproute2 1/2] ip: fix "ip -6 route add ... nexthop" Nicolas Dichtel
2012-10-23 12:42                                                     ` [PATCH iproute2 2/2] ip: remove NLM_F_EXCL in case of ECMPv6 routes Nicolas Dichtel
2012-10-25 16:06                                                       ` Stephen Hemminger
2012-10-25 16:20                                                         ` Nicolas Dichtel
2012-10-25 16:25                                                           ` Stephen Hemminger
2012-10-25 16:48                                                             ` Nicolas Dichtel [this message]
2012-11-02  8:58                                                               ` [RESEND PATCH net-next] ipv6/multipath: remove flag NLM_F_EXCL after the first nexthop Nicolas Dichtel
2012-11-03  1:38                                                                 ` David Miller
2012-11-05  8:30                                                                   ` Nicolas Dichtel
2012-10-25 16:08                                                     ` [PATCH iproute2 1/2] ip: fix "ip -6 route add ... nexthop" Stephen Hemminger
2012-10-02 18:43                                     ` [PATCH net-next v6 1/1] ipv6: add support of equal cost multipath (ECMP) David Miller
2012-09-11 12:57 ` IPv6 multipath routes Ulrich Weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50896D47.7030500@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=bernat@luffy.cx \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).