From: Matt Mackall <[EMAIL PROTECTED]>
Date: Mon, 14 Nov 2005 22:29:47 -0800

> Can we make any assumptions about the size and position of fragments.
> For instance, will the first N data bytes of a UDP packet all be in
> the same fragment?

Nope, they can be fragmented any way possible.

For packet parsing, you don't need any of this anyways.
Just use the things that the normal network input stack
uses, for example you could use something like
skb_header_pointer(), or pskb_may_pull().

For example, a clean way to parse a UDP header at the
front of an SKB is:

        struct udphdr *uh, _tmp;

        uh = skb_header_pointer(skb, 0, sizeof(_tmp), &_tmp);
        if (uh->sport = foo && uh->dport == bar)
                ...

The UDP input path uses:

        struct udphdr *uh;

        if (!pskb_may_pull(skb, sizeof(struct udphdr)))
                goto header_error;

        uh = skb->h.uh;

Unfortunately, pskb_may_pull() may need to call __pskb_pull_tail()
which in turn might do a pskb_expand_head() and thus a GFP_ATOMIC
memory allocation.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to