[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help in tcp/ip source hacking
On Tue, Dec 18, 2001 at 02:38:03AM -0800, vamshi varma wrote:
> Can anybody exlain what is the code flow between skb->dst->output and
> dev_queue_xmit. And where this dst->output is being initialised.
>
Check net/ipv4/ip_output.c. dst->output is setted by ip_route_output for
outgoing packets or ip_route_input for incoming packets.
i.e, local packets are sent by ip_queue_xmit, that calls ip_queue_xmit2 throught
NF_IP_LOCAL_OUT; in ip_queue_xmit2 the skb is sent by calling skb->dst->output (skb),
that points to ip_output. ip_output calls ip_finish_output, that calls ip_finish_output2
through NF_IP_POST_ROUTING. In ip_finish_output2 the ethernet header is added and
the packet is sent:
static inline int ip_finish_output2(struct sk_buff *skb)
{
struct dst_entry *dst = skb->dst;
struct hh_cache *hh = dst->hh;
#ifdef CONFIG_NETFILTER_DEBUG
nf_debug_ip_finish_output2(skb);
#endif /*CONFIG_NETFILTER_DEBUG*/
if (hh) {
read_lock_bh(&hh->hh_lock);
memcpy(skb->data - 16, hh->hh_data, 16);
read_unlock_bh(&hh->hh_lock);
skb_push(skb, hh->hh_len);
return hh->hh_output(skb);
} else if (dst->neighbour)
return dst->neighbour->output(skb);
if (net_ratelimit())
printk(KERN_DEBUG "ip_finish_output2: No header cache and no neighbour!\n");
kfree_skb(skb);
return -EINVAL;
}
Cheers,
Juanma
--
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/