Module Name: src Committed By: riz Date: Thu Oct 25 17:26:18 UTC 2012
Modified Files: src/sys/netinet6 [netbsd-6-0]: frag6.c Log Message: Pull up following revision(s) (requested by christos in ticket #637): sys/netinet6/frag6.c: revision 1.54 Loganaden Velvindron: >From "http://tools.ietf.org/html/draft-ietf-6man-ipv6-atomic-fragments-00": A host that receives an IPv6 packet which includes a Fragment Header with the "Fragment Offset" equal to 0 and the "M" bit equal to 0 MUST process such packet in isolation from any other packets/ fragments, even if such packets/fragments contain the same set {IPV6 Source Address, IPv6 Destination Address, Fragment Identification}. That is, the Fragment Header of "atomic fragments" should be removed by the receiving host, and the resulting packet should be processed as a non-fragmented IPv6 datagram. Additionally, any fragments already queued with the same set {IPV6 Source Address, IPv6 Destination Address, Fragment Identification} should not be discarded upon receipt of the "colliding" IPv6 atomic fragment, since IPv6 atomic fragments do not really interfere with "normal" fragmented traffic. To generate a diff of this commit: cvs rdiff -u -r1.52.2.1 -r1.52.2.1.4.1 src/sys/netinet6/frag6.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/frag6.c diff -u src/sys/netinet6/frag6.c:1.52.2.1 src/sys/netinet6/frag6.c:1.52.2.1.4.1 --- src/sys/netinet6/frag6.c:1.52.2.1 Thu Jul 5 17:43:49 2012 +++ src/sys/netinet6/frag6.c Thu Oct 25 17:26:18 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: frag6.c,v 1.52.2.1 2012/07/05 17:43:49 riz Exp $ */ +/* $NetBSD: frag6.c,v 1.52.2.1.4.1 2012/10/25 17:26:18 riz Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.52.2.1 2012/07/05 17:43:49 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.52.2.1.4.1 2012/10/25 17:26:18 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -171,6 +171,20 @@ frag6_input(struct mbuf **mp, int *offp, /* offset now points to data portion */ offset += sizeof(struct ip6_frag); + /* + * draft-gont-6man-ipv6-atomic-fragments-00: A host that receives an + * IPv6 packet which includes a Fragment Header with the "Fragment + * Offset" equal to 0 and the "M" bit equal to 0 MUST process such + * packet in isolation from any other packets/fragments. + */ + fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); + if (fragoff == 0 && !(ip6f->ip6f_offlg & IP6F_MORE_FRAG)) { + IP6_STATINC(IP6_STAT_REASSEMBLED); + in6_ifstat_inc(dstifp, ifs6_reass_ok); + *offp = offset; + return ip6f->ip6f_nxt; + } + mutex_enter(&frag6_lock); /* @@ -233,7 +247,7 @@ frag6_input(struct mbuf **mp, int *offp, * If it's the 1st fragment, record the length of the * unfragmentable part and the next header of the fragment header. */ - fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); + if (fragoff == 0) { q6->ip6q_unfrglen = offset - sizeof(struct ip6_hdr) - sizeof(struct ip6_frag);