diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-11-14 00:36:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:53:41 -0500 |
commit | f04e7e8d7f175c05bbde3ae748bf2541da53721d (patch) | |
tree | 0e9a61e66fa507fc389d3e85917eaeb614cc9525 /net/ipv6/xfrm6_policy.c | |
parent | fff693888012806370c98c601fbaa141fb12dfca (diff) |
[IPSEC]: Replace x->type->{local,remote}_addr with flags
The functions local_addr and remote_addr are more than what they're
needed for. The same thing can be done easily with flags on the type
object. This patch does that and simplifies the wrapper functions in
xfrm6_policy accordingly.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/xfrm6_policy.c')
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 77dc3651437e..3b38e493d151 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -87,20 +87,16 @@ __xfrm6_find_bundle(struct flowi *fl, struct xfrm_policy *policy) | |||
87 | return dst; | 87 | return dst; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline struct in6_addr* | 90 | static inline xfrm_address_t *__xfrm6_bundle_addr_remote(struct xfrm_state *x) |
91 | __xfrm6_bundle_addr_remote(struct xfrm_state *x, struct in6_addr *addr) | ||
92 | { | 91 | { |
93 | return (x->type->remote_addr) ? | 92 | return (x->type->flags & XFRM_TYPE_REMOTE_COADDR) ? x->coaddr : |
94 | (struct in6_addr*)x->type->remote_addr(x, (xfrm_address_t *)addr) : | 93 | &x->id.daddr; |
95 | (struct in6_addr*)&x->id.daddr; | ||
96 | } | 94 | } |
97 | 95 | ||
98 | static inline struct in6_addr* | 96 | static inline xfrm_address_t *__xfrm6_bundle_addr_local(struct xfrm_state *x) |
99 | __xfrm6_bundle_addr_local(struct xfrm_state *x, struct in6_addr *addr) | ||
100 | { | 97 | { |
101 | return (x->type->local_addr) ? | 98 | return (x->type->flags & XFRM_TYPE_LOCAL_COADDR) ? x->coaddr : |
102 | (struct in6_addr*)x->type->local_addr(x, (xfrm_address_t *)addr) : | 99 | &x->props.saddr; |
103 | (struct in6_addr*)&x->props.saddr; | ||
104 | } | 100 | } |
105 | 101 | ||
106 | /* Allocate chain of dst_entry's, attach known xfrm's, calculate | 102 | /* Allocate chain of dst_entry's, attach known xfrm's, calculate |
@@ -171,9 +167,9 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
171 | fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4; | 167 | fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4; |
172 | break; | 168 | break; |
173 | case AF_INET6: | 169 | case AF_INET6: |
174 | ipv6_addr_copy(&fl_tunnel.fl6_dst, __xfrm6_bundle_addr_remote(xfrm[i], &fl->fl6_dst)); | 170 | ipv6_addr_copy(&fl_tunnel.fl6_dst, (struct in6_addr *)__xfrm6_bundle_addr_remote(xfrm[i])); |
175 | 171 | ||
176 | ipv6_addr_copy(&fl_tunnel.fl6_src, __xfrm6_bundle_addr_local(xfrm[i], &fl->fl6_src)); | 172 | ipv6_addr_copy(&fl_tunnel.fl6_src, (struct in6_addr *)__xfrm6_bundle_addr_local(xfrm[i])); |
177 | break; | 173 | break; |
178 | default: | 174 | default: |
179 | BUG_ON(1); | 175 | BUG_ON(1); |