diff options
author | YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> | 2013-01-29 16:48:31 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-30 07:58:40 +0400 |
commit | ff88b30c717f21dffba6784cae4d3287da16f6ef (patch) | |
tree | e7247eef942addb4210e3969b5655a6d43d753f6 /include | |
parent | 07c2fecc363c8f94a0bd2fdf9b7209ec6f5a0ab5 (diff) | |
download | linux-ff88b30c717f21dffba6784cae4d3287da16f6ef.tar.xz |
xfrm: Use ipv6_addr_equal() where appropriate.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/xfrm.h | 13 |
1 files changed, 10 insertions, 3 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 __xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x) { return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && - ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); + !ipv6_addr_equal((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); } static inline int @@ -1243,8 +1243,8 @@ static __inline__ int __xfrm6_state_addr_check(const struct xfrm_state *x, const xfrm_address_t *daddr, const xfrm_address_t *saddr) { - if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && - (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| + if (ipv6_addr_equal((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && + (ipv6_addr_equal((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr) || ipv6_addr_any((struct in6_addr *)saddr) || ipv6_addr_any((struct in6_addr *)&x->props.saddr))) return 1; @@ -1588,6 +1588,13 @@ static inline int xfrm_addr_cmp(const xfrm_address_t *a, } } +static inline bool xfrm6_addr_equal(const xfrm_address_t *a, + const xfrm_address_t *b) +{ + return ipv6_addr_equal((const struct in6_addr *)a, + (const struct in6_addr *)b); +} + static inline int xfrm_policy_id2dir(u32 index) { return index & 7; |