|
@@ -15,11 +15,17 @@
|
|
#include <net/ipv6.h>
|
|
#include <net/ipv6.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/atomic.h>
|
|
|
|
|
|
|
|
+/* IPv4 address key for cache lookups */
|
|
|
|
+struct ipv4_addr_key {
|
|
|
|
+ __be32 addr;
|
|
|
|
+ int vif;
|
|
|
|
+};
|
|
|
|
+
|
|
#define INETPEER_MAXKEYSZ (sizeof(struct in6_addr) / sizeof(u32))
|
|
#define INETPEER_MAXKEYSZ (sizeof(struct in6_addr) / sizeof(u32))
|
|
|
|
|
|
struct inetpeer_addr {
|
|
struct inetpeer_addr {
|
|
union {
|
|
union {
|
|
- __be32 a4;
|
|
|
|
|
|
+ struct ipv4_addr_key a4;
|
|
struct in6_addr a6;
|
|
struct in6_addr a6;
|
|
u32 key[INETPEER_MAXKEYSZ];
|
|
u32 key[INETPEER_MAXKEYSZ];
|
|
};
|
|
};
|
|
@@ -71,13 +77,13 @@ void inet_initpeers(void) __init;
|
|
|
|
|
|
static inline void inetpeer_set_addr_v4(struct inetpeer_addr *iaddr, __be32 ip)
|
|
static inline void inetpeer_set_addr_v4(struct inetpeer_addr *iaddr, __be32 ip)
|
|
{
|
|
{
|
|
- iaddr->a4 = ip;
|
|
|
|
|
|
+ iaddr->a4.addr = ip;
|
|
iaddr->family = AF_INET;
|
|
iaddr->family = AF_INET;
|
|
}
|
|
}
|
|
|
|
|
|
static inline __be32 inetpeer_get_addr_v4(struct inetpeer_addr *iaddr)
|
|
static inline __be32 inetpeer_get_addr_v4(struct inetpeer_addr *iaddr)
|
|
{
|
|
{
|
|
- return iaddr->a4;
|
|
|
|
|
|
+ return iaddr->a4.addr;
|
|
}
|
|
}
|
|
|
|
|
|
static inline void inetpeer_set_addr_v6(struct inetpeer_addr *iaddr,
|
|
static inline void inetpeer_set_addr_v6(struct inetpeer_addr *iaddr,
|
|
@@ -99,11 +105,12 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
|
|
|
|
|
|
static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base,
|
|
static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base,
|
|
__be32 v4daddr,
|
|
__be32 v4daddr,
|
|
- int create)
|
|
|
|
|
|
+ int vif, int create)
|
|
{
|
|
{
|
|
struct inetpeer_addr daddr;
|
|
struct inetpeer_addr daddr;
|
|
|
|
|
|
- daddr.a4 = v4daddr;
|
|
|
|
|
|
+ daddr.a4.addr = v4daddr;
|
|
|
|
+ daddr.a4.vif = vif;
|
|
daddr.family = AF_INET;
|
|
daddr.family = AF_INET;
|
|
return inet_getpeer(base, &daddr, create);
|
|
return inet_getpeer(base, &daddr, create);
|
|
}
|
|
}
|