netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] xfrm: Remove rebundant address family checking
@ 2013-08-06  7:50 Fan Du
  2013-08-07 10:57 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: Fan Du @ 2013-08-06  7:50 UTC (permalink / raw)
  To: steffen.klassert; +Cc: davem, netdev

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>
---
 net/key/af_key.c |    8 --------
 1 file changed, 8 deletions(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index ab8bd2c..dd40377 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,
 
 	x->props.family = pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_SRC-1],
 						    &x->props.saddr);
-	if (!x->props.family) {
-		err = -EAFNOSUPPORT;
-		goto out;
-	}
 	pfkey_sadb_addr2xfrm_addr((struct sadb_address *) ext_hdrs[SADB_EXT_ADDRESS_DST-1],
 				  &x->id.daddr);
 
@@ -2205,10 +2201,6 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_
 
 	sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1];
 	xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr);
-	if (!xp->family) {
-		err = -EINVAL;
-		goto out;
-	}
 	xp->selector.family = xp->family;
 	xp->selector.prefixlen_s = sa->sadb_address_prefixlen;
 	xp->selector.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] xfrm: Remove rebundant address family checking
  2013-08-06  7:50 [PATCH net-next] xfrm: Remove rebundant address family checking Fan Du
@ 2013-08-07 10:57 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2013-08-07 10:57 UTC (permalink / raw)
  To: Fan Du; +Cc: davem, netdev

On Tue, Aug 06, 2013 at 03:50:56PM +0800, Fan Du wrote:
> 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>

Applied to ipsec-next,

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-07 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-06  7:50 [PATCH net-next] xfrm: Remove rebundant address family checking Fan Du
2013-08-07 10:57 ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).