Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Protocol handler using dev_add_pack

119 views
Skip to first unread message

Jerry Yu

unread,
Jul 11, 2012, 9:38:57 AM7/11/12
to linux-...@vger.kernel.org
I am working on a kernel module to monitor all TCP packets. I created a protocol
handler with protocol code ETH_P_ALL to handle all incoming and outgoing
TCP packets. The code worked fine on 2.6.14 kernel, but in current 3.2.0-26
kernel, I am no longer able to get the TCP payload for outgoing packets.
The data in TCP payload section of skb->data are mainly 0x00. I am still
able to get incoming TCP packets' payloads though.

Is there any change in 3.2.0 or other early kernel versions that will cause
this issue?

Thanks,

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

Eric Dumazet

unread,
Jul 11, 2012, 10:17:29 AM7/11/12
to Jerry Yu, linux-...@vger.kernel.org
On Wed, 2012-07-11 at 10:38 -0300, Jerry Yu wrote:
> I am working on a kernel module to monitor all TCP packets. I created a protocol
> handler with protocol code ETH_P_ALL to handle all incoming and outgoing
> TCP packets. The code worked fine on 2.6.14 kernel, but in current 3.2.0-26
> kernel, I am no longer able to get the TCP payload for outgoing packets.
> The data in TCP payload section of skb->data are mainly 0x00. I am still
> able to get incoming TCP packets' payloads though.
>
> Is there any change in 3.2.0 or other early kernel versions that will cause
> this issue?

Maybe you make wrong assumptions in your code.

skb->data doesnt exactly contains tcp payload of locally generated TCP
packets, unless you disabled scatter-gather on the NIC

ehtool -K eth0 sg off

Jerry Yu

unread,
Jul 12, 2012, 2:13:17 PM7/12/12
to Eric Dumazet, linux-...@vger.kernel.org
Eric,

Thank you very much. Once I disabled scatter-gather on the NIC, the
issue disappeared. Now I just need to figure out how to access the
paged data if the scatter-gather I/O feature enabled. Seems that the
functions to map and unmap frag pages ( kmap_skb_frag and
kunmap_skb_frag) are removed from skbuff.h in 3.2.0-26. I may have to
create similar functions by myself.

Thanks again,

Jerry
0 new messages