lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [task #12722] Improve IPv4/v6 address handling


From: Ivan Delamer
Subject: [lwip-devel] [task #12722] Improve IPv4/v6 address handling
Date: Tue, 02 Jul 2013 15:59:06 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0

Follow-up Comment #2, task #12722 (project lwip):

This is a good discussion and I think there is no straightforward answer.

>From an application point of view, I find 2 cases:
1) Applications that use both ip4 and ip6 addresses: this works well now, as
each address is assigned to a separate variable of the corresponding type.

2) Applications that use either one ip4 or one ip6 address: I find myself
reusing the pattern of having one variable for each type, and if I use ip6 I
set ip4 to 0.0.0.0, or if I use ip4 I set ip6 to ::

So in case (2) it would be useful to have the unified struct with extra byte
for version, although memory use in a 32-bit system is the same (16 + 1
rounded up to 20 for a single struct, or 16 + 4 for 2 structs)

For LwIP internals, I think having 2 separate structs works well. Keeing track
of IP version in the PCB has been sufficient I think. And I think that byte
can be used in more ways to implement different scenarios (e.g. listen in
either IPv4 or IPv6)

The other option we can look at, especially for applications, is using socket
addresses (which keep track of version) and have some macros for converting to
ip4_addr_t or ip6_addr_t. This way we don't need to invent a new struct and we
can keep the best of both worlds.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?12722>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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