📄 ip_input.c
字号:
/* ip_input.c * linqianghe@163.com * 2006-09-19 */#include "myip.h"#include "log.h"#include "dummy_ipv4.h"#include "protocol.h"#include "af_inet.h"#include <linux/netfilter.h>#include <linux/netfilter_ipv4.h>struct net_protocol *myinet_protos[MAX_INET_PROTOS];static inline int myip_local_deliver_finish(struct sk_buff *skb){ int protocol = IPPROTO_DUMMY; int hash = protocol & (MAX_INET_PROTOS - 1); struct net_protocol *ipprot; PR_DEBUG( "myip_local_deliver_finish!\n" ); rcu_read_lock(); if( (ipprot = rcu_dereference(myinet_protos[hash])) != NULL ){ ipprot->handler( skb ); }else{ dev_put( skb->dev ); kfree(skb ); } rcu_read_unlock(); return 0;}int myip_local_deliver(struct sk_buff *skb){/* if( skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET) ){ skb = ip_defrag( skb, IP_DEFRAG_LOCAL_DELIVER ); if( !skb ) return 0; }*/ return NF_HOOK( MY_PF_INET, NF_IP_LOCAL_IN, skb, skb->dev, NULL, myip_local_deliver_finish);}static inline int mydst_input(struct sk_buff *skb){ PR_DEBUG( "mydst_input!\n" ); return myip_local_deliver( skb );}static inline int myip_rcv_finish(struct sk_buff *skb){ PR_DEBUG( "myip_rcv_finish!\n"); return mydst_input( skb ); }int myip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev){ PR_DEBUG( "myip_rcv!\n" ); dev_put( dev ); return NF_HOOK( MY_PF_INET, NF_IP_PRE_ROUTING, skb, dev, NULL, myip_rcv_finish );}EXPORT_SYMBOL_GPL( myip_rcv );EXPORT_SYMBOL_GPL( myinet_protos );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -