tech-net archive

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

ipv6 atomic processing diff



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.


I based the diff on similar work done by OpenBSD.

Index: frag6.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/frag6.c,v
retrieving revision 1.52
diff -u -p -r1.52 frag6.c
--- frag6.c     31 Dec 2011 20:41:59 -0000      1.52
+++ frag6.c     26 Sep 2012 16:55:39 -0000
@@ -172,6 +172,20 @@ frag6_in(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);
 
        /*



Home | Main Index | Thread Index | Old Index