Re: TCP-packet with PUSH flag with wrong payload data in LOCAL_OUT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 2009-01-22 19:15, James King wrote:
>On Thu, Jan 22, 2009 at 8:11 AM, Jan Engelhardt <jengelh@xxxxxxxxxx> wrote:
>> Very well. But there still is another case I can think of -
>> non-linear skb.
>>
>>        struct tcphdr tcpbuf;
>>        const struct tcphdr *th;
>>
>>        th = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(tcpbuf), &tcpbuf);
>>        if (th->psh && ntohs(tcp->dest) == 80) {
>>                char n[4];
>>
>>                if (skb_copy_bits(skb, ip_hdrlen(skb) + 4*tcp->doff,
>>                    n, sizeof(n)) >= 0)
>>                        printk("data: %02x %02x %02x %02x\n", n[0], n[1],
>>                               n[2], n[3]);
>>        }
>
>Wouldn't
>
>if ((skb_linearize(skb) != 0) && net_ratelimit())
>      printk("skb is non-linear, but failed to linearize");
>
>be more preferable?

I don't think you want to be spending the CPU cycles for that.
skb_copy_.. has a reason, at least for when you only need
parts of the packet. A whole packet can be large --
the MTU for lo is slightly above 16K, and that's a pretty big
allocation already. The larger the allocation (come to think
of jumbo packets), the sooner the fail.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux