From: Matthias Schiffer <mschiffer@universe-factory.net>
To: Markus Stenberg <markus.stenberg@iki.fi>,
"David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Steven Barth <steven@midlink.org>
Subject: Re: [PATCH] ipv6: Fixed source specific default route handling.
Date: Sun, 21 Jun 2015 19:18:48 +0200 [thread overview]
Message-ID: <5586F1F8.1070800@universe-factory.net> (raw)
In-Reply-To: <7922B483-7EA7-4B50-BF1C-7681EB7CC454@iki.fi>
[-- Attachment #1: Type: text/plain, Size: 2443 bytes --]
On 05/05/2015 12:36 PM, Markus Stenberg wrote:
> If there are only IPv6 source specific default routes present, the
> host gets -ENETUNREACH on e.g. connect() because ip6_dst_lookup_tail
> calls ip6_route_output first, and given source address any, it fails,
> and ip6_route_get_saddr is never called.
>
> The change is to use the ip6_route_get_saddr, even if the initial
> ip6_route_output fails, and then doing ip6_route_output _again_ after
> we have appropriate source address available.
>
> Note that this is '99% fix' to the problem; a correct fix would be to
> do route lookups only within addrconf.c when picking a source address,
> and never call ip6_route_output before source address has been
> populated.
>
> Signed-off-by: Markus Stenberg <markus.stenberg@iki.fi>
> ---
> net/ipv6/ip6_output.c | 39 +++++++++++++++++++++++++++++++--------
> net/ipv6/route.c | 5 +++--
> 2 files changed, 34 insertions(+), 10 deletions(-)
>
...
So... how does ip6_route_get_saddr() select the source address when no
route is given? OpenWrt has recently started relying on this patch and
I'm seeing quite weird source address selection behaviour (@Steven:
especially since OpenWrt commit r45941).
Steps to reproduce:
ip l add test link eth0 type macvlan
ip l set test up
ip a add fd00::20/64 dev eth0
ip a add fd00::1/128 dev test
Upto here everything is okay,
ping6 fd00::10
will use the correct source address fd00::20.
Now I add an additional source-specific route:
ip r add fd00::/64 from fd00::/64 dev eth0
(this certainly looks like a contrived example, but the configuration
OpenWrt's netifd/odhcp6c creates is similar)
Without this patch, the ping will fail with 'network unreachable' (which
is weird by itself - why does the source-specific route shadow the
generic route even though no source address has been chosen?). But after
applying this patch, the kernel will now choose the address with the
longest common prefix with the destination, which is fd00::1 - even
though this address is assigned as /128.
Adding a prefsrc attribute to the source-specific route doesn't have an
effect as ip6_route_get_saddr() doesn't even get the route when the
non-source-specific ip6_route_output() has failed. Thus, there's
currently no way (to my knowledge) to specify the source address to use
when source-specific routes are involved...
Matthias
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-06-21 17:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-05 10:36 [PATCH] ipv6: Fixed source specific default route handling Markus Stenberg
2015-05-09 19:59 ` David Miller
2015-06-21 17:18 ` Matthias Schiffer [this message]
2015-06-21 22:05 ` Markus Stenberg
2015-06-21 22:35 ` Matthias Schiffer
2015-06-21 23:01 ` Markus Stenberg
2015-06-22 5:58 ` Steven Barth
2015-06-22 17:51 ` Matthias Schiffer
2015-06-23 1:54 ` YOSHIFUJI Hideaki/吉藤英明
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=5586F1F8.1070800@universe-factory.net \
--to=mschiffer@universe-factory.net \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.stenberg@iki.fi \
--cc=netdev@vger.kernel.org \
--cc=steven@midlink.org \
--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