Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netipsec Reduce the diff between ipsec6_input and ipsec4...



details:   https://anonhg.NetBSD.org/src/rev/7d907a4ca4be
branches:  trunk
changeset: 830137:7d907a4ca4be
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Feb 26 10:19:13 2018 +0000

description:
Reduce the diff between ipsec6_input and ipsec4_input.

diffstat:

 sys/netipsec/ipsec.c |  24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diffs (46 lines):

diff -r a67eb2420c5c -r 7d907a4ca4be sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c      Mon Feb 26 09:13:00 2018 +0000
+++ b/sys/netipsec/ipsec.c      Mon Feb 26 10:19:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.139 2018/02/26 09:04:29 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.140 2018/02/26 10:19:13 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.139 2018/02/26 09:04:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.140 2018/02/26 10:19:13 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -2140,18 +2140,16 @@
 
        s = splsoftnet();
        sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, IP_FORWARDING, &error);
-       if (sp != NULL) {
-               /*
-                * Check security policy against packet
-                * attributes.
-                */
-               error = ipsec_sp_reject(sp, m);
-               KEY_SP_UNREF(&sp);
-       } else {
-               /* XXX error stat??? */
-               error = EINVAL;
-               IPSECLOG(LOG_DEBUG, "no SP, packet discarded\n");/*XXX*/
+       if (sp == NULL) {
+               splx(s);
+               return EINVAL;
        }
+
+       /*
+        * Check security policy against packet attributes.
+        */
+       error = ipsec_sp_reject(sp, m);
+       KEY_SP_UNREF(&sp);
        splx(s);
 
        return error;



Home | Main Index | Thread Index | Old Index