* [PATCH] ipv6: RTA_PREFSRC dumping was somewhat incorrect.
@ 2015-05-04 11:46 Markus Stenberg
2015-05-05 20:56 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Markus Stenberg @ 2015-05-04 11:46 UTC (permalink / raw)
To: davem, netdev; +Cc: Markus Stenberg
Avoid dumping RTA_PREFSRC twice if iif is not set, but dst is.
Note that the change also dumps RTA_PREFSRC even if iif RTA_IIF is
sent. As scopes are not that rare in IPv6, I believe that to be
correct behavior.
Signed-off-by: Markus Stenberg <markus.stenberg@iki.fi>
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 5c48293..442fa29 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2607,6 +2607,7 @@ static int rt6_fill_node(struct net *net,
struct nlmsghdr *nlh;
long expires;
u32 table;
+ struct in6_addr saddr_buf;
if (prefix) { /* user wants prefix routes only */
if (!(rt->rt6i_flags & RTF_PREFIX_RT)) {
@@ -2702,15 +2703,13 @@ static int rt6_fill_node(struct net *net,
#endif
if (nla_put_u32(skb, RTA_IIF, iif))
goto nla_put_failure;
- } else if (dst) {
- struct in6_addr saddr_buf;
+ }
+
+ if (dst) {
if (ip6_route_get_saddr(net, rt, dst, 0, &saddr_buf) == 0 &&
nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf))
goto nla_put_failure;
- }
-
- if (rt->rt6i_prefsrc.plen) {
- struct in6_addr saddr_buf;
+ } else if (rt->rt6i_prefsrc.plen) {
saddr_buf = rt->rt6i_prefsrc.addr;
if (nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf))
goto nla_put_failure;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipv6: RTA_PREFSRC dumping was somewhat incorrect.
2015-05-04 11:46 [PATCH] ipv6: RTA_PREFSRC dumping was somewhat incorrect Markus Stenberg
@ 2015-05-05 20:56 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-05-05 20:56 UTC (permalink / raw)
To: markus.stenberg; +Cc: netdev
From: Markus Stenberg <markus.stenberg@iki.fi>
Date: Mon, 4 May 2015 14:46:02 +0300
> Avoid dumping RTA_PREFSRC twice if iif is not set, but dst is.
>
> Note that the change also dumps RTA_PREFSRC even if iif RTA_IIF is
> sent. As scopes are not that rare in IPv6, I believe that to be
> correct behavior.
>
> Signed-off-by: Markus Stenberg <markus.stenberg@iki.fi>
The distinguishing characteristic that should decide whether we
provide a PREFSRC or not is whether this route is an output route
or not.
Neither the current logic, nor your patch, implements this.
But that's what this code needs to do.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-05 20:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 11:46 [PATCH] ipv6: RTA_PREFSRC dumping was somewhat incorrect Markus Stenberg
2015-05-05 20:56 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.