lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] IPV6 Porting


From: Ivan Delamer
Subject: Re: [lwip-users] IPV6 Porting
Date: Mon, 28 Jul 2014 11:47:09 -0600

struct netif stores an array of ipv6 adresses in netif->ip6_addr[i]

You can also access those addresses via macro netif_ip6_addr(netif, i)

You may set any of those addresses manually, keeping in mind that index 0 should be a link-local address.

One way to do it is to set a local variable and then copy it to netif. Or you can set it directly on netif struct.

Remember that addresses must be stored in network byte order, for that reason it helps to use macros that take care of byte ordering. Otherwise you can use htonl().

For example, to set fe80::1, do this

{
  ip6_addr_t my_addr;

  IP6_ADDR(&my_addr, 0, 0xFE, 0x80, 0x00, 0x00);
  IP6_ADDR(&my_addr, 1, 0x00, 0x00, 0x00, 0x00);
  IP6_ADDR(&my_addr, 2, 0x00, 0x00, 0x00, 0x00);
  IP6_ADDR(&my_addr, 3, 0x00, 0x00, 0x00, 0x01);

  ip6_addr_copy(netif->ip6_addr[0], my_addr);

  netif_ip6_addr_set_state(netif, 0, IP6_ADDR_TENTATIVE);
}


The last step, setting the state, is important for ND6 protocol to validate the address (e.g. no duplicate address in network).

You could use this process to set any address, if it is not link local use an index other than 0 in netif.

Cheers
Ivan



Date: Sun, 27 Jul 2014 16:35:03 +0800
From: "=?ISO-8859-1?B?ZmZkZHlieg==?=" <address@hidden>
To: "=?ISO-8859-1?B?TWFpbGluZyBsaXN0IGZvciBsd0lQIHVzZXJz?="
        <address@hidden>, "=?ISO-8859-1?B?bHdpcC11c2Vycw==?="
        <address@hidden>
Subject: Re: [lwip-users] IPV6 Porting
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

Thank you for your reply. I succeed in testing IPV6 via ND6 protocol.
But I also want to test it using static IPV6 address, the process of
doing this, I created linklocal address, then I use IP6_ADDR macro to
add address to struct ip6addr, I use function netif_get_ip6_addr_match
to bind struct netif and struct ip6_addr, Then you tell me using macro
netif_ip6_addr_set_state. But I can't create IPV6 address, and struct
netif did not contain any information about IPV6 address. Am I doing
right?




------------------ Original ------------------
From: "Ivan Delamer";
Date: Tuesday, Jul 22, 2014 2:20 AM
To: "lwip-users";
Subject: Re: [lwip-users] IPV6 Porting



This used to be in one of the LwIP Wikia pages but now it is gone ...
??

The netif has some placeholders for IPv6 addresses:
my_netif->ip6_addr[xx]. The number of addresses is configurable in
lwipopts.h, usually 3 is a good number.

Usually address [0] is reserved for the link-local address. If your
netif has a hw_addr configured you can use
netif_create_ip6_linklocal_address() to create the address. You can
manually create the rest of the adresses, or if you have adress
auto-configuration enabled you can let the ND6 protocol generate the
rest of the adresses with help from your IPv6 router. you should set
netif->ip6_autoconfig_enabled = 1; and make sure it is enabled in
lwipopts.h

Any address you manually configure, you should use the macro
netif_ip6_addr_set_state(netif, addr_index, IP6_ADDR_TENTATIVE) to let
ND6 protocol validate it.

That is all you need to get set up.

If you have any other questions just ask.

Cheers
Ivan



Date: Sun, 20 Jul 2014 15:22:12 +0800
From: "=?ISO-8859-1?B?ZmZkZHlieg==?=" <address@hidden>
To: "=?ISO-8859-1?B?bHdpcC11c2Vycw==?=" <address@hidden>
Subject: [lwip-users] IPV6 Porting
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

Hi,everyone. I try to port lwip-master to RT-Thread Operating
System(An embedded Real-Time open source system form china).I succeed
in running IPV4 application, but the main purpose for me is porting
IPV6 to it.
The wiki said that when you using ipv6 you can add macro LWIP_IPV6 in
lwipopts.h
But I don't know how to call some functions to set static IPV6
address. Is there any documents talking about it?


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

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