netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* JOIN_ANYCAST breakage w. "net: ipv6: put host and anycast routes on device with address"
@ 2017-11-14 17:36 Florian Westphal
  2017-11-15 15:57 ` David Ahern
  2017-11-18  0:09 ` David Ahern
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Westphal @ 2017-11-14 17:36 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev

Hi David

This test program no longer works with 4.14
(recvfrom: Resource temporarily unavailable)

after reverting commit
4832c30d5458387ff2533ff66fbde26ad8bb5a2d
(net: ipv6: put host and anycast routes on device with address)

it will work again ("OK").

Could you please have a look at this?

Thanks!
----------------------
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <netinet/in.h>
#include <errno.h>
#include <sys/ioctl.h>

#include <unistd.h>
#include <stdint.h>

#define ADDR	"fe80::1"
#define MAGIC	0x1c3c01a

int main(int argc, char *argv[])
{
	struct ipv6_mreq nreq = {};
	struct sockaddr_in6 addr = {
		.sin6_family = AF_INET6,
		.sin6_port = htons(12345),
	};
	int fd, fd2, index, tmp;

	if (argc < 2)
		return 1;

	fd = socket(AF_INET6, SOCK_DGRAM, 0);
	fd2 = socket(AF_INET6, SOCK_DGRAM, 0);
	if (fd < 0 || fd2 < 0) {
		perror("socket");
		return 1;
	}
	index = if_nametoindex(argv[1]);
	if (index <= 0) {
		perror("if_nametoindex");
		return 1;
	}

	nreq.ipv6mr_interface = index;
	inet_pton(AF_INET6, ADDR, &nreq.ipv6mr_multiaddr);
	if (setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_ANYCAST,
	    &nreq, sizeof(nreq)) < 0) {
		perror("setsockopt");
		return 1;
	}

	addr.sin6_addr = in6addr_any;
	if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
		perror("bind");
		return 1;
	}

	addr.sin6_port = htons(12346);
	inet_pton(AF_INET6, "::", &addr.sin6_addr);
	if (bind(fd2, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
		perror("bind");
		return 1;
	}

	inet_pton(AF_INET6, ADDR, &addr.sin6_addr);
	addr.sin6_port = htons(12345);
	tmp = MAGIC;
	if (sendto(fd2, &tmp, sizeof(tmp), 0,
			(struct sockaddr *)&addr, sizeof(addr)) < 0) {
		perror("sendto");
		return 1;
	}

	if (recvfrom(fd, (void *)&tmp, sizeof(tmp), MSG_DONTWAIT,
				NULL, NULL) < 0) {
		perror("recvfrom");
		return 1;
	}

	if (tmp != MAGIC)
		return 111;

	puts("OK");
	return 0;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: JOIN_ANYCAST breakage w. "net: ipv6: put host and anycast routes on device with address"
  2017-11-14 17:36 JOIN_ANYCAST breakage w. "net: ipv6: put host and anycast routes on device with address" Florian Westphal
@ 2017-11-15 15:57 ` David Ahern
  2017-11-18  0:09 ` David Ahern
  1 sibling, 0 replies; 4+ messages in thread
From: David Ahern @ 2017-11-15 15:57 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netdev

On 11/14/17 10:36 AM, Florian Westphal wrote:
> Hi David
> 
> This test program no longer works with 4.14
> (recvfrom: Resource temporarily unavailable)
> 
> after reverting commit
> 4832c30d5458387ff2533ff66fbde26ad8bb5a2d
> (net: ipv6: put host and anycast routes on device with address)
> 
> it will work again ("OK").
> 
> Could you please have a look at this?

Nothing obvious jumps out. At keep digging and get back to you. Most
likely will be a few days.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: JOIN_ANYCAST breakage w. "net: ipv6: put host and anycast routes on device with address"
  2017-11-14 17:36 JOIN_ANYCAST breakage w. "net: ipv6: put host and anycast routes on device with address" Florian Westphal
  2017-11-15 15:57 ` David Ahern
@ 2017-11-18  0:09 ` David Ahern
  2017-11-20 11:56   ` Florian Westphal
  1 sibling, 1 reply; 4+ messages in thread
From: David Ahern @ 2017-11-18  0:09 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netdev

On 11/14/17 10:36 AM, Florian Westphal wrote:
> Hi David
> 
> This test program no longer works with 4.14
> (recvfrom: Resource temporarily unavailable)
> 
> after reverting commit
> 4832c30d5458387ff2533ff66fbde26ad8bb5a2d
> (net: ipv6: put host and anycast routes on device with address)
> 
> it will work again ("OK").
> 
> Could you please have a look at this?
> 

This restores the previous behavior:

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 05eb7bc36156..1c29d9bcedc3 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1019,7 +1019,7 @@ static struct net_device
*ip6_rt_get_dev_rcu(struct rt6_info *rt)
 {
        struct net_device *dev = rt->dst.dev;

-       if (rt->rt6i_flags & RTF_LOCAL) {
+       if (rt->rt6i_flags & (RTF_LOCAL | RTF_ANYCAST)) {
                /* for copies of local routes, dst->dev needs to be the
                 * device if it is a master device, the master device if
                 * device is enslaved, and the loopback as the default

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: JOIN_ANYCAST breakage w. "net: ipv6: put host and anycast routes on device with address"
  2017-11-18  0:09 ` David Ahern
@ 2017-11-20 11:56   ` Florian Westphal
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2017-11-20 11:56 UTC (permalink / raw)
  To: David Ahern; +Cc: Florian Westphal, netdev

David Ahern <dsahern@gmail.com> wrote:
> On 11/14/17 10:36 AM, Florian Westphal wrote:
> > Hi David
> > 
> > This test program no longer works with 4.14
> > (recvfrom: Resource temporarily unavailable)
> > 
> > after reverting commit
> > 4832c30d5458387ff2533ff66fbde26ad8bb5a2d
> > (net: ipv6: put host and anycast routes on device with address)
> > 
> > it will work again ("OK").
> > 
> > Could you please have a look at this?
> > 
> 
> This restores the previous behavior:
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 05eb7bc36156..1c29d9bcedc3 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1019,7 +1019,7 @@ static struct net_device
> *ip6_rt_get_dev_rcu(struct rt6_info *rt)
>  {
>         struct net_device *dev = rt->dst.dev;
> 
> -       if (rt->rt6i_flags & RTF_LOCAL) {
> +       if (rt->rt6i_flags & (RTF_LOCAL | RTF_ANYCAST)) {
>                 /* for copies of local routes, dst->dev needs to be the
>                  * device if it is a master device, the master device if
>                  * device is enslaved, and the loopback as the default

Looks like it, thanks David!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-20 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-14 17:36 JOIN_ANYCAST breakage w. "net: ipv6: put host and anycast routes on device with address" Florian Westphal
2017-11-15 15:57 ` David Ahern
2017-11-18  0:09 ` David Ahern
2017-11-20 11:56   ` Florian Westphal

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).