This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IPv6 Stateless Address Autoconfiguration

Other Parts Discussed in Thread: EK-TM4C1294XL

Hi,

I researched on some documents but I found no example of how to use/configure IPv6 Stateless Address Autoconfiguration. I just found a reference that NDK supports: 

  • RFC 2461 Neighbor Discovery for IPv6
  • RFC 2462 IPv6 Stateless Address Autoconfiguration

Is there any example how use/configure IPv6 Stateless Address Autoconfiguration?

Thanks,

Vini

System BIOS: tirtos_tivac_2_01_00_03

Board: EK-TM4C1294XL

  • TI-RTOS doesn't have such an example but let me check if we have one somewhere else.

  • Vini,

    I was told that you can look at the tcpEchoIPv6 example in TI-RTOS.

    Stateless … Autoconfiguration (SLAAC) is automatic once IPv6 is enabled in the stack (hence the “auto config” :).  All this means is that the IPv6 stack will give you an IPv6 (link local) address based on your MAC address for you.

  • Sorry, actually I need a global address(that can be pinged over the network), not a link-local address.

     

    I'm able to assign a fixed IPv6 as 2001:db8::ff00:42:8329 and ping works. Now I need an IPv6 via DHCPv6 or Neighbor Discovery Protocol. 

     

    Is it possible get a global IPv6 address through DHCPv6 or Neighbor Discovery Protocol/Stateless address autoconfiguration?

     

    Vini,

    Thanks

  • Hi Vini,

    Unfortunately the NDK stack does not contain support for the DHCPv6 protocol out of the box.  As far as I know, it is possible to get a global address from a DHCPv6 server, but you would need to implement a DHCPv6 client yourself and add it into the NDK stack.

    As for autoconfig giving you a global address, my understanding is that this depends on the router that's in your network.  I believe the router must be configured properly for a global address and to send a Router Advertisement (RA) that contains the global address prefix and has the "Autonomous Address Configuration flag" set to 1.

    If the NDK stack receives a (RA) such as this, then the stack should use that global prefix to form an IPv6 address and bind it.

    For reference, I see this code in the NDK "icmpv6_ndisc.c" in the function ICMPv6RecvRA:

                    /* If the Autonomous Flag is SET; we follow the RFC 2462 Section 5.5.3 and procees the option
                     * accordingly. */
                    if (ptr_prefix_opt->Flags & ICMPV6_PREFIX_OPT_A_FLAG)
                    {
                        /* Form the new address we need to join; copy the higher order 64 bits from the prefix*/
                        address.u.addr16[0] = ptr_prefix_opt->Prefix.u.addr16[0];
                        address.u.addr16[1] = ptr_prefix_opt->Prefix.u.addr16[1];
                        address.u.addr16[2] = ptr_prefix_opt->Prefix.u.addr16[2];
                        address.u.addr16[3] = ptr_prefix_opt->Prefix.u.addr16[3];

                        /* The lower order 64 bits i.e. 8 bytes are the interface Identifier. */
                        mmCopy ((void *)&address.u.addr16[4], (void *)&ptr_ipv6device->EUI64[0], 8);

                        /* Check if the address binding exists or not? */
                        hBind6Obj = Bind6FindByHost (ptr_device,address);
                        if (hBind6Obj == 0)
                        {
                            /* Create a new address binding on the interface. */
                            Bind6New (ptr_device, address, SubnetMask, ValidLifetime, PreferredLifetime, 0);
                        }
                        else
                        {

    Steve

  • Hi Steve,

    Sorry, only now I am returning to the development of dynamic ipv6. 

    All I need to know is when a ipv6 was received, and get this ipv6. Is there any function like IPv6detect() and IPv6GetAddress()?

    Thanks.

  • Hi Steve,

    I set up my router and the board(EK-TM4C1294XL) obtained IPv6 correctly! 

    IPv6 Address: 3ffe:501:ffff:100:21a:b6ff:fe02:b640

    IPv6 Address: fe80::21a:b6ff:fe02:b640 on device 1 is UNIQUE
    Network Removed: If-1:192.168.1.2
    now adding DHCP...
    Service Status: DHCPC    : Enabled  : Running  : 000
    Service Status: DHCPC    : Enabled  : Running  : 000
    Service Status: HTTP     : Enabled  :          : 000
    Network Added: If-1:192.168.1.24
    Service Status: DHCPC    : Enabled  : Running  : 017
    IPv6 Address: 3ffe:501:ffff:100:21a:b6ff:fe02:b640 on device 1 is UNIQUE
    FSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x0000000b
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...

    But for some reason the system is breaking down. Could be a problem in STACK? None of my tasks is running at the time of crash(tcphandler, uartTask, udpHandler). 

  • Hi, 

    I did a test using the project tcpEchoIPv6, and it threw the same error.

    Starting the TCP Echo IPv6 example
    System provider is set to SysMin. Halt the target to view any SysMin contents in ROV.
    Service Status: DHCPC    : Enabled  :          : 000
    Service Status: DHCPC    : Enabled  : Running  : 000
    Address: fe80::21a:b6ff:fe02:b540 on device 1 is UNIQUE
    Network Added: If-1:192.168.1.28
    Service Status: DHCPC    : Enabled  : Running  : 017
    Address: 3ffe:501:ffff:100:21a:b6ff:fe02:b540 on device 1 is UNIQUE
    FSR = 0x0000
    HFSR = 0x40000000
    DFSR = 0x0000000b
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...

  • Hi Steve,

    Can you, please, check the error described above? Have you tested the project tcpEchoIPv6, and works with dinamic ipv6? (Router advertising)

    I do not know what is causing the error. Could be a wrong setting?

    Links to projects:
    https://dl.dropboxusercontent.com/u/22273442/projetos/texas/tcpEchoIPv6.rar
    https://dl.dropboxusercontent.com/u/22273442/projetos/texas/teste_ipv6.rar

    Any help please.

  • Hi Vini,

    I apologize, I did not see your replies to this thread until this morning.

    Great news on your progress on DHCPv6!

    Those errors are and exception dump.  It means that somewhere in the code, it is doing something illegal which is causing the program to crash.

    You should follow the steps described in this SYS/BIOS FAQ, which tell you how to get a hint at the culprit.

    Steve

  • Hi Steve,

    I finally found the root of the problem, but I found none definitive solution. The problem is a function from NDK, LLI6Update(), into route6.c.

    When the board receives a RA(router advertisment) in first time works well. NDK does autoconfiguration correctly, Address: 3ffe:501:ffff:100:21a:b6ff:fe02:b540 on device 1 is UNIQUE, and create a Routing Entry:

    /* Create a Routing Entry for this prefix. 
    *  This is a CLONING Route because its actually a network route which can be 
    *  instantiated to have multiple host routes. 
    *  There is no Default Gateway associated with the route since this is an 
    *  ON Link Prefix. */
        Rt6Create (FLG_RTE_CLONING, ptr_prefix_opt->Prefix, SubnetMask, 
                   IPV6_UNSPECIFIED_ADDRESS, NULL, ptr_device, ValidLifetime);

    But when the board receives a second RA, does not work. Trace function: ICMPv6RxPacket() ->  ICMPv6RecvRA() -> Rt6Update() -> LLI6Update() -> LLI6IsRouterStatMachine() ---- System breaks here. The problem is this line:

    LLI6Update (ptr_rt6->hLLI6, mac_address, RxPacketType, Flags); ----------- Because ptr_rt6->hLLI6 is NULL.

    So, here the system breaks:

    static void LLI6IsRouterStatMachine (LLI6_ENTRY* ptr_lliv6, UINT32 RxPktType, UINT8 IsMacDifferent, UINT32 Flags)
    {
        UINT8 newIsRouterFlag = 0;
       
    	/* If we received a RA; then set the IsRouter field to 1 as specified by
         * RFC 2461 Section 6.3.4 */
        if (RxPktType == ICMPV6_ROUTER_ADVERTISMENT)
            ptr_lliv6->IsRouter = 1;		// BREAKS HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    My temporary solution is:

    void Rt6Update (HANDLE hRoute, UINT32 RxPacketType, UINT8* mac_address, UINT32 Flags, UINT32 Lifetime)
    {
        RT6_ENTRY* ptr_rt6;
    
        /* Get the routing entry. */
        ptr_rt6 = (RT6_ENTRY *)hRoute;
        if (ptr_rt6 == NULL)
            return;
    
        /* If we received a Router Advertisment; we need to update the routing table entry too. */
        if (RxPacketType == ICMPV6_ROUTER_ADVERTISMENT)
            ptr_rt6->dwTimeout = llTimerGetTime(0) + Lifetime;
    
        /* If the MAC Address is specified; and there exists an LLI6 entry update it too. */
    	if (ptr_rt6->hLLI6 != NULL)		// Vini: Temp Solution!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    		LLI6Update (ptr_rt6->hLLI6, mac_address, RxPacketType, Flags);
        return;
    }

    What would be the correct solution to this problem? 

    Sorry for English :D, thanks!

    Vini

  • Hi Vini,

    Do you see any error messages being printed out?  If not in the console, they may not have been flushed to it yet.  You can see messages that are still buffered using the ROV tool (in CCS, tools -> ROV).

    Once ROV is open, browse to the "SysMin" module.  In the SysMin view, there is a tab called "output buffer" that may have some data in it.  Do you see any error messages there?  In particular, I'm hoping you see the following message:

    "Rt6Create: Error: Unable to create LLI6 for ROUTE6"

    Looking at the code, it seems like you may be hitting a memory allocation error; it seems like it should be coming from the Route6Create call that you found above.

    I think you are already rebuilding the stack code, right?  If so, then it should be easy for you to try some new code.

    Can you try adding an error check to the code above [from ICMPv6RecvRA() in icmpv6_ndisc.c] that creates a new route? (new code in red):

    HANDLE hNewRoute = Rt6Create (FLG_RTE_CLONING, ptr_prefix_opt->Prefix, SubnetMask,
                                           IPV6_UNSPECIFIED_ADDRESS, NULL, ptr_device, ValidLifetime);
    if (!hNewRoute) {
        DbgPrintf(DBG_INFO, "Error: Rt6Create returned NULL!\n");
    }
    else {
        DbgPrintf(DBG_INFO, "Rt6Create created successfully\n");
    }

    Also, please define the following constant which may provide some more useful debug trace in the Route6 module:

    ROUTE6_DEBUG

    (you can define in the route6.c file or preferably in the compiler options when building the stack library).

    Steve

  • Hi Steve,

    I did as you said, I set constant ROUTE6_DEBUG in route6.c and I added the code that you suggested. In the console appears only those messages:

    00000.000 Rt6Create: Creating Route6 Entry for NETWORK 0x@200073cc

    00000.000 fe80::

    :ffff:100::

    00014.554 Rt6Create created successfully

    In OutputBuffer there is no messages. "No data to display". My Debug Print Message Level is: Information Messages (DBG_INFO) in project.cfg.

    So, LLI Entry is not created because there is an error into NDK or router is not sending LLI information? 

    My wireshark capture: https://dl.dropboxusercontent.com/u/22273442/projetos/texas/wiresharkDLink.rar , my router is D-LinkIn_02:4d:c2

  • Vini,

    Ok.  Before we go further, can you please tell me the version of the NDK you are using?

    I think a good thing to try next is to add some tracer code into the Rt6Create function.  We need to see the path the program is going.  Can you add some more print statements to this function to help us trace the path?

    For example, I've updated the following excerpt of the Rt6Create function to give you an idea of what I mean.  Please add tracer prints like this and even more than what I show here, so we can see the path taken:

        /* Further processing is specific to the type of ROUTE being created. */
        if (flags & FLG_RTE_HOST)
        {
            RT6_ENTRY* ptr_defaultrt6;

            DbgPrintf(DBG_INFO, "Rt6Create: A\n");

            /* For HOST Routes: Check if the NextHop Address is UNSPECIFIED; then
             * initialize it to be the same as the IPAddr; this means ON LINK; else
             * we have already initialized to the passed argument. */
            if (IPv6CompareAddress(ptr_rt6->NextHop, IPV6_UNSPECIFIED_ADDRESS))
                ptr_rt6->NextHop = IPAddr;

            /* Check if there exists a GATEWAY Route which has the same Next Hop Address. */
            ptr_defaultrt6 = (RT6_ENTRY *)Rt6FindDefaultRouter(ptr_rt6->NextHop, ptr_device);
            if (ptr_defaultrt6 != NULL)
            {
                DbgPrintf(DBG_INFO, "Rt6Create: B\n");
                /* If the MAC Address was specified then we need to update both the HOST
                 * and GATEWAY Entries with the new LLI6 Entry which is being created.
                 * This is because this is the latest information we have. */


                if (mac_address != NULL)
                {
                    DbgPrintf(DBG_INFO, "Rt6Create: C\n");

                                   // note I deleted code here just for clarity
                }
                else
                {
                    DbgPrintf(DBG_INFO, "Rt6Create: D\n");
                    /* There was no MAC Address Information; in this case we simply inherit
                     * the LLI6 Information from the Gateway. */
                    ptr_rt6->hLLI6 = ptr_defaultrt6->hLLI6;
                    LLI6IncRefCount (ptr_rt6->hLLI6);
                }

    Steve

    P.S. You should also increase the size of the SysMin buffer in your *.cfg file:

    SysMin.bufSize = 4096; // or some value that's bigger than what you have. We don't want to miss any prints

  • Hi Steve,

    Sorry, I couldn't test yesterday.  I'll do tests now. 

    I have some questions.

    1) Should I remove my temporary code?  if (ptr_rt6->hLLI6 != NULL) --> Rt6Update()

    2) Can't you generate the same error?

    3) After that I changed Rt6Update(), NDK is working apparently well. Is LLI6 info vital for the proper functioning of IPv6?

    I am using an EK-TM4C1294XL, tirtos_tivac_2_01_00_03, ndk_2_23_01_01, bios_6_40_03_39, TI v5.1.6 compiler and CCSv6.

  • Hi Again Steve,

    Here is console output:

    Starting the TCP Echo IPv6 example

    System provider is set to SysMin. Halt the target to view any SysMin contents in ROV.
    Service Status: DHCPC : Enabled : : 000
    Rt6Create: Creating Route6 Entry for NETWORK 0x@2000782c
    00000.000 fe80::

    Service Status: DHCPC : Enabled : Running : 000
    Address: fe80::21a:b6ff:fe02:b540 on device 1 is UNIQUE
    Network Added: If-1:192.168.1.30
    Service Status: DHCPC : Enabled : Running : 017
    Rt6Create: Creating Route6 Entry for NETWORK 0x@20007a2c
    00008.837 3ffe:501:ffff:100::

    Address: 3ffe:501:ffff:100:21a:b6ff:fe02:b540 on device 1 is UNIQUE

    That is all! And when a host connects to board:

    Rt6Create: A
    Rt6Create: E
    Rt6Create: Creating Route6 Entry for HOST 0x@2000774c LLI6: 0x@2000906c
    00080.781 3ffe:501:ffff:100::8a2e:370:7334

    Note: I'm using my code: if (ptr_rt6->hLLI6 != NULL) --> Rt6Update()

    https://dl.dropboxusercontent.com/u/22273442/projetos/texas/route6.c

  • Hi Vini,

    So, it sounds like you have gotten things working?

    I think you should keep your work around for now.

    Are you able to IPv6 ping to the target?  What about TCP or UDP over IPv6 using your global address?

    Steve

  • Hi Steve,

    Yes, everything is working: ping and connection on TCP port! :D
    But I have not tested UDP port yet.