Re: IP De-fragmentation

From: David Ford (david@kalifornia.com)
Date: Thu Jun 22 2000 - 03:08:48 EST


Haven't heard of teardrop, nestea, land? Yes, overlap can occur anywhere.

-d

"A. Supreeth Reddy" wrote:

> Hi folks,
> I have been going through the ip fragmentation and de-frag code in kernel
> version 2.2.16
> net/ipv4/ip_fragment.c. I haven't been able to find the need to do the below
> check in a for loop
> , i mean, why to check all the succeeding fragments for overlap, because
> that will never be the case.
> It could be suitably replaced with an if () check itself. Do I over-look
> something ?? I have been through
> the RFC 791 , and didn't find the need to do this.
>
> 505 /* Look for overlap with succeeding segments.
> 506 * If we can merge fragments, do it.
> 507 */
> 508 for (tmp = next; tmp != NULL; tmp = tfp) {
> 509 tfp = tmp->next;
> 510 if (tmp->offset >= end)
> 511 break; /* no overlaps at all */
> 512
> 513 i = end - next->offset; /* overlap is 'i' bytes */
> 514 tmp->len -= i; /* so reduce size of */
> 515 tmp->offset += i; /* next fragment */
> 516 tmp->ptr += i;
> 517
> 518 /* If we get a frag size of <= 0, remove it and the
> packet
> 519 * that it goes with.
> 520 */
> 521 if (tmp->len <= 0) {
> 522 if (tmp->prev != NULL)
> 523 tmp->prev->next = tmp->next;
> 524 else
> 525 qp->fragments = tmp->next;
> 526
> 527 if (tmp->next != NULL)
> 528 tmp->next->prev = tmp->prev;
> 529
> 530 /* We have killed the original next frame. */
> 531 next = tfp;
> 532
> 533 frag_kfree_skb(tmp->skb);
> 534 frag_kfree_s(tmp, sizeof(struct ipfrag));
> 535 }
> 536 }
>
> ****************************************************************************
> ****
> A. Supreeth Reddy
> Software Engineer
> Global R & D Solutions
> Wipro Technologies
> #37 , Castle Street , Ashok Nagar
> Bangalore - 560 025 , India
> Tel : 091-80-2367297 x309
> E-mail: supreeth.reddy@wipro.com
> ****************************************************************************
> ****
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

--
"The difference between 'involvement' and 'commitment' is like an
eggs-and-ham breakfast: the chicken was 'involved' - the pig was
'committed'."


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:23 EST