aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inetpeer.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-02-09 17:30:26 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-10 16:22:28 -0500
commit7a71ed899e77cc822abb863e24a422dcf7e9fa33 (patch)
tree2811b8ca75c7019522f73c7d972208ae3a3ea8f9 /include/net/inetpeer.h
parentb6644cb706610874104dbf3359e3b67aa59cbc27 (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.h16
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 @@
15#include <net/ipv6.h> 15#include <net/ipv6.h>
16#include <asm/atomic.h> 16#include <asm/atomic.h>
17 17
18struct inetpeer_addr { 18struct inetpeer_addr_base {
19 union { 19 union {
20 __be32 a4; 20 __be32 a4;
21 __be32 a6[4]; 21 __be32 a6[4];
22 }; 22 };
23 __u16 family; 23};
24
25struct inetpeer_addr {
26 struct inetpeer_addr_base addr;
27 __u16 family;
24}; 28};
25 29
26struct inet_peer { 30struct inet_peer {
@@ -67,7 +71,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
67{ 71{
68 struct inetpeer_addr daddr; 72 struct inetpeer_addr daddr;
69 73
70 daddr.a4 = v4daddr; 74 daddr.addr.a4 = v4daddr;
71 daddr.family = AF_INET; 75 daddr.family = AF_INET;
72 return inet_getpeer(&daddr, create); 76 return inet_getpeer(&daddr, create);
73} 77}
@@ -76,7 +80,7 @@ static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int cr
76{ 80{
77 struct inetpeer_addr daddr; 81 struct inetpeer_addr daddr;
78 82
79 ipv6_addr_copy((struct in6_addr *)daddr.a6, v6daddr); 83 ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr);
80 daddr.family = AF_INET6; 84 daddr.family = AF_INET6;
81 return inet_getpeer(&daddr, create); 85 return inet_getpeer(&daddr, create);
82} 86}