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

📄 iptables.diff

📁 一个可以实现MPLS实验的linux源代码.你不仅可以实现单层标签的转发,还可以实现2个标签的实验,很好的.
💻 DIFF
📖 第 1 页 / 共 2 页
字号:
++#define MPLS_NUM_OPS		8++#define MPLS_LINUX_VERSION	0x01090500++#define	MPLS_GRP_ILM	1+#define	MPLS_GRP_NHLFE	2+#define	MPLS_GRP_XC	4+#define	MPLS_GRP_LABELSPACE 8++#define MPLS_IPV4_EXPLICIT_NULL	0       /* only valid as sole label stack entry+					   Pop label and send to IPv4 stack */+#define MPLS_ROUTER_ALERT	1       /* anywhere except bottom, packet it is+					   forwared to a software module+					   determined by the next label,+					   if the packet is forwarded, push this+					   label back on */+#define MPLS_IPV6_EXPLICIT_NULL	2       /* only valid as sole label stack entry+					   Pop label and send to IPv6 stack */+#define MPLS_IMPLICIT_NULL	3       /* a LIB with this, signifies to pop+					   the next label and use that */++#define MPLS_CHANGE_MTU		0x01+#define MPLS_CHANGE_PROP_TTL	0x02+#define MPLS_CHANGE_INSTR	0x04+#define MPLS_CHANGE_PROTO	0x10++enum mpls_dir {+	MPLS_IN = 0x10,+	MPLS_OUT = 0x20+};++enum mpls_opcode_enum {+	MPLS_OP_NOP = 0x00,+	MPLS_OP_POP,+	MPLS_OP_PEEK,+	MPLS_OP_PUSH,+	MPLS_OP_DLV,+	MPLS_OP_FWD,+	MPLS_OP_NF_FWD,+	MPLS_OP_DS_FWD,+	MPLS_OP_EXP_FWD,+	MPLS_OP_SET,+	MPLS_OP_SET_RX,+	MPLS_OP_SET_TC,+	MPLS_OP_SET_DS,+	MPLS_OP_SET_EXP,+	MPLS_OP_EXP2TC,+	MPLS_OP_EXP2DS,+	MPLS_OP_TC2EXP,+	MPLS_OP_DS2EXP,+	MPLS_OP_NF2EXP,+	MPLS_OP_SET_NF,+	MPLS_OP_MAX+};++enum mpls_label_type_enum {+	MPLS_LABEL_GEN = 1,+	MPLS_LABEL_ATM,+	MPLS_LABEL_FR,+	MPLS_LABEL_KEY+};++struct mpls_label_atm {+	u_int16_t  mla_vpi;+	u_int16_t  mla_vci;+};++struct mpls_label {+	enum mpls_label_type_enum ml_type;+	union {+		u_int32_t ml_key;+		u_int32_t ml_gen;+		u_int32_t ml_fr;+		struct mpls_label_atm ml_atm;+	} u;+	int ml_index;+};++struct mpls_in_label_req {+	unsigned int      mil_proto;+	struct mpls_label mil_label;+	unsigned char     mil_change_flag;+};++#define MPLS_LABELSPACE_MAX	255++struct mpls_labelspace_req {+	int mls_ifindex;                  /* Index to the MPLS-enab. interface*/+	int mls_labelspace;               /* Labelspace IN/SET -- OUT/GET     */+};++struct mpls_nexthop_info {+	unsigned int    mni_if;+	struct sockaddr mni_addr;+};++struct mpls_out_label_req {+	struct mpls_label mol_label;+	u_int32_t         mol_mtu;+	int8_t            mol_propagate_ttl;+	unsigned char     mol_change_flag;+};++struct mpls_netfilter_target_info {+        u_int32_t key;++	/* only used by the netfilter kernel modules */+        void *nhlfe;+        void *proto;+};++struct mpls_xconnect_req {+	struct mpls_label mx_in;+	struct mpls_label mx_out;+};++struct mpls_tunnel_req {+	char mt_ifname[IFNAMSIZ];+	unsigned int mt_nhlfe_key;+};++#define MPLS_NFMARK_NUM 64++struct mpls_nfmark_fwd {+	unsigned int nf_key[MPLS_NFMARK_NUM];+	unsigned short nf_mask;+};++#define MPLS_DSMARK_NUM 64++struct mpls_dsmark_fwd {+	unsigned int df_key[MPLS_DSMARK_NUM];+	unsigned char df_mask;+};++#define MPLS_TCINDEX_NUM 64++struct mpls_tcindex_fwd {+	unsigned int tc_key[MPLS_TCINDEX_NUM];+	unsigned short tc_mask;+};++#define MPLS_EXP_NUM 8++struct mpls_exp_fwd {+	unsigned int ef_key[MPLS_EXP_NUM];+};++struct mpls_exp2tcindex {+	unsigned short e2t[MPLS_EXP_NUM];+};++struct mpls_exp2dsmark {+	unsigned char e2d[MPLS_EXP_NUM];+};++struct mpls_tcindex2exp {+	unsigned char t2e_mask;+	unsigned char t2e[MPLS_TCINDEX_NUM];+};++struct mpls_dsmark2exp {+	unsigned char d2e_mask;+	unsigned char d2e[MPLS_DSMARK_NUM];+};++struct mpls_nfmark2exp {+	unsigned char n2e_mask;+	unsigned char n2e[MPLS_NFMARK_NUM];+};++struct mpls_instr_elem {+	unsigned short mir_opcode;+	unsigned char mir_direction;+	union {+		struct mpls_label        push;+		struct mpls_label        fwd;+		struct mpls_nfmark_fwd   nf_fwd;+		struct mpls_dsmark_fwd   ds_fwd;+		struct mpls_exp_fwd      exp_fwd;+		struct mpls_nexthop_info set;+		unsigned int             set_rx;+		unsigned short           set_tc;+		unsigned short           set_ds;+		unsigned char            set_exp;+		struct mpls_exp2tcindex  exp2tc;+		struct mpls_exp2dsmark   exp2ds;+		struct mpls_tcindex2exp  tc2exp;+		struct mpls_dsmark2exp   ds2exp;+		struct mpls_nfmark2exp   nf2exp;+		unsigned long            set_nf;+	} mir_data;+};++/* Standard shortcuts */+#define mir_push       mir_data.push+#define mir_fwd        mir_data.fwd+#define mir_nf_fwd     mir_data.nf_fwd+#define mir_ds_fwd     mir_data.ds_fwd+#define mir_exp_fwd    mir_data.exp_fwd+#define mir_set        mir_data.set+#define mir_set_rx     mir_data.set_rx+#define mir_set_tc     mir_data.set_tc+#define mir_set_tx     mir_data.set_tx+#define mir_set_ds     mir_data.set_ds+#define mir_set_exp    mir_data.set_exp+#define mir_set_nf     mir_data.set_nf+#define mir_exp2tc     mir_data.exp2tc+#define mir_exp2ds     mir_data.exp2ds+#define mir_tc2exp     mir_data.tc2exp+#define mir_ds2exp     mir_data.ds2exp+#define mir_nf2exp     mir_data.nf2exp++struct mpls_instr_req {+	struct mpls_instr_elem       mir_instr[MPLS_NUM_OPS];+	unsigned char                mir_instr_length;+	unsigned char                mir_direction;+	int                          mir_index;+	struct mpls_label            mir_label;+};++#endifdiff -uNr iptables/include/linux/netfilter_ipv4/ipt_shim.h iptables-mpls/include/linux/netfilter_ipv4/ipt_shim.h--- iptables/include/linux/netfilter_ipv4/ipt_shim.h	1969-12-31 18:00:00.000000000 -0600+++ iptables-mpls/include/linux/netfilter_ipv4/ipt_shim.h	2005-12-14 21:11:32.000000000 -0600@@ -0,0 +1,11 @@+#ifndef _IPT_SHIM_H_target+#define _IPT_SHIM_H_target++#include <net/shim.h>++struct ipt_shim_target_info {+	struct rtshim shim;+	struct shim_blk *sblk;+};++#endif /*_IPT_SHIM_H_target*/diff -uNr iptables/include/linux/netfilter_ipv6/ip6t_shim.h iptables-mpls/include/linux/netfilter_ipv6/ip6t_shim.h--- iptables/include/linux/netfilter_ipv6/ip6t_shim.h	1969-12-31 18:00:00.000000000 -0600+++ iptables-mpls/include/linux/netfilter_ipv6/ip6t_shim.h	2005-12-14 21:11:32.000000000 -0600@@ -0,0 +1,11 @@+#ifndef _IP6T_SHIM_H_target+#define _IP6T_SHIM_H_target++#include <net/shim.h>++struct ip6t_shim_target_info {+	struct rtshim shim;+	struct shim_blk *sblk;+};++#endif /*_IP6T_SHIM_H_target*/diff -uNr iptables/iptables.c iptables-mpls/iptables.c--- iptables/iptables.c	2005-10-14 23:36:45.000000000 -0500+++ iptables-mpls/iptables.c	2005-12-14 21:11:30.000000000 -0600@@ -39,6 +39,7 @@ #include <iptables.h> #include <fcntl.h> #include <sys/wait.h>+#include <linux/mpls.h>  #ifndef TRUE #define TRUE 1@@ -2107,10 +2108,19 @@  		case 'V': 			if (invert)-				printf("Not %s ;-)\n", program_version);+				printf("Not %s mpls-linux %d.%d%d%d ;-)\n",+					program_version,+					(MPLS_LINUX_VERSION >> 24) & 0xFF,+					(MPLS_LINUX_VERSION >> 16) & 0xFF,+					(MPLS_LINUX_VERSION >> 8) & 0xFF,+					(MPLS_LINUX_VERSION) & 0xFF); 			else-				printf("%s v%s\n",-				       program_name, program_version);+				printf("%s v%s mpls-linux %d.%d%d%d\n",+					program_name, program_version,+					(MPLS_LINUX_VERSION >> 24) & 0xFF,+					(MPLS_LINUX_VERSION >> 16) & 0xFF,+					(MPLS_LINUX_VERSION >> 8) & 0xFF,+					(MPLS_LINUX_VERSION) & 0xFF); 			exit(0);  		case '0':diff -uNr iptables/redhat/iptables.spec iptables-mpls/redhat/iptables.spec--- iptables/redhat/iptables.spec	2005-10-14 23:36:45.000000000 -0500+++ iptables-mpls/redhat/iptables.spec	2005-12-14 21:11:30.000000000 -0600@@ -1,11 +1,11 @@ %define build_devel 1 %define linux_header 0-%define epoch %(date '+%s')+%define subver %([ ${MPLSVER}"x" != "x" ] && echo ${MPLSVER} || echo 0.`date '+%s'`)  Name: iptables Summary: Tools for managing Linux kernel packet filtering capabilities. Version: 1.3.0-Release: 2_%{epoch}+Release: 2_mpls_%{subver} Source: http://www.netfilter.org/%{name}-%{version}.tar.bz2 Source1: iptables.init Source2: iptables-config

⌨️ 快捷键说明

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