lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] IPv6: Ensuring Router Advertisements and SLAAC Work


From: Grant Erickson
Subject: [lwip-devel] IPv6: Ensuring Router Advertisements and SLAAC Work
Date: Thu, 27 Dec 2012 15:48:49 -0800

Ivan,

More progress on IPv6 to report. I added the following to my initialization 
function:

        @@ -145,7 +180,20 @@ static void host_hardware_init(struct netif *netif)
         #endif
         #if LWIP_IPV6 && LWIP_IPV6_MLD
             netif->mld_mac_filter = host_mld_mac_filter;
        -#endif
        +#if LWIP_IPV6_AUTOCONFIG
        +    // Ensure that any interface supporting IPv6 is subscribed to the
        +    // link-local all-nodes address (ff02::1) such that it picks up
        +    // router advertisements for stateless address auto-configuration
        +    // (SLAAC).
        +    {
        +        ip6_addr_t allnodes_linklocal;
        +        
        +        ip6_addr_set_allnodes_linklocal(&allnodes_linklocal);
        +
        +        host_mld_mac_filter(netif, &allnodes_linklocal, 
MLD6_ADD_MAC_FILTER);
        +    }
        +#endif // LWIP_IPV6_AUTOCONFIG
        +#endif // LWIP_IPV6 && LWIP_IPV6_MLD

and I now correctly receive a SLAAC address based on router advertisements:

        > ip addr show
        1: en0: <BROADCAST,UP,LOWER_UP,> mtu 1536
            link/ether 02:28:3e:3d:43:47 brd ff:ff:ff:ff:ff:ff
            inet 10.2.1.28/16 brd 10.2.255.255 scope global en0
            inet6 FE80::0228:3EFF:FE3D:4347/64 scope link 
            inet6 FDCB:6364:780D:D6A1:0228:3EFF:FE3D:4347/64 scope unique 

and can ping6 the address from Linux:

        % ping6 -c 4 FDCB:6364:780D:D6A1:0228:3EFF:FE3D:4347
        PING 
FDCB:6364:780D:D6A1:0228:3EFF:FE3D:4347(fdcb:6364:780d:d6a1:0228:3eff:fe3d:4347)
 56 data bytes
        64 bytes from fdcb:6364:780d:d6a1:0228:3eff:fe3d:4347: icmp_seq=1 
ttl=255 time=91.1 ms
        64 bytes from fdcb:6364:780d:d6a1:0228:3eff:fe3d:4347: icmp_seq=2 
ttl=255 time=98.1 ms
        64 bytes from fdcb:6364:780d:d6a1:0228:3eff:fe3d:4347: icmp_seq=3 
ttl=255 time=4.46 ms
        64 bytes from fdcb:6364:780d:d6a1:0228:3eff:fe3d:4347: icmp_seq=4 
ttl=255 time=14.2 ms

        --- FDCB:6364:780D:D6A1:0228:3EFF:FE3D:4347 ping statistics ---
        4 packets transmitted, 4 received, 0% packet loss, time 3005ms
        rtt min/avg/max/mdev = 4.467/51.981/98.148/42.855 ms

and can ping6 Linux back:

        > ping6 -c 4 fdcb:6364:780d:d6a1:20c:29ff:fe15:eeb8
        PING fdcb:6364:780d:d6a1:20c:29ff:fe15:eeb8 
(FDCB:6364:780D:D6A1:20C:29FF:FE15:EEB8): 56(104) bytes of data
        64 bytes from fdcb:6364:780d:d6a1:20c:29ff:fe15:eeb8 
(FDCB:6364:780D:D6A1:20C:29FF:FE15:EEB8): icmp_seq=1 ttl=64
        64 bytes from fdcb:6364:780d:d6a1:20c:29ff:fe15:eeb8 
(FDCB:6364:780D:D6A1:20C:29FF:FE15:EEB8): icmp_seq=2 ttl=64
        64 bytes from fdcb:6364:780d:d6a1:20c:29ff:fe15:eeb8 
(FDCB:6364:780D:D6A1:20C:29FF:FE15:EEB8): icmp_seq=3 ttl=64
        64 bytes from fdcb:6364:780d:d6a1:20c:29ff:fe15:eeb8 
(FDCB:6364:780D:D6A1:20C:29FF:FE15:EEB8): icmp_seq=4 ttl=64

        --- fdcb:6364:780d:d6a1:20c:29ff:fe15:eeb8 ping statistics ---
        4 packets transmitted, 4 received, 0 duplicates, 0 errors 0% packet 
loss, time 5054ms
        round-trip min/avg/max = 0.000/1012.000/253.000 ms

It seems as though the patched block above should be within the IPv6 core stack 
of LwIP itself rather than being in the platform support glue, much as I'd 
argue for the netif_create_ip6_linklocal_address() call following netif_add().

Setting LWIP_IPV6_AUTOCONFIG clearly isn't enough to get SLAAC working. At 
minimum:

        1) The above diff
        2) The below diff:

                +#if LWIP_IPV6
                +    // Establish an IPv6 link-local address
                +
                +    netif_create_ip6_linklocal_address(&my_if, 1);
                +#if LWIP_IPV6_AUTOCONFIG
                +    my_if.ip6_autoconfig_enabled = 1;
                +#endif
                +#endif

           after netif_add().

are required.


reply via email to

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