网络子系统85_inet协议族-l3向上
来源:互联网 发布:稳定性测试软件 编辑:程序博客网 时间:2024/05/29 10:25
//ip数据报向本地传递//调用路径:ip_rcv->dst_input->...->ip_local_deliver1.1 int ip_local_deliver(struct sk_buff *skb){//如果ip数据报被分片,则重组if (ip_is_fragment(ip_hdr(skb))) {if (ip_defrag(skb, IP_DEFRAG_LOCAL_DELIVER))return 0;}//通过hook点,向上传递return NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_IN, skb, skb->dev, NULL, ip_local_deliver_finish);}//ip数据报向本地传递//步骤://1.向raw套接字传递一份skb//2.根据ip报头的协议号在inet_protos中找到l4协议//3.调用l4协议处理函数1.2 static int ip_local_deliver_finish(struct sk_buff *skb){struct net *net = dev_net(skb->dev);//使skb有足够的ip报头__skb_pull(skb, ip_hdrlen(skb));//使指针指向ip报文内容skb_reset_transport_header(skb);rcu_read_lock();{int protocol = ip_hdr(skb)->protocol;const struct net_protocol *ipprot;int raw;resubmit://向raw套接字传递raw = raw_local_deliver(skb, protocol);//通过l4协议号查找上层协议//在inet_init中,通过inet_add_protocol注册l4协议到inet_protos数组ipprot = rcu_dereference(inet_protos[protocol]);if (ipprot != NULL) {int ret;//l4协议处理函数ret = ipprot->handler(skb);if (ret < 0) {protocol = -ret;goto resubmit;}//snmp统计IP_INC_STATS_BH(net, IPSTATS_MIB_INDELIVERS);}...} out:rcu_read_unlock();return 0;}
0 0
- 网络子系统85_inet协议族-l3向上
- 网络子系统79_inet协议族
- 网络子系统80_inet协议族-SOCK_RAW(一)
- 网络子系统81_inet协议族-SOCK_RAW(二)
- 网络子系统82_inet协议族-SOCK_RAW(三)
- 网络子系统83_inet协议族-SOCK_RAW(四)
- 网络子系统86_inet协议族-l4向下(一)
- 网络子系统10_inet模块初始化
- 网络子系统78_inet套接字创建
- 网络子系统7_l2、l3接口
- 网络子系统25_生成树协议
- 网络子系统36_BPDU协议格式
- 网络子系统45_ip协议tos处理
- 网络子系统50_ip协议选项填充
- 网络子系统51_ip协议报文分片
- 网络子系统52_ip协议报文重组
- linux 网络子系统之----TCP基础协议
- linux网络协议栈:邻居子系统
- 一步一步教你做ios推送
- ecshop 模板标签
- Android应用开发之(如何自动在桌面创建快捷方式)
- VARIANT的使用方法
- LinkLists 链表中返回倒数第n个元素 @CareerCup
- 网络子系统85_inet协议族-l3向上
- Java缓存机制
- solr大量索引信息导致搜索变慢
- NEFU 2 猜想
- smart mobile with vehicle
- C实现的泛型栈
- 共享内存(指针bug)
- Android 资源(resource)学习小结
- 乡村爱情圆舞曲全集高清迅雷下载