Skip to content

Commit

Permalink
net/ip: Make struct net_addr holding uninon of ipv6/4 unconditionally
Browse files Browse the repository at this point in the history
It will help to use IS_ENABLED in place of #ifdef in relevant place.

Only struct net_if uses this structure.
In case only IPv4 is used, it will bloat up this struct by 12 bytes.

There are few reasons why this is "ok" in this case:

- On limited rom/ram system it will be unlikely to find a lot of
network interfaces so it should not harm much to raise the size of
struct net_addr.
- If IPv4 is the only enabled IP version, it gains a good amount of
rom/ram to discard IPv6 support so it is fine to steal a bit of this
gain to bloat up a bit struct net_addr.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
  • Loading branch information
Tomasz Bursztyka authored and jukkar committed May 7, 2019
1 parent b17664b commit 622f4ab
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions include/net/net_ip.h
Expand Up @@ -278,12 +278,8 @@ struct sockaddr_storage {
struct net_addr {
sa_family_t family;
union {
#if defined(CONFIG_NET_IPV6)
struct in6_addr in6_addr;
#endif
#if defined(CONFIG_NET_IPV4)
struct in_addr in_addr;
#endif
};
};

Expand Down

0 comments on commit 622f4ab

Please sign in to comment.