The HyperNews Linux KHG Discussion Pages

Question: Skbuff->headers, I need help!

Forum: Network Buffers And Memory Management
Keywords: skbuff
Date: Fri, 13 Mar 1998 15:08:43 GMT
From: Johan Sunden <d3sunden@dtek.chalmers.se>

Hello!
I am new to kernel hacking so help me if you feel like it:)

I am having difficulties in understanding how to get the
information i need out of the skbuff.

I am currently trying to pick the headers out from an skbuff
just before netif_rx(skb) in the function boomerang_rx(...)
in the file drivers/net/3c59x.c

I want to do different things in the driver depending on
what kind of packet it is. So far I can decide if there
is an IP-header with:
if(ntohs(skb->mac.ethernet->h_proto) == ETH_P_IP)
(if this is correct?)
If so:
How can I tell if it is TCP, UDP, ... in a similar
way?

It feels like I have been trying everything but so far no
success.

The result (if any) will be used to collect packets on
the network to create a log of *all* packets of a selected
type during a interval. The log will then be analyzed and compared to other logs to see how the traffic flows, which
packet goes where and why.

Mvh/
Johan
d3sunden@dtek.chalmers.se