Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 move sanity check upwards. sync w/kame



details:   https://anonhg.NetBSD.org/src/rev/e4e8c7508937
branches:  trunk
changeset: 533138:e4e8c7508937
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Jun 22 12:27:09 2002 +0000

description:
move sanity check upwards.  sync w/kame
From: YAMAMOTO Takashi <yamt%mwd.biglobe.ne.jp@localhost>

diffstat:

 sys/netinet6/ipsec.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (64 lines):

diff -r e563b7e7864b -r e4e8c7508937 sys/netinet6/ipsec.c
--- a/sys/netinet6/ipsec.c      Sat Jun 22 12:04:07 2002 +0000
+++ b/sys/netinet6/ipsec.c      Sat Jun 22 12:27:09 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec.c,v 1.60 2002/06/22 12:04:07 itojun Exp $        */
+/*     $NetBSD: ipsec.c,v 1.61 2002/06/22 12:27:09 itojun Exp $        */
 /*     $KAME: ipsec.c,v 1.136 2002/05/19 00:36:39 itojun Exp $ */
 
 /*
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.60 2002/06/22 12:04:07 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.61 2002/06/22 12:27:09 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -355,6 +355,11 @@
                panic("ipsec4_getpolicybysock: unsupported address family\n");
        }
 
+#ifdef DIAGNOSTIC
+       if (pcbsp == NULL)
+               panic("ipsec4_getpolicybysock: pcbsp is NULL.\n");
+#endif
+
        /* if we have a cached entry, and if it is still valid, use it. */
        ipsecstat.spdcachelookup++;
        currsp = ipsec_checkpcbcache(m, pcbsp, dir);
@@ -364,10 +369,6 @@
        }
        ipsecstat.spdcachemiss++;
 
-       /* sanity check */
-       if (pcbsp == NULL)
-               panic("ipsec4_getpolicybysock: pcbsp is NULL.\n");
-
        switch (dir) {
        case IPSEC_DIR_INBOUND:
                currsp = pcbsp->sp_in;
@@ -557,6 +558,11 @@
 
        pcbsp = sotoin6pcb(so)->in6p_sp;
 
+#ifdef DIAGNOSTIC
+       if (pcbsp == NULL)
+               panic("ipsec6_getpolicybysock: pcbsp is NULL.\n");
+#endif
+
        /* if we have a cached entry, and if it is still valid, use it. */
        ipsec6stat.spdcachelookup++;
        currsp = ipsec_checkpcbcache(m, pcbsp, dir);
@@ -566,10 +572,6 @@
        }
        ipsec6stat.spdcachemiss++;
 
-       /* sanity check */
-       if (pcbsp == NULL)
-               panic("ipsec6_getpolicybysock: pcbsp is NULL.\n");
-
        switch (dir) {
        case IPSEC_DIR_INBOUND:
                currsp = pcbsp->sp_in;



Home | Main Index | Thread Index | Old Index