* [PATCH net] ipv6: don't reject link-local nexthop on other interface
@ 2015-08-07 8:54 Florian Westphal
2015-08-10 20:29 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2015-08-07 8:54 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal, Hannes Frederic Sowa
48ed7b26faa7 ("ipv6: reject locally assigned nexthop addresses") is too
strict; it rejects following corner-case:
ip -6 route add default via fe80::1:2:3 dev eth1
[ where fe80::1:2:3 is assigned to a local interface, but not eth1 ]
Fix this by restricting search to given device if nh is linklocal.
Joint work with Hannes Frederic Sowa.
Fixes: 48ed7b26faa7 ("ipv6: reject locally assigned nexthop addresses")
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv6/route.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6090969..9de4d2b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1831,6 +1831,7 @@ int ip6_route_add(struct fib6_config *cfg)
int gwa_type;
gw_addr = &cfg->fc_gateway;
+ gwa_type = ipv6_addr_type(gw_addr);
/* if gw_addr is local we will fail to detect this in case
* address is still TENTATIVE (DAD in progress). rt6_lookup()
@@ -1838,11 +1839,12 @@ int ip6_route_add(struct fib6_config *cfg)
* prefix route was assigned to, which might be non-loopback.
*/
err = -EINVAL;
- if (ipv6_chk_addr_and_flags(net, gw_addr, NULL, 0, 0))
+ if (ipv6_chk_addr_and_flags(net, gw_addr,
+ gwa_type & IPV6_ADDR_LINKLOCAL ?
+ dev : NULL, 0, 0))
goto out;
rt->rt6i_gateway = *gw_addr;
- gwa_type = ipv6_addr_type(gw_addr);
if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) {
struct rt6_info *grt;
--
2.0.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] ipv6: don't reject link-local nexthop on other interface
2015-08-07 8:54 [PATCH net] ipv6: don't reject link-local nexthop on other interface Florian Westphal
@ 2015-08-10 20:29 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-08-10 20:29 UTC (permalink / raw)
To: fw; +Cc: netdev, hannes
From: Florian Westphal <fw@strlen.de>
Date: Fri, 7 Aug 2015 10:54:28 +0200
> 48ed7b26faa7 ("ipv6: reject locally assigned nexthop addresses") is too
> strict; it rejects following corner-case:
>
> ip -6 route add default via fe80::1:2:3 dev eth1
>
> [ where fe80::1:2:3 is assigned to a local interface, but not eth1 ]
>
> Fix this by restricting search to given device if nh is linklocal.
>
> Joint work with Hannes Frederic Sowa.
>
> Fixes: 48ed7b26faa7 ("ipv6: reject locally assigned nexthop addresses")
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-10 20:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-07 8:54 [PATCH net] ipv6: don't reject link-local nexthop on other interface Florian Westphal
2015-08-10 20:29 ` David Miller
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).