aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/xfrm.h13
-rw-r--r--net/ipv6/xfrm6_tunnel.c4
2 files changed, 12 insertions, 5 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 421f764794d5..0d8a797f0441 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1032,7 +1032,7 @@ static inline int
1032__xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x) 1032__xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x)
1033{ 1033{
1034 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && 1034 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) &&
1035 ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); 1035 !ipv6_addr_equal((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr));
1036} 1036}
1037 1037
1038static inline int 1038static inline int
@@ -1243,8 +1243,8 @@ static __inline__ int
1243__xfrm6_state_addr_check(const struct xfrm_state *x, 1243__xfrm6_state_addr_check(const struct xfrm_state *x,
1244 const xfrm_address_t *daddr, const xfrm_address_t *saddr) 1244 const xfrm_address_t *daddr, const xfrm_address_t *saddr)
1245{ 1245{
1246 if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && 1246 if (ipv6_addr_equal((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) &&
1247 (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| 1247 (ipv6_addr_equal((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr) ||
1248 ipv6_addr_any((struct in6_addr *)saddr) || 1248 ipv6_addr_any((struct in6_addr *)saddr) ||
1249 ipv6_addr_any((struct in6_addr *)&x->props.saddr))) 1249 ipv6_addr_any((struct in6_addr *)&x->props.saddr)))
1250 return 1; 1250 return 1;
@@ -1588,6 +1588,13 @@ static inline int xfrm_addr_cmp(const xfrm_address_t *a,
1588 } 1588 }
1589} 1589}
1590 1590
1591static inline bool xfrm6_addr_equal(const xfrm_address_t *a,
1592 const xfrm_address_t *b)
1593{
1594 return ipv6_addr_equal((const struct in6_addr *)a,
1595 (const struct in6_addr *)b);
1596}
1597
1591static inline int xfrm_policy_id2dir(u32 index) 1598static inline int xfrm_policy_id2dir(u32 index)
1592{ 1599{
1593 return index & 7; 1600 return index & 7;
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index babd1674388a..6cc48012b730 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -94,7 +94,7 @@ static struct xfrm6_tunnel_spi *__xfrm6_tunnel_spi_lookup(struct net *net, const
94 hlist_for_each_entry_rcu(x6spi, pos, 94 hlist_for_each_entry_rcu(x6spi, pos,
95 &xfrm6_tn->spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)], 95 &xfrm6_tn->spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)],
96 list_byaddr) { 96 list_byaddr) {
97 if (memcmp(&x6spi->addr, saddr, sizeof(x6spi->addr)) == 0) 97 if (xfrm6_addr_equal(&x6spi->addr, saddr))
98 return x6spi; 98 return x6spi;
99 } 99 }
100 100
@@ -211,7 +211,7 @@ static void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr)
211 &xfrm6_tn->spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)], 211 &xfrm6_tn->spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)],
212 list_byaddr) 212 list_byaddr)
213 { 213 {
214 if (memcmp(&x6spi->addr, saddr, sizeof(x6spi->addr)) == 0) { 214 if (xfrm6_addr_equal(&x6spi->addr, saddr)) {
215 if (atomic_dec_and_test(&x6spi->refcnt)) { 215 if (atomic_dec_and_test(&x6spi->refcnt)) {
216 hlist_del_rcu(&x6spi->list_byaddr); 216 hlist_del_rcu(&x6spi->list_byaddr);
217 hlist_del_rcu(&x6spi->list_byspi); 217 hlist_del_rcu(&x6spi->list_byspi);