diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-09 14:30:26 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-10 13:22:28 -0800 |
commit | 7a71ed899e77cc822abb863e24a422dcf7e9fa33 (patch) | |
tree | 2811b8ca75c7019522f73c7d972208ae3a3ea8f9 /include/net/inetpeer.h | |
parent | b6644cb706610874104dbf3359e3b67aa59cbc27 (diff) |
inetpeer: Abstract address representation further.
Future changes will add caching information, and some of
these new elements will be addresses.
Since the family is implicit via the ->daddr.family member,
replicating the family in ever address we store is entirely
redundant.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inetpeer.h')
-rw-r--r-- | include/net/inetpeer.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index ead2cb2de18c..60e2cd8d1319 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -15,12 +15,16 @@ #include <net/ipv6.h> #include <asm/atomic.h> -struct inetpeer_addr { +struct inetpeer_addr_base { union { - __be32 a4; - __be32 a6[4]; + __be32 a4; + __be32 a6[4]; }; - __u16 family; +}; + +struct inetpeer_addr { + struct inetpeer_addr_base addr; + __u16 family; }; struct inet_peer { @@ -67,7 +71,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) { struct inetpeer_addr daddr; - daddr.a4 = v4daddr; + daddr.addr.a4 = v4daddr; daddr.family = AF_INET; return inet_getpeer(&daddr, create); } @@ -76,7 +80,7 @@ static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int cr { struct inetpeer_addr daddr; - ipv6_addr_copy((struct in6_addr *)daddr.a6, v6daddr); + ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr); daddr.family = AF_INET6; return inet_getpeer(&daddr, create); } |