Module Name: src
Committed By: christos
Date: Thu Sep 27 23:10:00 UTC 2012
Modified Files:
src/sys/netinet6: frag6.c
Log Message:
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.53 -r1.54 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.53 src/sys/netinet6/frag6.c:1.54
--- src/sys/netinet6/frag6.c:1.53 Sun Jul 1 18:04:44 2012
+++ src/sys/netinet6/frag6.c Thu Sep 27 19:10:00 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: frag6.c,v 1.53 2012/07/01 22:04:44 rmind Exp $ */
+/* $NetBSD: frag6.c,v 1.54 2012/09/27 23:10:00 christos 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.53 2012/07/01 22:04:44 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.54 2012/09/27 23:10:00 christos 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);