上一节说到当判断该数据报文是发送给本机的话那么就会直接到ip_local_deliver()
进行处理
ip_local_deliver
对于收到的IP报文需要传递给更上层的协议去处理,但是如果收到的是IP分片的那么就需要在往上层传递之前先进行重组,这些就是在ip_local_deliver()
函数里面进行的。我们看下代码:
/*
* Deliver IP Packets to the higher protocol layers.
*/
int ip_local_deliver(struct sk_buff *skb)
{
/*
* Reassemble IP fragments.
*/
struct net *net = dev_net(skb->dev);
//check if it is a fragment
if (ip_is_fragment(ip_hdr(skb))) {
//fragment recombination
if (ip_defrag(net, skb, IP_DEFRAG_LOCAL_DELIVER))
<