diff options
author | Fan Du <fan.du@windriver.com> | 2013-08-06 03:50:56 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2013-08-07 04:12:58 -0400 |
commit | af83fde7513b6c4acd869ad4fb93893704439470 (patch) | |
tree | 0136f252646f3dbf95fdc0001c87bd271c1bba37 /net/key | |
parent | 0659eea912cf2ce65298784b918904ba0f91f5e1 (diff) |
xfrm: Remove rebundant address family checking
present_and_same_family has checked addresses family validness for both
SADB_EXT_ADDRESS_SRC and SADB_EXT_ADDRESS_DST in the beginning.
Thereafter pfkey_sadb_addr2xfrm_addr doesn't need to do the checking again.
Signed-off-by: Fan Du <fan.du@windriver.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/key')
-rw-r--r-- | net/key/af_key.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c index d49f67681823..9d585370c5b4 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -1196,10 +1196,6 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, | |||
1196 | 1196 | ||
1197 | x->props.family = pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_SRC-1], | 1197 | x->props.family = pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_SRC-1], |
1198 | &x->props.saddr); | 1198 | &x->props.saddr); |
1199 | if (!x->props.family) { | ||
1200 | err = -EAFNOSUPPORT; | ||
1201 | goto out; | ||
1202 | } | ||
1203 | pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST-1], | 1199 | pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST-1], |
1204 | &x->id.daddr); | 1200 | &x->id.daddr); |
1205 | 1201 | ||
@@ -2205,10 +2201,6 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_ | |||
2205 | 2201 | ||
2206 | sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1]; | 2202 | sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1]; |
2207 | xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr); | 2203 | xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr); |
2208 | if (!xp->family) { | ||
2209 | err = -EINVAL; | ||
2210 | goto out; | ||
2211 | } | ||
2212 | xp->selector.family = xp->family; | 2204 | xp->selector.family = xp->family; |
2213 | xp->selector.prefixlen_s = sa->sadb_address_prefixlen; | 2205 | xp->selector.prefixlen_s = sa->sadb_address_prefixlen; |
2214 | xp->selector.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); | 2206 | xp->selector.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); |