patch-2.1.30 linux/net/ipv6/reassembly.c

Next file: linux/net/ipv6/route.c
Previous file: linux/net/ipv6/raw.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.29/linux/net/ipv6/reassembly.c linux/net/ipv6/reassembly.c
@@ -5,6 +5,8 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
+ *	$Id: reassembly.c,v 1.7 1997/03/18 18:24:47 davem Exp $
+ *
  *	Based on: net/ipv4/ip_fragment.c
  *
  *	This program is free software; you can redistribute it and/or
@@ -32,7 +34,6 @@
 #include <net/transp_v6.h>
 #include <net/rawv6.h>
 #include <net/ndisc.h>
-#include <net/ipv6_route.h>
 #include <net/addrconf.h>
 
 
@@ -61,9 +62,7 @@
 	int nh;
 
 	if (del_timer(&fq->timer))
-	{
 		expires = fq->timer.expires;
-	}
 
 	/*
 	 *	We queue the packet even if it's the last.
@@ -75,14 +74,12 @@
 	 */
 	reasm_queue(fq, *skb, fhdr);
 
-	if ((fhdr->frag_off & __constant_htons(0x0001)) == 0)
-	{
+	if ((fhdr->frag_off & __constant_htons(0x0001)) == 0) {
 		fq->last_in = 1;
 		fq->nhptr = nhptr;
 	}
 
-	if (fq->last_in)
-	{
+	if (fq->last_in) {
 		if ((nh = reasm_frag_1(fq, skb)))
 			return nh;
 	}
@@ -99,17 +96,13 @@
 	struct frag_hdr *fhdr = (struct frag_hdr *) ((*skb)->h.raw);
 	struct frag_queue *fq;
 	
-	for (fq = ipv6_frag_queue.next; fq != &ipv6_frag_queue; fq = fq->next)
-	{
+	for (fq = ipv6_frag_queue.next; fq != &ipv6_frag_queue; fq = fq->next) {
 		if (fq->id == fhdr->identification)
-		{			
 			return reasm_frag(fq, skb, nhptr,fhdr);
-		}
 	}
 	
 	create_frag_entry(*skb, dev, nhptr, fhdr);
 
-
 	return 0;
 }
 
@@ -118,8 +111,7 @@
 {
 	struct ipv6_frag *fp, *back;
 
-	for(fp = fq->fragments; fp; )
-	{
+	for(fp = fq->fragments; fp; ) {
 		kfree_skb(fp->skb, FREE_READ);		
 		back = fp;
 		fp=fp->next;
@@ -132,7 +124,6 @@
 	fq->prev = fq->next = NULL;
 	
 	kfree(fq);
-
 }
 
 static void frag_expire(unsigned long data)
@@ -146,13 +137,12 @@
 
 	frag = fq->fragments;
 
-	if (frag == NULL)
-	{
+	if (frag == NULL) {
 		printk(KERN_DEBUG "invalid fragment queue\n");
 		return;
 	}
 
-	icmpv6_send(frag->skb, ICMPV6_TIME_EXCEEDED, ICMPV6_EXC_FRAGTIME, 0,
+	icmpv6_send(frag->skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0,
 		    frag->skb->dev);
 	
 	fq_free(fq);
@@ -168,8 +158,7 @@
 	fq = (struct frag_queue *) kmalloc(sizeof(struct frag_queue), 
 					   GFP_ATOMIC);
 
-	if (fq == NULL)
-	{
+	if (fq == NULL) {
 		kfree_skb(skb, FREE_READ);
 		return;
 	}
@@ -188,8 +177,7 @@
 	fq->nexthdr = fhdr->nexthdr;
 
 
-	if ((fhdr->frag_off & __constant_htons(0x0001)) == 0)
-	{
+	if ((fhdr->frag_off & __constant_htons(0x0001)) == 0) {
 		fq->last_in = 1;
 		fq->nhptr = nhptr;
 	}
@@ -212,13 +200,11 @@
 	nfp = (struct ipv6_frag *) kmalloc(sizeof(struct ipv6_frag), 
 					   GFP_ATOMIC);
 
-	if (nfp == NULL)
-	{
+	if (nfp == NULL) {
 		kfree_skb(skb, FREE_READ);
 		return;
 	}
 
-	
 	nfp->offset = ntohs(fhdr->frag_off) & ~0x7;
 	nfp->len = (ntohs(skb->nh.ipv6h->payload_len) -
 		    ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
@@ -231,18 +217,14 @@
 
 	bptr = &fq->fragments;
 	
-
-	for (fp = fq->fragments; fp; fp=fp->next)
-	{
+	for (fp = fq->fragments; fp; fp=fp->next) {
 		if (nfp->offset <= fp->offset)
 			break;
 		bptr = &fp->next;
 	}
 	
-	if (fp && fp->offset == nfp->offset)
-	{
-		if (fp->len != nfp->len)
-		{
+	if (fp && fp->offset == nfp->offset) {
+		if (fp->len != nfp->len) {
 			/* this cannot happen */
 			printk(KERN_DEBUG "reasm_queue: dup with wrong len\n");
 		}
@@ -253,7 +235,6 @@
 		return;
 	}
 	
-
 	*bptr = nfp;
 	nfp->next = fp;
 }
@@ -273,9 +254,7 @@
 	__u16  copy;
 	int    nh;
 
-
-	for(fp = fq->fragments; fp; fp=fp->next)
-	{
+	for(fp = fq->fragments; fp; fp=fp->next) {
 		if (offset != fp->offset)
 			return 0;
 
@@ -296,8 +275,7 @@
 
 	printk(KERN_DEBUG "reasm: payload len = %d\n", payload_len);
 
-	if ((skb = dev_alloc_skb(sizeof(struct ipv6hdr) + payload_len))==NULL)
-	{
+	if ((skb = dev_alloc_skb(sizeof(struct ipv6hdr) + payload_len))==NULL) {
 		printk(KERN_DEBUG "reasm_frag: no memory for reassembly\n");
 		fq_free(fq);
 		return 1;
@@ -309,7 +287,6 @@
 
 	skb->dev = fq->dev;
 
-	
 	nh = fq->nexthdr;
 
 	*(fq->nhptr) = nh;
@@ -325,8 +302,7 @@
 	 *	FIXME: If we don't have a checksum we ought to be able
 	 *	to defragment and checksum in this pass. [AC]
 	 */
-	for(fp = fq->fragments; fp; )
-	{
+	for(fp = fq->fragments; fp; ) {
 		struct ipv6_frag *back;
 
 		memcpy(skb_put(skb, fp->len), (__u8*)(fp->fhdr + 1), fp->len);
@@ -345,12 +321,3 @@
 
 	return nh;
 }
-
-
-
-/*
- * Local variables:
- *  compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -m486 -DCPU=486 -DMODULE -DMODVERSIONS -include /usr/src/linux/include/linux/modversions.h  -c -o reassembly.o reassembly.c"
- * c-file-style: "Linux"
- * End:
- */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov