Re: Don't use IP packets with payload < 8 octets

From: Jiwoong Lee (porce@ktf.com)
Date: Wed Jan 23 2002 - 04:16:44 EST


Well David,

My code is not cool. But it is still useful.

My code is made to test networking sanity between two IP peers. It uses raw
socket and 4 bytes IP payload.

I REALLY surprised that my code did not work on Linux 2.4.x. Sillily I spent
lots of time to find out what was the problem.

Finally what I found is what Morten Schlaeger(the author of the first thread
of this postings) had found.

Who wrote this RFC-non-conforming code ?

>From Morten's posting:

the code which discards our packets (File ip_input.c; function int
ip_local_deliver_finish(struct sk_buff *skb)

   227 /* Pull out additionl 8 bytes to save some space in
protocols. */
   228 if (!pskb_may_pull(skb, ihl+8))
   229 goto out;
   230 __skb_pull(skb, ihl);

File: skbuff.h

static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
{
        if (len <= skb_headlen(skb))
                return 1;
        if (len > skb->len)
                return 0;
        return (__pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL);
}

Jiwoong

----- Original Message -----
From: "David S. Miller" <davem@redhat.com>
To: <morten@ee.tu-berlin.de>
Cc: <linux-net@vger.kernel.org>; <posch@ftmail.ee.tu-berlin.de>
Sent: Wednesday, January 09, 2002 8:51 PM
Subject: Re: Don't use IP packets with payload < 8 octets

> From: Morten Schlaeger <morten@ee.tu-berlin.de>
> Date: Wed, 9 Jan 2002 10:46:56 +0100 (CET)
>
> So, I think your statement is only true for the fragments of a
fragmented
> packet. Further the appendix of RFC 791 gives the following example:
>
> Man, if it weren't for RAW sockets I would be now asking
> you "Now show me a legitimate IP packet that has one byte
> of data".
>
> Probably the correct test is therefore something like:
>
> if (ipprot_exists(iph->protocol) &&
> pskb_may_pull(skb, ihl + 8))
> goto out;
>
> And at that point this added overhead defeats the whole purpose of
> consolidating the pskb_may_pull() from the protocol inputs, into
> the generic IP input. :-(
>
> So I'm going to ask anyways, what cool RAW sockets app uses these 1
> byte packets? :-)
>
> Franks a lot,
> David S. Miller
> davem@redhat.com
> -
> To unsubscribe from this list: send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html



This archive was generated by hypermail 2b29 : Wed Jan 23 2002 - 21:01:14 EST