diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2015-08-28 01:07:00 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-28 22:32:36 +0200 |
commit | 3abef286cf2f138de353fb0b54453621de961043 (patch) | |
tree | d5039d81fdd2138172026509bc501609020b090e /include/net/inetpeer.h | |
parent | net: Introduce ipv4_addr_hash and use it for tcp metrics (diff) | |
download | linux-3abef286cf2f138de353fb0b54453621de961043.tar.xz linux-3abef286cf2f138de353fb0b54453621de961043.zip |
net: Add set,get helpers for inetpeer addresses
Use inetpeer set,get helpers in tcp_metrics rather than peeking into
the inetpeer_addr struct.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inetpeer.h')
-rw-r--r-- | include/net/inetpeer.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 002f0bd27001..f75b9e7036a2 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -71,6 +71,29 @@ void inet_initpeers(void) __init; #define INETPEER_METRICS_NEW (~(u32) 0) +static inline void inetpeer_set_addr_v4(struct inetpeer_addr *iaddr, __be32 ip) +{ + iaddr->addr.a4 = ip; + iaddr->family = AF_INET; +} + +static inline __be32 inetpeer_get_addr_v4(struct inetpeer_addr *iaddr) +{ + return iaddr->addr.a4; +} + +static inline void inetpeer_set_addr_v6(struct inetpeer_addr *iaddr, + struct in6_addr *in6) +{ + iaddr->addr.in6 = *in6; + iaddr->family = AF_INET6; +} + +static inline struct in6_addr *inetpeer_get_addr_v6(struct inetpeer_addr *iaddr) +{ + return &iaddr->addr.in6; +} + /* can be called with or without local BH being disabled */ struct inet_peer *inet_getpeer(struct inet_peer_base *base, const struct inetpeer_addr *daddr, |