Skip to content
Permalink
Browse files

net/ip: Make struct net_addr holding uninon of ipv6/4 unconditionally

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...
tbursztyka authored and jukkar committed May 2, 2019
1 parent b17664b commit 622f4abdf295d754bfe16399c7b2830f04b026dd
Showing with 0 additions and 4 deletions.
  1. +0 −4 include/net/net_ip.h
@@ -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
};
};

0 comments on commit 622f4ab

Please sign in to comment.
You can’t perform that action at this time.