lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] IPv6 L2TP PPP review


From: Ivan Delamer
Subject: Re: [lwip-devel] IPv6 L2TP PPP review
Date: Tue, 03 Mar 2015 10:25:30 -0700

Hi Sylvain,

By the way, I struggled a little bit setting UP a static IPv6 global
scope address and ended up with the following which I am not very happy
with:

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_TENTATIVE|IP6_ADDR_PREFERRED);
netif_create_ip6_linklocal_address(&netif, 1);


Using IP6_ADDR_VALID instead of IP6_ADDR_TENTATIVE didn't work and I
don't know why from looking at the source code, do you have a clue ?

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.

If DAD is disabled, you should set it to IP6_ADDR_PREFERRED.

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'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"?

Cheers
Ivan


Date: Mon, 2 Mar 2015 21:35:00 +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 Mon, Mar 02, 2015 at 01:16:55PM -0700, Ivan Delamer wrote:
Hello Sylvain,

I think your code is correct. I use something very similar for UDP
connections, only using netconns.

Thank you :)


In general once you are working with UDP or TCP, it is really quite
similar for IPv4 or IPv6, because you are one layer over that. It is
just address binding/comparison that needs to be done appropriately.

The API is not completely safe and requires care from the programmer.

I saw that, there is casts everywhere meaning functions calls/prototypes
coherency is not checked at all.


I think we have it as a task to improve ipX_addr_t to include a
version field. We just wanted to initially implement IPv6 in a way
that was easy to turn it off, and the resulting stack was exactly
the same as the old IPv4-only stack. We will have to improve it
though...

I agree it is a bit disappointing, this is why I wasn't sure, I am more used to sockaddr, sockaddr_in, sockaddr_in6, sockaddr_storage, "russian
dolls" structures.


By the way, I struggled a little bit setting UP a static IPv6 global
scope address and ended up with the following which I am not very happy
with:

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_TENTATIVE|IP6_ADDR_PREFERRED);
netif_create_ip6_linklocal_address(&netif, 1);


Using IP6_ADDR_VALID instead of IP6_ADDR_TENTATIVE didn't work and I
don't know why from looking at the source code, do you have a clue ?


Cheers,
Sylvain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]