Module Name:    src
Committed By:   maxv
Date:           Tue Jan 23 09:21:59 UTC 2018

Modified Files:
        src/sys/netinet6: icmp6.c raw_ip6.c

Log Message:
Fix twice the same mistake: 'last' can't be null, so there's no point in
having this misleading branch.


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.158 -r1.159 src/sys/netinet6/raw_ip6.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.215 src/sys/netinet6/icmp6.c:1.216
--- src/sys/netinet6/icmp6.c:1.215	Tue Jan 23 07:02:57 2018
+++ src/sys/netinet6/icmp6.c	Tue Jan 23 09:21:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.215 2018/01/23 07:02:57 maxv Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.216 2018/01/23 09:21:59 maxv Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.215 2018/01/23 07:02:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.216 2018/01/23 09:21:59 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2008,7 +2008,7 @@ icmp6_rip6_input(struct mbuf **mp, int o
 			 */
 			if (!ipsec_used ||
 			    (ipsec_used && !ipsec6_in_reject(m, last)))
-#endif /* IPSEC */
+#endif
 			if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
 				if (last->in6p_flags & IN6P_CONTROLOPTS)
 					ip6_savecontrol(last, &opts, ip6, n);
@@ -2027,20 +2027,14 @@ icmp6_rip6_input(struct mbuf **mp, int o
 		}
 		last = in6p;
 	}
+
 #ifdef IPSEC
 	if (ipsec_used && last && ipsec6_in_reject(m, last)) {
 		m_freem(m);
-		/*
-		 * XXX ipsec6_in_reject update stat if there is an error
-		 * so we just need to update stats by hand in the case of last is
-		 * NULL
-		 */
-		if (!last)
-			IPSEC6_STATINC(IPSEC_STAT_IN_POLVIO);
-			IP6_STATDEC(IP6_STAT_DELIVERED);
-			/* do not inject data into pcb */
-		} else
-#endif /* IPSEC */
+		IP6_STATDEC(IP6_STAT_DELIVERED);
+		/* do not inject data into pcb */
+	} else
+#endif
 	if (last) {
 		if (last->in6p_flags & IN6P_CONTROLOPTS)
 			ip6_savecontrol(last, &opts, ip6, m);

Index: src/sys/netinet6/raw_ip6.c
diff -u src/sys/netinet6/raw_ip6.c:1.158 src/sys/netinet6/raw_ip6.c:1.159
--- src/sys/netinet6/raw_ip6.c:1.158	Sun Nov  5 07:03:37 2017
+++ src/sys/netinet6/raw_ip6.c	Tue Jan 23 09:21:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip6.c,v 1.158 2017/11/05 07:03:37 ozaki-r Exp $	*/
+/*	$NetBSD: raw_ip6.c,v 1.159 2018/01/23 09:21:59 maxv Exp $	*/
 /*	$KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.158 2017/11/05 07:03:37 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.159 2018/01/23 09:21:59 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -207,7 +207,7 @@ rip6_input(struct mbuf **mp, int *offp, 
 			 */
 			if (!ipsec_used ||
 			    (ipsec_used && !ipsec6_in_reject(m, last)))
-#endif /* IPSEC */
+#endif
 			if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
 				if (last->in6p_flags & IN6P_CONTROLOPTS)
 					ip6_savecontrol(last, &opts, ip6, n);
@@ -227,20 +227,14 @@ rip6_input(struct mbuf **mp, int *offp, 
 		}
 		last = in6p;
 	}
+
 #ifdef IPSEC
 	if (ipsec_used && last && ipsec6_in_reject(m, last)) {
 		m_freem(m);
-		/*
-		 * XXX ipsec6_in_reject update stat if there is an error
-		 * so we just need to update stats by hand in the case of last is
-		 * NULL
-		 */
-		if (!last)
-			IPSEC6_STATINC(IPSEC_STAT_IN_POLVIO);
-			IP6_STATDEC(IP6_STAT_DELIVERED);
-			/* do not inject data into pcb */
-		} else
-#endif /* IPSEC */
+		IP6_STATDEC(IP6_STAT_DELIVERED);
+		/* do not inject data into pcb */
+	} else
+#endif
 	if (last) {
 		if (last->in6p_flags & IN6P_CONTROLOPTS)
 			ip6_savecontrol(last, &opts, ip6, m);

Reply via email to