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

Re: Help in tcp/ip source hacking



vamshi varma wrote :

>Hi,
>  I am trying to understand the tcp/ip implementation.
>I am stuck at the following point.
>
>In function ip_queue_xmit which calls dev_queue_xmit(as I understood
>earlier) after forming ip header I find following line of code.
>
>skb->dst->output(skb);
>
>Till now I thought output func is initialised to dev_queue_xmit.
>I tried to print skb->data just before calling this output function
>and at the begining of dev_queue_xmit.
>The first printk showed only ip packet(without
>header) and to my surprise second one at the beging of dev_queue_xmit
>it printed with ethernet header.
>Can anybody exlain what is the code flow between skb->dst->output and
>dev_queue_xmit. And where this dst->output is being initialised.

okay this is how packets flow in the stack

ip_rcv -> ip_route_input (does a cache route lookup,if fails) ->
[ ip_route_input_slow (this sets dst->output to ip_finish_output and
dst->input ip_forward) ] -> skb->dst->input(ip_forward) -> TTL processing
etc. -> ip_finish_output -> ip_finish_output2 (this causes hh->output or
neighbour->output (typically dev_queue_xmit) -> finally
dev->hard_start_xmit(this function is implemented by device driver)


If the packet generated is a local IP packet, it gets calls
ip_route_output_slow. Which does things similar to ip_route_input_slow.

--a

-- 
How do u delete a letter in vi and paste it after the next one?

"xp"

--


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