Commit 8f18da47 authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next

Steffen Klassert says:

====================
pull request (net-next): ipsec-next 2018-10-18

1) Remove an unnecessary dev->tstats check in xfrmi_get_stats64.
   From Li RongQing.

2) We currently do a sizeof(element) instead of a sizeof(array)
   check when initializing the ovec array of the secpath.
   Currently this array can have only one element, so code is
   OK but error-prone. Change this to do a sizeof(array)
   check so that we can add more elements in future.
   From Li RongQing.

3) Improve xfrm IPv6 address hashing by using the complete IPv6
   addresses for a hash. From Michal Kubecek.

Please pull or let me know if there are problems.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 82385b0d 8d4b6bce
...@@ -13,7 +13,7 @@ static inline unsigned int __xfrm4_addr_hash(const xfrm_address_t *addr) ...@@ -13,7 +13,7 @@ static inline unsigned int __xfrm4_addr_hash(const xfrm_address_t *addr)
static inline unsigned int __xfrm6_addr_hash(const xfrm_address_t *addr) static inline unsigned int __xfrm6_addr_hash(const xfrm_address_t *addr)
{ {
return ntohl(addr->a6[2] ^ addr->a6[3]); return jhash2((__force u32 *)addr->a6, 4, 0);
} }
static inline unsigned int __xfrm4_daddr_saddr_hash(const xfrm_address_t *daddr, static inline unsigned int __xfrm4_daddr_saddr_hash(const xfrm_address_t *daddr,
...@@ -26,8 +26,7 @@ static inline unsigned int __xfrm4_daddr_saddr_hash(const xfrm_address_t *daddr, ...@@ -26,8 +26,7 @@ static inline unsigned int __xfrm4_daddr_saddr_hash(const xfrm_address_t *daddr,
static inline unsigned int __xfrm6_daddr_saddr_hash(const xfrm_address_t *daddr, static inline unsigned int __xfrm6_daddr_saddr_hash(const xfrm_address_t *daddr,
const xfrm_address_t *saddr) const xfrm_address_t *saddr)
{ {
return ntohl(daddr->a6[2] ^ daddr->a6[3] ^ return __xfrm6_addr_hash(daddr) ^ __xfrm6_addr_hash(saddr);
saddr->a6[2] ^ saddr->a6[3]);
} }
static inline u32 __bits2mask32(__u8 bits) static inline u32 __bits2mask32(__u8 bits)
......
...@@ -131,7 +131,7 @@ struct sec_path *secpath_dup(struct sec_path *src) ...@@ -131,7 +131,7 @@ struct sec_path *secpath_dup(struct sec_path *src)
sp->len = 0; sp->len = 0;
sp->olen = 0; sp->olen = 0;
memset(sp->ovec, 0, sizeof(sp->ovec[XFRM_MAX_OFFLOAD_DEPTH])); memset(sp->ovec, 0, sizeof(sp->ovec));
if (src) { if (src) {
int i; int i;
......
...@@ -561,9 +561,6 @@ static void xfrmi_get_stats64(struct net_device *dev, ...@@ -561,9 +561,6 @@ static void xfrmi_get_stats64(struct net_device *dev,
{ {
int cpu; int cpu;
if (!dev->tstats)
return;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
struct pcpu_sw_netstats *stats; struct pcpu_sw_netstats *stats;
struct pcpu_sw_netstats tmp; struct pcpu_sw_netstats tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment