Date: Tue, 3 Mar 2015 22:01:33 +0100
From: Sylvain Rochet <address@hidden>
To: lwip-devel <address@hidden>
Subject: Re: [lwip-devel] IPv6 L2TP PPP review
Message-ID: <address@hidden>
Content-Type: text/plain; charset="utf-8"
Hello Ivan,
On Tue, Mar 03, 2015 at 10:25:30AM -0700, Ivan Delamer wrote:
The initial state you should set for your address depends on whether
you have DAD enabled or not.
If DAD is enabled (usual case), you should set it to
IP6_ADDR_TENTATIVE.
Doing that work.
If DAD is disabled, you should set it to IP6_ADDR_PREFERRED.
Doing that doesn't seem to work.
I think that in a PPP link DAD is actually not required, and
probably wouldn't work because it requires multicast support. So I
would set the state to IP6_ADDR_PREFERRED and it should work.
I forgot to tell, but this was on plain Ethernet.
I am using the following in ppp.c and it works fine:
ip6_addr_copy(pcb->netif->ip6_addr[0], pcb->addrs.our6_ipaddr);
netif_ip6_addr_set_state(pcb->netif, 0, IP6_ADDR_PREFERRED);
IP6CP only negotiate a link local address, user is then responsible to
configure use static addressing (or use DHCPv6).
I'm not sure why IP6_ADDR_VALID wouldn't work, although generally
you want it to be either PREFERRED or DEPRECATED, which is VALID
with an extra flag.
What are you seeing that makes you say "it didn't work"?
On Linux host:
# ip -6 address add 2001::1/64 dev tap0
Inside lwIP:
Netif is just the interface on the other side of tap0, nothing
complicated.
Dup detect enabled, using IP6_ADDR_TENTATIVE:
netif.ip6_addr[1].addr[0] = PP_HTONL(0x20010000);
netif.ip6_addr[1].addr[1] = PP_HTONL(0x00000000);
netif.ip6_addr[1].addr[2] = PP_HTONL(0x00000000);
netif.ip6_addr[1].addr[3] = PP_HTONL(0x00000002); /* 2001::2 */
netif_ip6_addr_set_state(&netif, 1, IP6_ADDR_TENTATIVE);
netif_create_ip6_linklocal_address(&netif, 1);
It works:
# ping6 -I tap0 fe80::0012:34ff:fe56:7800
PING fe80::0012:34ff:fe56:7800(fe80::12:34ff:fe56:7800) from
fe80::a034:6ff:fed1:d95c tap0: 56 data bytes
64 bytes from fe80::12:34ff:fe56:7800: icmp_seq=1 ttl=255 time=0.120
ms
$ ping6 2001::2
PING 2001::2(2001::2) 56 data bytes
64 bytes from 2001::2: icmp_seq=1 ttl=255 time=0.134 ms
Dup detect disabled (or enabled, it doesn't change the result),
IP6_ADDR_TENTATIVE disabled, interface forced VALID,PREFERRED:
netif.ip6_addr[1].addr[0] = PP_HTONL(0x20010000);
netif.ip6_addr[1].addr[1] = PP_HTONL(0x00000000);
netif.ip6_addr[1].addr[2] = PP_HTONL(0x00000000);
netif.ip6_addr[1].addr[3] = PP_HTONL(0x00000002);
netif_ip6_addr_set_state(&netif, 1, IP6_ADDR_PREFERRED);
netif_create_ip6_linklocal_address(&netif, 1);
Link local is still working:
# ping6 -I tap0 fe80::0012:34ff:fe56:7800
PING fe80::0012:34ff:fe56:7800(fe80::12:34ff:fe56:7800) from
fe80::484:3bff:febd:d33f tap0: 56 data bytes
64 bytes from fe80::12:34ff:fe56:7800: icmp_seq=1 ttl=255 time=0.123
ms
Link global doesn't work:
$ ping6 2001::2
PING 2001::2(2001::2) 56 data bytes
From 2001::1 icmp_seq=1 Destination unreachable: Address unreachable
I am sending neighbor solicitation requests but I don't get any
answer:
# tcpdump -vvvv -i tap0 -n -p
tcpdump: listening on tap0, link-type EN10MB (Ethernet), capture size
262144 bytes
21:58:07.782247 IP6 (hlim 255, next-header ICMPv6 (58) payload
length: 32) 2001::1 > ff02::1:ff00:2: [icmp6 sum ok] ICMP6, neighbor
solicitation, length 32, who has 2001::2
source link-address option (1), length 8 (1): 06:84:3b:bd:d3:3f
0x0000: 0684 3bbd d33f
21:58:08.782208 IP6 (hlim 255, next-header ICMPv6 (58) payload
length: 32) fe80::484:3bff:febd:d33f > ff02::1:ff00:2: [icmp6 sum ok]
ICMP6, neighbor solicitation, length 32, who has 2001::2
source link-address option (1), length 8 (1): 06:84:3b:bd:d3:3f
0x0000: 0684 3bbd d33f
21:58:09.782193 IP6 (hlim 255, next-header ICMPv6 (58) payload
length: 32) 2001::1 > ff02::1:ff00:2: [icmp6 sum ok] ICMP6, neighbor
solicitation, length 32, who has 2001::2
source link-address option (1), length 8 (1): 06:84:3b:bd:d3:3f
0x0000: 0684 3bbd d33f
Cheers,
Sylvain