Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Fix twice the same mistake: 'last' can't be nul...



details:   https://anonhg.NetBSD.org/src/rev/bac851b16816
branches:  trunk
changeset: 829239:bac851b16816
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jan 23 09:21:59 2018 +0000

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

diffstat:

 sys/netinet6/icmp6.c   |  22 ++++++++--------------
 sys/netinet6/raw_ip6.c |  22 ++++++++--------------
 2 files changed, 16 insertions(+), 28 deletions(-)

diffs (106 lines):

diff -r 9c8a313726d3 -r bac851b16816 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Tue Jan 23 07:33:49 2018 +0000
+++ b/sys/netinet6/icmp6.c      Tue Jan 23 09:21:59 2018 +0000
@@ -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 @@
                         */
                        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 @@
                }
                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);
diff -r 9c8a313726d3 -r bac851b16816 sys/netinet6/raw_ip6.c
--- a/sys/netinet6/raw_ip6.c    Tue Jan 23 07:33:49 2018 +0000
+++ b/sys/netinet6/raw_ip6.c    Tue Jan 23 09:21:59 2018 +0000
@@ -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 @@
                         */
                        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 @@
                }
                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);



Home | Main Index | Thread Index | Old Index