2007年5月18日 星期五

ㄧ般情況packet 走routing 的順序(不含bridge)

net/ipv4/ip_input.c
ip_rcv_finish

/* ip_route_input function will find the destination cache in the routing cache or forwarding information base. And pointer

the destination cache in the skb->dst */
net/ipv4/route.c
ip_route_input

normally the packet will in this way
net/ipv4/route.c
ip_route_input_slow

/* If the packet is bound to received by the host itself. The input function of routing table will be set as ip_local_deliver

*/
rth->u.dst.input= ip_local_deliver

net/ipv4/ip_input.c
ip_local_deliver

NF_HOOK(PF_INET, NF_IP_LOCAL_IN, skb, skb->dev, NULL, ip_local_deliver_finish); ==> iptables/MANGLE INPUT
NF_HOOK(PF_INET, NF_IP_LOCAL_IN, skb, skb->dev, NULL, ip_local_deliver_finish); ==> iptables/FILTER INPUT
NF_HOOK(PF_INET, NF_IP_LOCAL_IN, skb, skb->dev, NULL, ip_local_deliver_finish); ==> iptables/NAT INPUT
NF_HOOK(PF_INET, NF_IP_LOCAL_IN, skb, skb->dev, NULL, ip_local_deliver_finish); ==> iptables/CONNTRACK_LAST INPUT


net/ipv4/ip_input.c
ip_local_deliver_finish

net/ipv4/ip_input.c
ipprot->handler(skb);

net/ipv4/tcp_ipv4.c
int tcp_v4_rcv(struct sk_buff *skb)

net/ipv4/tcp_ipv4.c
sk_add_backlog(sk, skb);

net/ipv4/tcp_ipv4.c
tcp_v4_do_rcv


/*
if (!sock_owned_by_user(sk)) {
if (!tcp_prequeue(sk, skb))
ret = tcp_v4_do_rcv(sk, skb);
} else
sk_add_backlog(sk, skb);
*/

沒有留言: