⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ip_input.c

📁 一个基于linux的TCP/IP协议栈的实现
💻 C
字号:
/* ip_input.c * linqianghe@163.com * 2006-09-19 */#include "myip.h"#include "log.h"#include "dummy_ipv4.h"#include "protocol.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){	PR_DEBUG( "myip_local_deliver!\n" );	return myip_local_deliver_finish( skb );}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 myip_rcv_finish( skb );}EXPORT_SYMBOL_GPL( myip_rcv );EXPORT_SYMBOL_GPL( myinet_protos );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -