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>
This commit is contained in:

committed by
David S. Miller

parent
72afa352d6
commit
3abef286cf
@@ -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,
|
||||
|
Reference in New Issue
Block a user