Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932928AbbFWByR (ORCPT ); Mon, 22 Jun 2015 21:54:17 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:33395 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754112AbbFWByG (ORCPT ); Mon, 22 Jun 2015 21:54:06 -0400 Message-ID: <5588BC38.4060207@miraclelinux.com> Date: Tue, 23 Jun 2015 10:54:00 +0900 From: =?UTF-8?B?WU9TSElGVUpJIEhpZGVha2kv5ZCJ6Jek6Iux5piO?= Organization: MIRACLE LINUX CORPORATION User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Matthias Schiffer , Steven Barth CC: hideaki.yoshifuji@miraclelinux.com, Markus Stenberg , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "YOSHIFUJI Hideaki (USAGI Project)" Subject: Re: [PATCH] ipv6: Fixed source specific default route handling. References: <7922B483-7EA7-4B50-BF1C-7681EB7CC454@iki.fi> <5586F1F8.1070800@universe-factory.net> <0D0CB420-018B-465C-B27B-72016F41C268@iki.fi> <55873C46.4090804@universe-factory.net> <5587A418.4000308@midlink.org> <55884B12.7010307@universe-factory.net> In-Reply-To: <55884B12.7010307@universe-factory.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3120 Lines: 73 Matthias Schiffer wrote: > On 06/22/2015 07:58 AM, Steven Barth wrote: >> On 22.06.2015 00:35, Matthias Schiffer wrote: >>> Could you explain in detail what you mean with "If you want specific SA, >>> add same route with higher metric and/or (more) specific src match."? >>> Routes aren't bound to specific addresses except via the "src" attribute >>> (which is called prefsrc in the kernel), which is exactly what it not >>> working. I can't control the chosen source address at all when >>> source-specific routes are involved. >> Except that prefsrc and src are two different beasts and usually ip route from transates to >> RTA_SRC instead of RTA_PREFSOURCE when used with a prefix length. >> >> Try adding two routes to the same destination with the same metric but different source values with PREFSRC (e.g. IPv4) and then >> try doing the same with SRC (e.g. IPv6). The former will fail but the latter will succeed. > > Ah sorry, I didn't know that "src" and "prefsrc" were distinct concepts. > I meant to refer to "src" whenever I wrote "prefsrc". What are the > precise semantics of the "src" attribute? Any RFC I can read, or is this > a Linux-specific concept? > "src" is long-lived feature which is usually used with mutiple routing tables by "ip rule". --yoshfuji >> >> >> https://tools.ietf.org/html/draft-troan-homenet-sadr-01 >> was the original draft for source-address dependent routing IIRC so might be a good read. > > Thanks for the link, that helps a bit. > >> >> >>> >>> Even though the source-specific route has a higher metric than the >>> generic one, the source-specific one shadows the generic route. >> >> (was a bit ago since I read into this so please correct me if I am wrong) >> IIRC this is intentional since longest-prefix-match beats metric here >> and the source-address match counts to being more-specific here. See also above difference between PREFSRC and SRC. > > Ah, that would explain the metric issue. I looks like the source of my > confusion is that for source-specific routes *all* addresses are in the > candidate set, not only the addresses of the outgoing interface (which > makes sense as ip6_route_get_saddr() is called with a NULL rt6_info in > the source-specific case). > > I'm not sure if this can be fixed in a sane way (as there seems to be a > dependency cycle: source address should depend on outgoing interface, > which depends on the chosen route, which depends on the source address), > but it leads to highly unintuitive source address selection :( > > Markus suggested in the commit message not to call ip6_route_output at > all before the source address has been selected. Wouldn't this make it > impossible to choose the source address depending on the outgoing > interface in the non-source-specific case as well? > >> Cheers, >> >> Steven > > Thanks for the explanation, > Matthias > -- 吉藤英明 ミラクル・リナックス株式会社 技術本部 サポート部 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/