netdev
[Top] [All Lists]

[PATCH] IPV6: eliminating magic number for sizeof(struct frag_hdr) (Re:

To: davem@xxxxxxxxxx
Subject: [PATCH] IPV6: eliminating magic number for sizeof(struct frag_hdr) (Re: [PATCH] IPV6: fix payload length of reassembled packet)
From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@xxxxxxxxxxxxxx>
Date: Thu, 12 Jun 2003 02:39:19 +0900 (JST)
Cc: netdev@xxxxxxxxxxx, pekkas@xxxxxxxxxx, yoshfuji@xxxxxxxxxxxxxx
In-reply-to: <20030612.022753.56899094.yoshfuji@linux-ipv6.org>
Organization: USAGI Project
References: <20030612.020716.37975763.yoshfuji@linux-ipv6.org> <Pine.LNX.4.44.0306112014560.2321-100000@netcore.fi> <20030612.022753.56899094.yoshfuji@linux-ipv6.org>
Sender: netdev-bounce@xxxxxxxxxxx
In article <20030612.022753.56899094.yoshfuji@xxxxxxxxxxxxxx> (at Thu, 12 Jun 
2003 02:27:53 +0900 (JST)), YOSHIFUJI Hideaki / 吉藤英明 
<yoshfuji@xxxxxxxxxxxxxx> says:

> > s/8/sizeof(struct frag_hdr)/ ?
> 
> Yes, sizeof(struct frag_hdr). 
> I, however, use 8 for now to focus on the bug itself.
> (We have more "8"s there which should be substituted.)

s/8/sizeof(struct frag_hdr)/;
please apply this on top of the original patch.
Thanks.

--- linux-2.5+fix/net/ipv6/reassembly.c Thu Jun 12 02:33:42 2003
+++ linux-2.5+fix+edited/net/ipv6/reassembly.c  Thu Jun 12 02:34:27 2003
@@ -596,7 +596,7 @@
        BUG_TRAP(FRAG6_CB(head)->offset == 0);
 
        /* Unfragmented part is taken from the first segment. */
-       payload_len = (head->data - head->nh.raw) - sizeof(struct ipv6hdr) + 
fq->len - 8;
+       payload_len = (head->data - head->nh.raw) - sizeof(struct ipv6hdr) + 
fq->len - sizeof(struct frag_hdr);
        if (payload_len > 65535)
                goto out_oversize;
 
@@ -631,9 +631,10 @@
         * header in order to calculate ICV correctly. */
        nhoff = fq->nhoffset;
        head->nh.raw[nhoff] = head->h.raw[0];
-       memmove(head->head+8, head->head, (head->data-head->head)-8);
-       head->mac.raw += 8;
-       head->nh.raw += 8;
+       memmove(head->head + sizeof(struct frag_hdr), head->head, 
+               (head->data - head->head) - sizeof(struct frag_hdr));
+       head->mac.raw += sizeof(struct frag_hdr);
+       head->nh.raw += sizeof(struct frag_hdr);
 
        skb_shinfo(head)->frag_list = head->next;
        head->h.raw = head->data;


-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@xxxxxxxxxxxxxx>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

<Prev in Thread] Current Thread [Next in Thread>