亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ipfwadm_core.c

?? 優龍2410linux2.6.8內核源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* Minor modifications to fit on compatibility framework:   Rusty.Russell@rustcorp.com.au*/#include <linux/config.h>#define CONFIG_IP_FIREWALL#define CONFIG_IP_FIREWALL_VERBOSE#define CONFIG_IP_MASQUERADE#define CONFIG_IP_ACCT#define CONFIG_IP_TRANSPARENT_PROXY#if defined(CONFIG_NETLINK_DEV) || defined(CONFIG_NETLINK_DEV_MODULE)#define CONFIG_IP_FIREWALL_NETLINK#endif/* *	IP firewalling code. This is taken from 4.4BSD. Please note the *	copyright message below. As per the GPL it must be maintained *	and the licenses thus do not conflict. While this port is subject *	to the GPL I also place my modifications under the original *	license in recognition of the original copyright. *				-- Alan Cox. * *	$Id: ipfwadm_core.c,v 1.11 2002/01/24 15:50:31 davem Exp $ * *	Ported from BSD to Linux, *		Alan Cox 22/Nov/1994. *	Zeroing /proc and other additions *		Jos Vos 4/Feb/1995. *	Merged and included the FreeBSD-Current changes at Ugen's request *	(but hey it's a lot cleaner now). Ugen would prefer in some ways *	we waited for his final product but since Linux 1.2.0 is about to *	appear it's not practical - Read: It works, it's not clean but please *	don't consider it to be his standard of finished work. *		Alan Cox 12/Feb/1995 *	Porting bidirectional entries from BSD, fixing accounting issues, *	adding struct ip_fwpkt for checking packets with interface address *		Jos Vos 5/Mar/1995. *	Established connections (ACK check), ACK check on bidirectional rules, *	ICMP type check. *		Wilfred Mollenvanger 7/7/1995. *	TCP attack protection. *		Alan Cox 25/8/95, based on information from bugtraq. *	ICMP type printk, IP_FW_F_APPEND *		Bernd Eckenfels 1996-01-31 *	Split blocking chain into input and output chains, add new "insert" and *	"append" commands to replace semi-intelligent "add" command, let "delete". *	only delete the first matching entry, use 0xFFFF (0xFF) as ports (ICMP *	types) when counting packets being 2nd and further fragments. *		Jos Vos <jos@xos.nl> 8/2/1996. *	Add support for matching on device names. *		Jos Vos <jos@xos.nl> 15/2/1996. *	Transparent proxying support. *		Willy Konynenberg <willy@xos.nl> 10/5/96. *	Make separate accounting on incoming and outgoing packets possible. *		Jos Vos <jos@xos.nl> 18/5/1996. *	Added trap out of bad frames. *		Alan Cox <alan@cymru.net> 17/11/1996 * * * Masquerading functionality * * Copyright (c) 1994 Pauline Middelink * * The pieces which added masquerading functionality are totally * my responsibility and have nothing to with the original authors * copyright or doing. * * Parts distributed under GPL. * * Fixes: *	Pauline Middelink	:	Added masquerading. *	Alan Cox		:	Fixed an error in the merge. *	Thomas Quinot		:	Fixed port spoofing. *	Alan Cox		:	Cleaned up retransmits in spoofing. *	Alan Cox		:	Cleaned up length setting. *	Wouter Gadeyne		:	Fixed masquerading support of ftp PORT commands * *	Juan Jose Ciarlante	:	Masquerading code moved to ip_masq.c *	Andi Kleen :		Print frag_offsets and the ip flags properly. * *	All the real work was done by ..... * *//* * Copyright (c) 1993 Daniel Boulet * Copyright (c) 1994 Ugen J.S.Antsilevich * * Redistribution and use in source forms, with and without modification, * are permitted provided that this entire comment appears intact. * * Redistribution in binary form may occur without any restrictions. * Obviously, it would be nice if you gave credit where credit is due * but requiring it would be too onerous. * * This software is provided ``AS IS'' without any warranties of any kind. */#include <asm/uaccess.h>#include <asm/system.h>#include <linux/types.h>#include <linux/kernel.h>#include <linux/sched.h>#include <linux/string.h>#include <linux/errno.h>#include <linux/module.h>#include <linux/socket.h>#include <linux/sockios.h>#include <linux/in.h>#include <linux/inet.h>#include <linux/netdevice.h>#include <linux/icmp.h>#include <linux/udp.h>#include <net/ip.h>#include <net/protocol.h>#include <net/route.h>#include <net/tcp.h>#include <net/udp.h>#include <net/sock.h>#include <net/icmp.h>#include <linux/netlink.h>#include <linux/init.h>#include <linux/spinlock.h>#include <linux/netfilter_ipv4/ipfwadm_core.h>#include <linux/netfilter_ipv4/compat_firewall.h>#include <linux/netfilter_ipv4/lockhelp.h>#include <linux/netfilter_ipv4/ip_nat_core.h>#include <net/checksum.h>#include <linux/proc_fs.h>#include <linux/stat.h>MODULE_LICENSE("Dual BSD/GPL");MODULE_DESCRIPTION("ipfwadm backwards compatibility layer");/* *	Implement IP packet firewall */#ifdef DEBUG_IP_FIREWALL#define dprintf1(a)		printk(a)#define dprintf2(a1,a2)		printk(a1,a2)#define dprintf3(a1,a2,a3)	printk(a1,a2,a3)#define dprintf4(a1,a2,a3,a4)	printk(a1,a2,a3,a4)#else#define dprintf1(a)#define dprintf2(a1,a2)#define dprintf3(a1,a2,a3)#define dprintf4(a1,a2,a3,a4)#endif#define print_ip(a)	 printk("%u.%u.%u.%u", NIPQUAD(a));#ifdef DEBUG_IP_FIREWALL#define dprint_ip(a)	print_ip(a)#else#define dprint_ip(a)#endifstatic DECLARE_RWLOCK(ip_fw_lock);#if defined(CONFIG_IP_ACCT) || defined(CONFIG_IP_FIREWALL)struct ip_fw *ip_fw_fwd_chain;struct ip_fw *ip_fw_in_chain;struct ip_fw *ip_fw_out_chain;struct ip_fw *ip_acct_chain;struct ip_fw *ip_masq_chain;static struct ip_fw **chains[] =	{&ip_fw_fwd_chain, &ip_fw_in_chain, &ip_fw_out_chain, &ip_acct_chain,	 &ip_masq_chain	};#endif /* CONFIG_IP_ACCT || CONFIG_IP_FIREWALL */#ifdef CONFIG_IP_FIREWALLint ip_fw_fwd_policy=IP_FW_F_ACCEPT;int ip_fw_in_policy=IP_FW_F_ACCEPT;int ip_fw_out_policy=IP_FW_F_ACCEPT;static int *policies[] =	{&ip_fw_fwd_policy, &ip_fw_in_policy, &ip_fw_out_policy};#endif#ifdef CONFIG_IP_FIREWALL_NETLINKstruct sock *ipfwsk;#endif/* *	Returns 1 if the port is matched by the vector, 0 otherwise */extern inline int port_match(unsigned short *portptr,int nports,unsigned short port,int range_flag){	if (!nports)		return 1;	if ( range_flag )	{		if ( portptr[0] <= port && port <= portptr[1] )		{			return( 1 );		}		nports -= 2;		portptr += 2;	}	while ( nports-- > 0 )	{		if ( *portptr++ == port )		{			return( 1 );		}	}	return(0);}#if defined(CONFIG_IP_ACCT) || defined(CONFIG_IP_FIREWALL)#ifdef CONFIG_IP_FIREWALL_VERBOSE/* *	VERY ugly piece of code which actually makes kernel printf for * 	matching packets. */static char *chain_name(struct ip_fw *chain, int mode){	switch (mode) {	case IP_FW_MODE_ACCT_IN: return "acct in";	case IP_FW_MODE_ACCT_OUT: return "acct out";	default:		if (chain == ip_fw_fwd_chain)			return "fw-fwd";		else if (chain == ip_fw_in_chain)			return "fw-in";		else			return "fw-out";	}}static char *rule_name(struct ip_fw *f, int mode, char *buf){	if (mode == IP_FW_MODE_ACCT_IN || mode == IP_FW_MODE_ACCT_OUT)		return "";	if(f->fw_flg&IP_FW_F_ACCEPT) {		if(f->fw_flg&IP_FW_F_REDIR) {			sprintf(buf, "acc/r%d ", f->fw_pts[f->fw_nsp+f->fw_ndp]);			return buf;		} else if(f->fw_flg&IP_FW_F_MASQ)			return "acc/masq ";		else			return "acc ";	} else if(f->fw_flg&IP_FW_F_ICMPRPL) {		return "rej ";	} else {		return "deny ";	}}static void print_packet(struct sk_buff **pskb,			 u16 src_port, u16 dst_port, u16 icmp_type,			 char *chain, char *rule, char *devname){	__u32 *opt = (__u32 *) ((*pskb)->nh.iph + 1);	int opti;	__u16 foff = ntohs((*pskb)->nh.iph->frag_off);	int protocol = (*pskb)->nh.iph->protocol;	printk(KERN_INFO "IP %s %s%s", chain, rule, devname);	switch (protocol) {	case IPPROTO_TCP:		printk(" TCP ");		break;	case IPPROTO_UDP:		printk(" UDP ");		break;	case IPPROTO_ICMP:		printk(" ICMP/%d ", icmp_type);		break;	default:		printk(" PROTO=%d ", protocol);		break;	};	print_ip((*pskb)->nh.iph->saddr);	if (protocol == IPPROTO_TCP || protocol == IPPROTO_UDP)		printk(":%hu", src_port);	printk(" ");	print_ip((*pskb)->nh.iph->daddr);	if (protocol == IPPROTO_TCP || protocol == IPPROTO_UDP)		printk(":%hu", dst_port);	printk(" L=%hu S=0x%2.2hX I=%hu FO=0x%4.4hX T=%hu",	       ntohs((*pskb)->nh.iph->tot_len),	       (*pskb)->nh.iph->tos,	       ntohs((*pskb)->nh.iph->id),	       foff & IP_OFFSET,	       (*pskb)->nh.iph->ttl);	if (foff & IP_DF)		printk(" DF=1");	if (foff & IP_MF)		printk(" MF=1");	for (opti = 0; opti < ((*pskb)->nh.iph->ihl - sizeof(struct iphdr) / 4); opti++)		printk(" O=0x%8.8X", *opt++);	printk("\n");}#endif/* *	Returns one of the generic firewall policies, like FW_ACCEPT. *	Also does accounting so you can feed it the accounting chain. * *	The modes is either IP_FW_MODE_FW (normal firewall mode), *	IP_FW_MODE_ACCT_IN or IP_FW_MODE_ACCT_OUT (accounting mode, *	steps through the entire chain and handles fragments *	differently), or IP_FW_MODE_CHK (handles user-level check, *	counters are not updated). */int ip_fw_chk(struct sk_buff **pskb,	      struct net_device *rif, __u16 *redirport,	      struct ip_fw *chain, int policy, int mode){	struct ip_fw *f;	__u32			src, dst;	__u16			src_port=0xFFFF, dst_port=0xFFFF, icmp_type=0xFF;	unsigned short		f_prt=0, prt;	char			notcpsyn=0, notcpack=0, match;	unsigned short		offset;	int			answer;	unsigned char		tosand, tosxor;	int			protocol;	/*	 *	If the chain is empty follow policy. The BSD one	 *	accepts anything giving you a time window while	 *	flushing and rebuilding the tables.	 */	/*	 *	This way we handle fragmented packets.	 *	we ignore all fragments but the first one	 *	so the whole packet can't be reassembled.	 *	This way we relay on the full info which	 *	stored only in first packet.	 *	 *	Note that this theoretically allows partial packet	 *	spoofing. Not very dangerous but paranoid people may	 *	wish to play with this. It also allows the so called	 *	"fragment bomb" denial of service attack on some types	 *	of system.	 */	offset = ntohs((*pskb)->nh.iph->frag_off) & IP_OFFSET;	protocol = (*pskb)->nh.iph->protocol;	/*	 *	Don't allow a fragment of TCP 8 bytes in. Nobody	 *	normal causes this. Its a cracker trying to break	 *	in by doing a flag overwrite to pass the direction	 *	checks.	 */	if (offset == 1 && protocol == IPPROTO_TCP)		return FW_BLOCK;	if (offset!=0 && !(mode & (IP_FW_MODE_ACCT_IN|IP_FW_MODE_ACCT_OUT)) &&		(protocol == IPPROTO_TCP ||		 protocol == IPPROTO_UDP ||		 protocol == IPPROTO_ICMP))		return FW_ACCEPT;	/*	 *	 Header fragment for TCP is too small to check the bits.	 */	if (protocol == IPPROTO_TCP &&	    ((*pskb)->nh.iph->ihl<<2)+16 > ntohs((*pskb)->nh.iph->tot_len))		return FW_BLOCK;	/*	 *	Too short.	 *	 *	But only too short for a packet with ports...	 */	else if ((ntohs((*pskb)->nh.iph->tot_len) <		  8 + ((*pskb)->nh.iph->ihl << 2)) &&		 (protocol == IPPROTO_TCP || protocol == IPPROTO_UDP))		return FW_BLOCK;	src = (*pskb)->nh.iph->saddr;	dst = (*pskb)->nh.iph->daddr;	/*	 *	If we got interface from which packet came	 *	we can use the address directly. This is unlike	 *	4.4BSD derived systems that have an address chain	 *	per device. We have a device per address with dummy	 *	devices instead.	 */	dprintf1("Packet ");	switch (protocol) {		case IPPROTO_TCP:			dprintf1("TCP ");			/* ports stay 0xFFFF if it is not the first fragment */			if (!offset) {				struct tcphdr tcph;				if (skb_copy_bits(*pskb,						  (*pskb)->nh.iph->ihl * 4,						  &tcph, sizeof(tcph)))					return FW_BLOCK;				src_port = ntohs(tcph.source);				dst_port = ntohs(tcph.dest);				if(!tcph.ack && !tcph.rst)					/* We do NOT have ACK, value TRUE */					notcpack = 1;				if(!tcph.syn || !notcpack)					/* We do NOT have SYN, value TRUE */					notcpsyn = 1;			}			prt = IP_FW_F_TCP;			break;		case IPPROTO_UDP:			dprintf1("UDP ");			/* ports stay 0xFFFF if it is not the first fragment */			if (!offset) {				struct udphdr udph;				if (skb_copy_bits(*pskb,						  (*pskb)->nh.iph->ihl * 4,						  &udph, sizeof(udph)))					return FW_BLOCK;				src_port = ntohs(udph.source);				dst_port = ntohs(udph.dest);			}			prt = IP_FW_F_UDP;			break;		case IPPROTO_ICMP:			/* icmp_type stays 255 if it is not the first fragment */			if (!offset) {				struct icmphdr icmph;				if (skb_copy_bits(*pskb,						  (*pskb)->nh.iph->ihl * 4,						  &icmph, sizeof(icmph)))					return FW_BLOCK;				icmp_type = (__u16) icmph.type;			}			dprintf2("ICMP:%d ", icmp_type);			prt = IP_FW_F_ICMP;			break;		default:			dprintf2("p=%d ", protocol);			prt = IP_FW_F_ALL;			break;	}#ifdef DEBUG_IP_FIREWALL	dprint_ip(src);	if (protocol == IPPROTO_TCP || protocol == IPPROTO_UDP)		/* This will print 65535 when it is not the first fragment! */		dprintf2(":%d ", src_port);	dprint_ip(dst);	if (protocol == IPPROTO_TCP || protocol == IPPROTO_UDP)		/* This will print 65535 when it is not the first fragment! */		dprintf2(":%d ", dst_port);	dprintf1("\n");#endif	if (mode == IP_FW_MODE_CHK)		READ_LOCK(&ip_fw_lock);	else		WRITE_LOCK(&ip_fw_lock);		for (f = chain; f; f = f->fw_next) {		/*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品一二三| 欧美夫妻性生活| 久久影院电视剧免费观看| 三级欧美在线一区| 在线看国产一区二区| 亚洲视频综合在线| 成人av高清在线| 欧美激情一二三区| 成人一区二区三区视频在线观看| 欧美大白屁股肥臀xxxxxx| 蜜芽一区二区三区| 日韩欧美第一区| 精品在线免费观看| www欧美成人18+| 国产成人精品亚洲777人妖 | 欧美一级欧美一级在线播放| 亚洲国产婷婷综合在线精品| 欧美色网一区二区| 五月婷婷久久综合| 欧美不卡123| 国产成人精品综合在线观看| 国产精品久久久久久久久晋中 | 色综合视频一区二区三区高清| 国产精品国产三级国产普通话三级 | 国产色婷婷亚洲99精品小说| 极品少妇xxxx精品少妇偷拍| 久久精品夜夜夜夜久久| 国产麻豆精品在线观看| 日本一区二区高清| 黄色日韩网站视频| 国产精品主播直播| 国产精品久久久久影院老司| 色av成人天堂桃色av| 日本道在线观看一区二区| 在线播放欧美女士性生活| 最新不卡av在线| 国产成人综合网站| 精品国产一区二区三区久久久蜜月| 亚洲成人激情社区| 在线中文字幕一区二区| 亚洲手机成人高清视频| aaa亚洲精品一二三区| 国产午夜精品一区二区三区视频| 麻豆免费看一区二区三区| 欧美日高清视频| 亚洲午夜影视影院在线观看| 色综合久久中文综合久久97| 综合精品久久久| 99视频超级精品| 亚洲欧洲av另类| 成人激情小说网站| 国产精品免费人成网站| www.一区二区| 国产精品久久久久aaaa樱花| 成人美女在线观看| 国产精品美女久久久久久久网站| 国产伦精一区二区三区| 国产亚洲欧美在线| 岛国一区二区三区| 亚洲视频一区在线| 欧美在线影院一区二区| 亚洲小说欧美激情另类| 91精品在线一区二区| 麻豆视频观看网址久久| 国产香蕉久久精品综合网| 成人午夜精品在线| 亚洲视频免费在线观看| 欧洲日韩一区二区三区| 午夜精品久久久久久久99水蜜桃| 88在线观看91蜜桃国自产| 久久成人久久爱| 国产调教视频一区| 91麻豆swag| 首页国产欧美久久| 久久久久久久久久久99999| 欧美一级爆毛片| 国产一区二区三区电影在线观看| 欧美激情一区二区三区四区| 色婷婷久久久亚洲一区二区三区 | 日韩女优毛片在线| 国产99精品在线观看| 亚洲乱码国产乱码精品精可以看 | 日韩欧美国产系列| 国产经典欧美精品| 一区二区在线观看视频| 欧美一级日韩一级| 成人app软件下载大全免费| 亚洲午夜电影在线观看| 精品国内二区三区| 色综合久久综合网97色综合| 麻豆精品国产传媒mv男同| 久久精品视频免费观看| 欧美中文字幕一二三区视频| 国产一区二区在线观看免费| 亚洲免费观看在线视频| 精品欧美一区二区三区精品久久| 成人av电影免费观看| 美女网站在线免费欧美精品| 中文字幕亚洲精品在线观看| 日韩一区二区精品在线观看| 成人av在线资源网| 蜜臀av一区二区在线观看| 成人精品一区二区三区中文字幕| 一区二区三区在线观看动漫 | 91黄色激情网站| 激情都市一区二区| 亚洲国产精品人人做人人爽| 国产视频911| 日韩午夜激情电影| 欧美揉bbbbb揉bbbbb| 国产jizzjizz一区二区| 日本视频在线一区| 一区二区三区欧美视频| 亚洲国产精品av| 日韩欧美在线不卡| 欧美三级电影精品| 91在线精品一区二区| 国产资源精品在线观看| 日韩国产在线一| 亚洲在线一区二区三区| ㊣最新国产の精品bt伙计久久| 日韩欧美国产一区二区三区| 欧美在线一区二区| 色婷婷综合五月| 91在线视频网址| 成人av电影在线网| 成人av电影在线观看| 国产一区二区三区精品欧美日韩一区二区三区 | 99久久综合国产精品| 成人永久aaa| 粉嫩av一区二区三区在线播放| 久久精品国产色蜜蜜麻豆| 日本大胆欧美人术艺术动态| 亚洲福利一区二区| 香港成人在线视频| 日日摸夜夜添夜夜添精品视频 | 国产**成人网毛片九色 | 成人黄色电影在线| av一区二区三区四区| 成人午夜看片网址| 不卡一区中文字幕| 99视频热这里只有精品免费| 91美女精品福利| 91丨九色丨蝌蚪丨老版| 色综合中文字幕| 色网综合在线观看| 欧美日韩成人激情| 日韩欧美国产午夜精品| 精品99999| 国产精品女上位| 亚洲精品一卡二卡| 天堂在线亚洲视频| 麻豆一区二区在线| 粉嫩13p一区二区三区| 99国产精品久久| 欧美在线啊v一区| 91精品国产手机| 久久综合色播五月| 国产精品成人免费| 五月激情六月综合| 久久99国产精品久久99| 成人看片黄a免费看在线| 色老汉一区二区三区| 欧美一区二区三区四区视频| 2021国产精品久久精品| 国产精品欧美一区二区三区| 亚洲精品国产精华液| 日本aⅴ免费视频一区二区三区 | 韩国精品主播一区二区在线观看 | 亚洲成人av一区二区| 日本美女一区二区三区视频| 精品一区二区三区免费毛片爱| 丰满放荡岳乱妇91ww| 欧美午夜影院一区| 精品福利av导航| 亚洲日本在线a| 捆绑调教美女网站视频一区| av在线不卡免费看| 日韩一区二区精品在线观看| 中文字幕不卡三区| 天堂影院一区二区| 成人免费高清视频| 欧美一区二区观看视频| 中文子幕无线码一区tr| 亚洲二区在线视频| 国产盗摄视频一区二区三区| 欧美性色欧美a在线播放| 久久精品一区四区| 偷拍亚洲欧洲综合| 北条麻妃国产九九精品视频| 91精品午夜视频| 日韩伦理av电影| 国产一区二区三区免费| 欧美日韩精品一区二区| 日韩一区欧美小说| 国产在线看一区| 欧美精品在线观看播放| 国产精品毛片高清在线完整版| 日韩高清不卡在线| 91热门视频在线观看|