Re: help in tcp/ip source hacking

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

 



Function pointer dev->hard_header (in net_init.c) is initialised to "eth_header"
(def in ethernet/eth.c) in func "ether_setup" called from "init_etherdev".

we call init_etherdev from our driver to initialise dev.

The function hard_header is called from ip_queue_xmit. But I am rather

confused the way its being called.

if(skb_headroom(skb) < dev->hard_header_len && dev->hard_header)

where hard_header is a function pointer. Declared as below

int (*hard_header) (struct sk_buff *skb, struct device *dev, 
		    unsigned short type, void *daddr,
		    void *saddr, unsigned len);


Can anybody explain how the required arguements are passed to hardware
header.

The hard_header is the function which finally pushes hardware header
into our skb.Pls correct me in case I'm wrong.

 <mrwangxc@263.net> wrote:
> >Hi all,
> >   I am trying to understand the tcp/ip implementation
> >in Linux.
> >My doubt is where the ethernet header is being formed 
> >for the outgoing packet.
> >I was able to know that it is being cached in dst_entry
> >as "struct hh_cache" held by both neighbour table as well as rtable.
> >This reduces the time taken to form ethernet header
> >for each and every packet going out.
> >
> >But I was not able to see where exactly the cached ethernet header
> is
> >being pushed into sk_buff holding our packet.
> >
> >As I see eth_header(ethernet/eth.c) pushes the header into
> >sk_buff but this func is not being called by anybody?
> Loopback.c (linux\drivers\net):	dev->hard_header	= eth_header;
> Net_init.c (linux\drivers\net):	dev->hard_header	= eth_header;
> 
> they must have used the "dev->hard_header" interface(there are a lot
> of such "interface" in the tcp/ip stack)
> u can trace it back to find out how these things happen
> & i'm glad to hear about the things you find out, more details,better.
> >
> >Can any body help?


__________________________________________________
FREE voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com

--
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