diff mbox

net: ipv6: set route type for anycast routes

Message ID 1489626873-5371-1-git-send-email-dsa@cumulusnetworks.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

David Ahern March 16, 2017, 1:14 a.m. UTC
Anycast routes have the RTF_ANYCAST flag set, but when dumping routes
for userspace the route type is not set to RTN_ANYCAST. Make it so.

Fixes: 58c4fb86eabcb ("[IPV6]: Flag RTF_ANYCAST for anycast routes")
CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 net/ipv6/route.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Miller March 17, 2017, 3:41 a.m. UTC | #1
From: David Ahern <dsa@cumulusnetworks.com>
Date: Wed, 15 Mar 2017 18:14:33 -0700

> Anycast routes have the RTF_ANYCAST flag set, but when dumping routes
> for userspace the route type is not set to RTN_ANYCAST. Make it so.
> 
> Fixes: 58c4fb86eabcb ("[IPV6]: Flag RTF_ANYCAST for anycast routes")
> CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>

Good catch, applied, thanks.
David Ahern March 17, 2017, 3:45 a.m. UTC | #2
On 3/16/17 9:41 PM, David Miller wrote:
> From: David Ahern <dsa@cumulusnetworks.com>
> Date: Wed, 15 Mar 2017 18:14:33 -0700
> 
>> Anycast routes have the RTF_ANYCAST flag set, but when dumping routes
>> for userspace the route type is not set to RTN_ANYCAST. Make it so.
>>
>> Fixes: 58c4fb86eabcb ("[IPV6]: Flag RTF_ANYCAST for anycast routes")
>> CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
>> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
> 
> Good catch, applied, thanks.

Can you put this into stable for back to say 4.4? that way tools can
directly discriminate anycast routes from host routes for at least
new'ish kernels. Thanks,
David Miller March 17, 2017, 3:48 a.m. UTC | #3
From: David Ahern <dsa@cumulusnetworks.com>
Date: Thu, 16 Mar 2017 21:45:12 -0600

> On 3/16/17 9:41 PM, David Miller wrote:
>> From: David Ahern <dsa@cumulusnetworks.com>
>> Date: Wed, 15 Mar 2017 18:14:33 -0700
>> 
>>> Anycast routes have the RTF_ANYCAST flag set, but when dumping routes
>>> for userspace the route type is not set to RTN_ANYCAST. Make it so.
>>>
>>> Fixes: 58c4fb86eabcb ("[IPV6]: Flag RTF_ANYCAST for anycast routes")
>>> CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
>>> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
>> 
>> Good catch, applied, thanks.
> 
> Can you put this into stable for back to say 4.4?

I am only submitting patches for v4.10 and v4.9 -stable.
diff mbox

Patch

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 35c58b669ebd..9db1418993f2 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3423,6 +3423,8 @@  static int rt6_fill_node(struct net *net,
 	}
 	else if (rt->rt6i_flags & RTF_LOCAL)
 		rtm->rtm_type = RTN_LOCAL;
+	else if (rt->rt6i_flags & RTF_ANYCAST)
+		rtm->rtm_type = RTN_ANYCAST;
 	else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK))
 		rtm->rtm_type = RTN_LOCAL;
 	else