Re: Mar 23 snapshot and ipv6 problem

2016-03-31 Thread Alexander Bluhm
On Thu, Mar 31, 2016 at 10:42:19AM +0200, Sebastien Marie wrote:
> On Wed, Mar 30, 2016 at 09:17:52PM +0200, Vincent Gross wrote:
> > 
> > Hi, can you apply this diff and check if the problem persists ?
> > 
> > diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c
> > index f9473d8..fa40fcf 100644
> > --- a/sys/netinet6/udp6_output.c
> > +++ b/sys/netinet6/udp6_output.c
> > @@ -171,6 +171,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct 
> > mbuf *addr6,
> > if (!IN6_ARE_ADDR_EQUAL(>inp_laddr6, laddr)) {
> > valid.sin6_addr = *laddr;
> > valid.sin6_port = in6p->inp_lport;
> > +   valid.sin6_scope_id = 0;
> > valid.sin6_family = AF_INET6;
> > valid.sin6_len = sizeof(valid);
> > error = in6_pcbaddrisavail(in6p, , 0, p);
> > 
> 
> yes, it corrects my problem with dhcpcd.

fine, then OK bluhm@



Re: Mar 23 snapshot and ipv6 problem

2016-03-31 Thread Sebastien Marie
On Wed, Mar 30, 2016 at 09:17:52PM +0200, Vincent Gross wrote:
> 
> Hi, can you apply this diff and check if the problem persists ?
> 
> diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c
> index f9473d8..fa40fcf 100644
> --- a/sys/netinet6/udp6_output.c
> +++ b/sys/netinet6/udp6_output.c
> @@ -171,6 +171,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct 
> mbuf *addr6,
>   if (!IN6_ARE_ADDR_EQUAL(>inp_laddr6, laddr)) {
>   valid.sin6_addr = *laddr;
>   valid.sin6_port = in6p->inp_lport;
> + valid.sin6_scope_id = 0;
>   valid.sin6_family = AF_INET6;
>   valid.sin6_len = sizeof(valid);
>   error = in6_pcbaddrisavail(in6p, , 0, p);
> 

yes, it corrects my problem with dhcpcd.

thanks.
-- 
Sebastien Marie



Re: Mar 23 snapshot and ipv6 problem

2016-03-30 Thread Alexander Bluhm
On Wed, Mar 30, 2016 at 09:17:52PM +0200, Vincent Gross wrote:
> Hi, can you apply this diff and check if the problem persists ?

It does not help my syslogd regression test.

cd /usr/src/regress/usr.sbin/syslogd && SUDO=sudo make 
run-regress-args-server-udp6.pl

I have also tried memset(, 0, sizeof(valid)), but it did not help.

When I replace the goto release with a debug printf(), this test
passes.  Then I get a bunch of these lines:

udp6_output: pcb addr not avail: inp laddr ::, src laddr ::1

bluhm

Index: netinet6/udp6_output.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/udp6_output.c,v
retrieving revision 1.46
diff -u -p -r1.46 udp6_output.c
--- netinet6/udp6_output.c  23 Mar 2016 15:50:36 -  1.46
+++ netinet6/udp6_output.c  29 Mar 2016 20:16:11 -
@@ -174,8 +174,15 @@ udp6_output(struct inpcb *in6p, struct m
valid.sin6_family = AF_INET6;
valid.sin6_len = sizeof(valid);
error = in6_pcbaddrisavail(in6p, , 0, p);
-   if (error)
-   goto release;
+   if (error) {
+   char ia[INET6_ADDRSTRLEN], sa[INET6_ADDRSTRLEN];
+   printf("%s: pcb addr not avail: inp laddr %s, "
+   "src laddr %s\n", __func__,
+   inet_ntop(AF_INET6, >inp_laddr6,
+   ia, sizeof(ia)),
+   inet_ntop(AF_INET6, laddr,
+   sa, sizeof(sa)));
+   }
}
} else {
if (IN6_IS_ADDR_UNSPECIFIED(>inp_faddr6)) {

> 
> diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c
> index f9473d8..fa40fcf 100644
> --- a/sys/netinet6/udp6_output.c
> +++ b/sys/netinet6/udp6_output.c
> @@ -171,6 +171,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct 
> mbuf *addr6,
>   if (!IN6_ARE_ADDR_EQUAL(>inp_laddr6, laddr)) {
>   valid.sin6_addr = *laddr;
>   valid.sin6_port = in6p->inp_lport;
> + valid.sin6_scope_id = 0;
>   valid.sin6_family = AF_INET6;
>   valid.sin6_len = sizeof(valid);
>   error = in6_pcbaddrisavail(in6p, , 0, p);



Re: Mar 23 snapshot and ipv6 problem

2016-03-30 Thread Vincent Gross
On 03/24/16 20:27, Sebastien Marie wrote:
> Hi,
> 
> I encountered a problem with IPv6 connectivity after upgrade to snapshot
> Mar 23 on my amd64 router.
> 
> The router use a pppoe session to get IPv4 and IPv6. I had to made a
> DHCP-ND request to get routable IPv6, and I use dhcpcd from ports for
> that.
> 
> The IPv4 is ok, but for IPv6, dhcpcd has the following error:
> 
> Mar 24 20:16:33 alf dhcpcd[43667]: DUID 00:01:00:01:1e:40:7c:6c
> Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:01
> Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:02
> Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: rebinding prior DHCPv6 lease
> Mar 24 20:16:35 alf dhcpcd[43667]: pppoe0: dhcp6_sendmessage: sendmsg: 
> Invalid argument
> Mar 24 20:17:03 alf dhcpcd[43667]: timed out
> Mar 24 20:17:03 alf dhcpcd[43667]: forked to background, child pid 10317
> 
> 
> I had ktraced it for grabing the sendmsg syscall arguments used:
> 
>  43667 dhcpcd   CALL  sendmsg(10,0x1abbb5052020,0)
>  43667 dhcpcd   STRU  struct msghdr { name=0x7f7c5260, namelen=28, 
> iov=0x1abbb5052050, iovlen=1, control=0x1abbb5052070, controllen=40, flags=0 }
>  43667 dhcpcd   STRU  struct iovec { base=0x1abb901b5000, len=167 }
>  43667 dhcpcd   STRU  struct sockaddr { AF_INET6, [ff02::1:2]:547 }
>  43667 dhcpcd   STRU  struct cmsghdr { len=36, level=41, type=46 }
>  43667 dhcpcd   RET   sendmsg -1 errno 22 Invalid argument
> 
> Below a full dmesg.
> 
> Thanks.
> 


Hi, can you apply this diff and check if the problem persists ?

diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c
index f9473d8..fa40fcf 100644
--- a/sys/netinet6/udp6_output.c
+++ b/sys/netinet6/udp6_output.c
@@ -171,6 +171,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf 
*addr6,
if (!IN6_ARE_ADDR_EQUAL(>inp_laddr6, laddr)) {
valid.sin6_addr = *laddr;
valid.sin6_port = in6p->inp_lport;
+   valid.sin6_scope_id = 0;
valid.sin6_family = AF_INET6;
valid.sin6_len = sizeof(valid);
error = in6_pcbaddrisavail(in6p, , 0, p);



Re: Mar 23 snapshot and ipv6 problem

2016-03-29 Thread Alexander Bluhm
On Tue, Mar 29, 2016 at 11:46:20AM +0100, Stuart Henderson wrote:
> On 2016/03/24 20:27, Sebastien Marie wrote:
> > Hi,
> > 
> > I encountered a problem with IPv6 connectivity after upgrade to snapshot
> > Mar 23 on my amd64 router.
> > 
> > The router use a pppoe session to get IPv4 and IPv6. I had to made a
> > DHCP-ND request to get routable IPv6, and I use dhcpcd from ports for
> > that.
> > 
> > The IPv4 is ok, but for IPv6, dhcpcd has the following error:
> > 
> > Mar 24 20:16:33 alf dhcpcd[43667]: DUID 00:01:00:01:1e:40:7c:6c
> > Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:01
> > Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:02
> > Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: rebinding prior DHCPv6 lease
> > Mar 24 20:16:35 alf dhcpcd[43667]: pppoe0: dhcp6_sendmessage: sendmsg: 
> > Invalid argument
> > Mar 24 20:17:03 alf dhcpcd[43667]: timed out
> > Mar 24 20:17:03 alf dhcpcd[43667]: forked to background, child pid 10317
> 
> This is due to the new in6_pcbaddrisavail() check in udp6_output.c
> (that is also in the 5.9 errata). This will work-around it for now:

This check is wrong.  I also see some fallout with my syslogd regress
test sending to ::1.  There the inp laddr is :: but the laddr from
in6_selectsrc() is ::1.

bluhm



Re: Mar 23 snapshot and ipv6 problem

2016-03-29 Thread Sebastien Marie
On Tue, Mar 29, 2016 at 11:46:20AM +0100, Stuart Henderson wrote:
> On 2016/03/24 20:27, Sebastien Marie wrote:
> > Hi,
> > 
> > I encountered a problem with IPv6 connectivity after upgrade to snapshot
> > Mar 23 on my amd64 router.
> > 
> > The router use a pppoe session to get IPv4 and IPv6. I had to made a
> > DHCP-ND request to get routable IPv6, and I use dhcpcd from ports for
> > that.
> > 
> > The IPv4 is ok, but for IPv6, dhcpcd has the following error:
> > 
> > Mar 24 20:16:33 alf dhcpcd[43667]: DUID 00:01:00:01:1e:40:7c:6c
> > Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:01
> > Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:02
> > Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: rebinding prior DHCPv6 lease
> > Mar 24 20:16:35 alf dhcpcd[43667]: pppoe0: dhcp6_sendmessage: sendmsg: 
> > Invalid argument
> > Mar 24 20:17:03 alf dhcpcd[43667]: timed out
> > Mar 24 20:17:03 alf dhcpcd[43667]: forked to background, child pid 10317
> 
> This is due to the new in6_pcbaddrisavail() check in udp6_output.c
> (that is also in the 5.9 errata). This will work-around it for now:

I confirm the workaround works.

> Index: udp6_output.c
> ===
> RCS file: /cvs/src/sys/netinet6/udp6_output.c,v
> retrieving revision 1.46
> diff -u -p -r1.46 udp6_output.c
> --- udp6_output.c 23 Mar 2016 15:50:36 -  1.46
> +++ udp6_output.c 29 Mar 2016 10:24:34 -
> @@ -175,7 +175,7 @@ udp6_output(struct inpcb *in6p, struct m
>   valid.sin6_len = sizeof(valid);
>   error = in6_pcbaddrisavail(in6p, , 0, p);
>   if (error)
> - goto release;
> + printf("udp6_output: in6_pcbaddrisavail\n");
>   }
>   } else {
>   if (IN6_IS_ADDR_UNSPECIFIED(>inp_faddr6)) {
> 
> (or just remove it).

Thanks.
-- 
Sebastien Marie



Re: Mar 23 snapshot and ipv6 problem

2016-03-29 Thread Stuart Henderson
On 2016/03/24 20:27, Sebastien Marie wrote:
> Hi,
> 
> I encountered a problem with IPv6 connectivity after upgrade to snapshot
> Mar 23 on my amd64 router.
> 
> The router use a pppoe session to get IPv4 and IPv6. I had to made a
> DHCP-ND request to get routable IPv6, and I use dhcpcd from ports for
> that.
> 
> The IPv4 is ok, but for IPv6, dhcpcd has the following error:
> 
> Mar 24 20:16:33 alf dhcpcd[43667]: DUID 00:01:00:01:1e:40:7c:6c
> Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:01
> Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: IAID 00:00:00:02
> Mar 24 20:16:33 alf dhcpcd[43667]: pppoe0: rebinding prior DHCPv6 lease
> Mar 24 20:16:35 alf dhcpcd[43667]: pppoe0: dhcp6_sendmessage: sendmsg: 
> Invalid argument
> Mar 24 20:17:03 alf dhcpcd[43667]: timed out
> Mar 24 20:17:03 alf dhcpcd[43667]: forked to background, child pid 10317

This is due to the new in6_pcbaddrisavail() check in udp6_output.c
(that is also in the 5.9 errata). This will work-around it for now:

Index: udp6_output.c
===
RCS file: /cvs/src/sys/netinet6/udp6_output.c,v
retrieving revision 1.46
diff -u -p -r1.46 udp6_output.c
--- udp6_output.c   23 Mar 2016 15:50:36 -  1.46
+++ udp6_output.c   29 Mar 2016 10:24:34 -
@@ -175,7 +175,7 @@ udp6_output(struct inpcb *in6p, struct m
valid.sin6_len = sizeof(valid);
error = in6_pcbaddrisavail(in6p, , 0, p);
if (error)
-   goto release;
+   printf("udp6_output: in6_pcbaddrisavail\n");
}
} else {
if (IN6_IS_ADDR_UNSPECIFIED(>inp_faddr6)) {

(or just remove it).

> I had ktraced it for grabing the sendmsg syscall arguments used:
> 
>  43667 dhcpcd   CALL  sendmsg(10,0x1abbb5052020,0)
>  43667 dhcpcd   STRU  struct msghdr { name=0x7f7c5260, namelen=28, 
> iov=0x1abbb5052050, iovlen=1, control=0x1abbb5052070, controllen=40, flags=0 }
>  43667 dhcpcd   STRU  struct iovec { base=0x1abb901b5000, len=167 }
>  43667 dhcpcd   STRU  struct sockaddr { AF_INET6, [ff02::1:2]:547 }
>  43667 dhcpcd   STRU  struct cmsghdr { len=36, level=41, type=46 }
>  43667 dhcpcd   RET   sendmsg -1 errno 22 Invalid argument

With this check disabled/neutered, the packets are sent like so:

11:26:43.567469 PPPoE 
code Session, version 1, type 1, id 0x02db, length 213
IPV6: fe80::225:90ff:fec0:77b5.546 > ff02::1:2.547: [udp sum ok]dhcp6 
reconfig [hlim 1] (len 171)
11:26:43.581748 PPPoE 
code Session, version 1, type 1, id 0x02db, length 155
IPV6: fe80::d2f0:dbff:fe6c:e000.547 > fe80::225:90ff:fec0:77b5.546: 
[udp sum ok]dhcp6 [class 0xc0] (len 113, hlim 64)

$ fstat | grep 546
root dhcpcd  1384   10* internet6 dgram udp *:546

As you'd expect, fe80::225:90ff:fec0:77b5 is the link-local address
on the pppoe interface.