Ticket #157: 619-netfilter_classify.patch
| File 619-netfilter_classify.patch, 5.0 kB (added by greve@fsfeurope.org, 2 years ago) |
|---|
-
linux-2.4.32/Documentation/Configure.help
old new 3251 3251 If you want to compile it as a module, say M here and read 3252 3252 <file:Documentation/modules.txt>. If unsure, say `N'. 3253 3253 3254 CLASSIFY target support 3255 CONFIG_IP_NF_TARGET_CLASSIFY 3256 This option adds a `CLASSIFY' target, which enables the user to set 3257 the priority of a packet. Some qdiscs can use this value for classification, 3258 among these are: 3259 3260 atm, cbq, dsmark, pfifo_fast, htb, prio 3261 3262 If you want to compile it as a module, say M here and read 3263 Documentation/modules.txt. If unsure, say `N'. 3264 3254 3265 IP set support 3255 3266 CONFIG_IP_NF_SET 3256 3267 This option adds IP set support to the kernel. -
linux-2.4.32/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
old new 1 #ifndef _IPT_CLASSIFY_H 2 #define _IPT_CLASSIFY_H 3 4 struct ipt_classify_target_info { 5 u_int32_t priority; 6 }; 7 8 #endif /*_IPT_CLASSIFY_H */ -
linux-2.4.32/net/ipv4/netfilter/Config.in
old new 172 172 dep_tristate ' DSCP target support' CONFIG_IP_NF_TARGET_DSCP $CONFIG_IP_NF_MANGLE 173 173 174 174 dep_tristate ' MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE 175 dep_tristate ' CLASSIFY target support (EXPERIMENTAL)' CONFIG_IP_NF_TARGET_CLASSIFY $CONFIG_IP_NF_MANGLE 175 176 dep_tristate ' IMQ target support' CONFIG_IP_NF_TARGET_IMQ $CONFIG_IP_NF_MANGLE 176 177 fi 177 178 if [ "$CONFIG_IP_NF_CONNTRACK_MARK" != "n" ]; then -
linux-2.4.32/net/ipv4/netfilter/ipt_CLASSIFY.c
old new 1 /* 2 * This is a module which is used for setting the skb->priority field 3 * of an skb for qdisc classification. 4 */ 5 6 #include <linux/module.h> 7 #include <linux/skbuff.h> 8 #include <linux/ip.h> 9 #include <net/checksum.h> 10 11 #include <linux/netfilter_ipv4/ip_tables.h> 12 #include <linux/netfilter_ipv4/ipt_CLASSIFY.h> 13 14 MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>"); 15 MODULE_LICENSE("GPL"); 16 MODULE_DESCRIPTION("iptables qdisc classification target module"); 17 18 static unsigned int 19 target(struct sk_buff **pskb, 20 unsigned int hooknum, 21 const struct net_device *in, 22 const struct net_device *out, 23 const void *targinfo, 24 void *userinfo) 25 { 26 const struct ipt_classify_target_info *clinfo = targinfo; 27 28 if((*pskb)->priority != clinfo->priority) { 29 (*pskb)->priority = clinfo->priority; 30 (*pskb)->nfcache |= NFC_ALTERED; 31 } 32 33 return IPT_CONTINUE; 34 } 35 36 static int 37 checkentry(const char *tablename, 38 const struct ipt_entry *e, 39 void *targinfo, 40 unsigned int targinfosize, 41 unsigned int hook_mask) 42 { 43 if (targinfosize != IPT_ALIGN(sizeof(struct ipt_classify_target_info))){ 44 printk(KERN_ERR "CLASSIFY: invalid size (%u != %u).\n", 45 targinfosize, 46 IPT_ALIGN(sizeof(struct ipt_classify_target_info))); 47 return 0; 48 } 49 50 if (hook_mask & ~(1 << NF_IP_POST_ROUTING)) { 51 printk(KERN_ERR "CLASSIFY: only valid in POST_ROUTING.\n"); 52 return 0; 53 } 54 55 if (strcmp(tablename, "mangle") != 0) { 56 printk(KERN_WARNING "CLASSIFY: can only be called from " 57 "\"mangle\" table, not \"%s\".\n", 58 tablename); 59 return 0; 60 } 61 62 return 1; 63 } 64 65 static struct ipt_target ipt_classify_reg 66 = { { NULL, NULL }, "CLASSIFY", target, checkentry, NULL, THIS_MODULE }; 67 68 static int __init init(void) 69 { 70 if (ipt_register_target(&ipt_classify_reg)) 71 return -EINVAL; 72 73 return 0; 74 } 75 76 static void __exit fini(void) 77 { 78 ipt_unregister_target(&ipt_classify_reg); 79 } 80 81 module_init(init); 82 module_exit(fini); -
linux-2.4.32/net/ipv4/netfilter/Makefile
old new 134 134 135 135 # targets 136 136 obj-$(CONFIG_IP_NF_TARGET_REJECT) += ipt_REJECT.o 137 obj-$(CONFIG_IP_NF_TARGET_CLASSIFY) += ipt_CLASSIFY.o 137 138 obj-$(CONFIG_IP_NF_TARGET_MIRROR) += ipt_MIRROR.o 138 139 obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TOS.o 139 140 obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o


