Module Name: src Committed By: snj Date: Mon Feb 26 00:26:46 UTC 2018
Modified Files: src/sys/netinet6 [netbsd-8]: ip6_input.c Log Message: Pull up following revision(s) (requested by maxv in ticket #568): sys/netinet6/ip6_input.c: 1.188 Kick nested fragments. To generate a diff of this commit: cvs rdiff -u -r1.178.2.4 -r1.178.2.5 src/sys/netinet6/ip6_input.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/ip6_input.c diff -u src/sys/netinet6/ip6_input.c:1.178.2.4 src/sys/netinet6/ip6_input.c:1.178.2.5 --- src/sys/netinet6/ip6_input.c:1.178.2.4 Tue Jan 30 18:21:09 2018 +++ src/sys/netinet6/ip6_input.c Mon Feb 26 00:26:46 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.178.2.4 2018/01/30 18:21:09 martin Exp $ */ +/* $NetBSD: ip6_input.c,v 1.178.2.5 2018/02/26 00:26:46 snj Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.178.2.4 2018/01/30 18:21:09 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.178.2.5 2018/02/26 00:26:46 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_gateway.h" @@ -258,7 +258,7 @@ ip6_input(struct mbuf *m, struct ifnet * int hit, off = sizeof(struct ip6_hdr), nest; u_int32_t plen; u_int32_t rtalert = ~0; - int nxt, ours = 0, rh_present = 0; + int nxt, ours = 0, rh_present = 0, frg_present; struct ifnet *deliverifp = NULL; int srcrt = 0; struct rtentry *rt = NULL; @@ -776,6 +776,7 @@ ip6_input(struct mbuf *m, struct ifnet * percpu_putref(ip6_forward_rt_percpu); rh_present = 0; + frg_present = 0; while (nxt != IPPROTO_DONE) { if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) { IP6_STATINC(IP6_STAT_TOOMANYHDR); @@ -799,6 +800,12 @@ ip6_input(struct mbuf *m, struct ifnet * IP6_STATINC(IP6_STAT_BADOPTIONS); goto bad; } + } else if (nxt == IPPROTO_FRAGMENT) { + if (frg_present++) { + in6_ifstat_inc(rcvif, ifs6_in_hdrerr); + IP6_STATINC(IP6_STAT_BADOPTIONS); + goto bad; + } } #ifdef IPSEC