Re:

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

 




>Date: Wed, 12 Sep 2001 23:09:27 -0700 (PDT)
>From: Roger McGregor <rogermcg2000@yahoo.com>
>To: kernelnewbies@nl.linux.org
>MIME-Version: 1.0
>
>
>Hi
>
>I need to modify packets to send an extra four bytes between the L2 and IP header). 
 I have tried to change dev->hard_header_len of the ethernet device but it doesn't 
seem to work. Where exactly in the code are packets given their L2 headers 
(dev->hard_header function or dev->rebuild_header ??). I have browsed the kernel LXR 
but I can't figure it out. What I would like to do is add my 4 bytes just before the 
hard header is added.
>
>Any suggestions would be most appreciated.
>
>Thanks
>
>Roger
>
>
>
>---------------------------------
>Terrorist Attacks on U.S. - How can you help?
>Donate cash, emergency relief information inYahoo! News.

The place you most likely need to add these bytes are in the ethernet driver itself 
(i briefly looked into it)...

(from Linux Journal issue 29, sept 1996)
**
The protocol layer calls down to the device with a buffer that has at least 
dev->hard_header_len bytes free at the start of the buffer.  It is then up to the 
network device to correctly call skb_push() and to put the header on the packet in 
its dev->hard_header() method.  Devices with no link layer header, such as SLIP, may 
have this method specified as NULL.
**
eth_header() is the standard ethernet handler for the dev->hard_header routine, and 
can be used in any ethernet driver.  Combined with eth_rebuild_header() for the 
rebuild routine it provides all the ARP lookup required to put ethernet headers on 
IP packets.
**

/drivers/net/net_init.c contains ether_setup which sets the dev settings to default 
values

Other possible locations to look are /include/linux/etherdevice.h and 
/net/ethernet/eth.c or simply grep in /drivers

You might want to look at catching the buffer at dev->hard_start_xmit() and 
modifying it there before it gets handed off to the ethernet device.

Just some ideas (i've been doing a bit of research on the linux network stack, 
though I've been concentrating on receiving, haven't looked much into sending yet)

Hope this was helpful/relevant.

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux