diff -urN linux-2.4.23.org/Documentation/Configure.help linux-2.4.23/Documentation/Configure.help --- linux-2.4.23.org/Documentation/Configure.help 2003-12-01 23:06:42.851544654 +0100 +++ linux-2.4.23/Documentation/Configure.help 2003-12-01 23:09:21.073624835 +0100 @@ -3549,6 +3549,14 @@ If unsure, say `N'. +IMQ target support +CONFIG_IP_NF_TARGET_IMQ + This option adds a `IMQ' target which is used to specify if and + to which imq device packets should get enqueued/dequeued. + + If you want to compile it as a module, say M here and read + . If unsure, say `N'. + MARK target support CONFIG_IP_NF_TARGET_MARK This option adds a `MARK' target, which allows you to create rules @@ -3870,6 +3878,14 @@ Not working as a module. +IMQ target support +CONFIG_IP6_NF_TARGET_IMQ + This option adds a `IMQ' target which is used to specify if and + to which imq device packets should get enqueued/dequeued. + + If you want to compile it as a module, say M here and read + . If unsure, say `N'. + MARK target support CONFIG_IP6_NF_TARGET_MARK This option adds a `MARK' target, which allows you to create rules diff -urN linux-2.4.23.org/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.4.23/include/linux/netfilter_ipv4/ipt_IMQ.h --- linux-2.4.23.org/include/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.4.23/include/linux/netfilter_ipv4/ipt_IMQ.h 2003-12-01 23:09:00.853831794 +0100 @@ -0,0 +1,8 @@ +#ifndef _IPT_IMQ_H +#define _IPT_IMQ_H + +struct ipt_imq_info { + unsigned int todev; /* target imq device */ +}; + +#endif /* _IPT_IMQ_H */ diff -urN linux-2.4.23.org/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.4.23/include/linux/netfilter_ipv6/ip6t_IMQ.h --- linux-2.4.23.org/include/linux/netfilter_ipv6/ip6t_IMQ.h 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.4.23/include/linux/netfilter_ipv6/ip6t_IMQ.h 2003-12-01 23:09:20.860669143 +0100 @@ -0,0 +1,8 @@ +#ifndef _IP6T_IMQ_H +#define _IP6T_IMQ_H + +struct ip6t_imq_info { + unsigned int todev; /* target imq device */ +}; + +#endif /* _IP6T_IMQ_H */ diff -urN linux-2.4.23.org/net/ipv4/netfilter/Config.in linux-2.4.23/net/ipv4/netfilter/Config.in --- linux-2.4.23.org/net/ipv4/netfilter/Config.in 2003-12-01 23:04:11.215094025 +0100 +++ linux-2.4.23/net/ipv4/netfilter/Config.in 2003-12-01 23:09:00.904821185 +0100 @@ -213,6 +213,7 @@ dep_tristate ' DSCP target support' CONFIG_IP_NF_TARGET_DSCP $CONFIG_IP_NF_MANGLE dep_tristate ' MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE + dep_tristate ' IMQ target support' CONFIG_IP_NF_TARGET_IMQ $CONFIG_IP_NF_MANGLE dep_tristate ' ROUTE target support' CONFIG_IP_NF_TARGET_ROUTE $CONFIG_IP_NF_MANGLE dep_tristate ' IPMARK target support' CONFIG_IP_NF_TARGET_IPMARK $CONFIG_IP_NF_MANGLE diff -urN linux-2.4.23.org/net/ipv4/netfilter/ipt_IMQ.c linux-2.4.23/net/ipv4/netfilter/ipt_IMQ.c --- linux-2.4.23.org/net/ipv4/netfilter/ipt_IMQ.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.4.23/net/ipv4/netfilter/ipt_IMQ.c 2003-12-01 23:09:00.855831378 +0100 @@ -0,0 +1,78 @@ +/* This target marks packets to be enqueued to an imq device */ +#include +#include +#include +#include +#include + +static unsigned int imq_target(struct sk_buff **pskb, + unsigned int hooknum, + const struct net_device *in, + const struct net_device *out, + const void *targinfo, + void *userinfo) +{ + struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo; + + (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE; + (*pskb)->nfcache |= NFC_ALTERED; + + return IPT_CONTINUE; +} + +static int imq_checkentry(const char *tablename, + const struct ipt_entry *e, + void *targinfo, + unsigned int targinfosize, + unsigned int hook_mask) +{ + struct ipt_imq_info *mr; + + if (targinfosize != IPT_ALIGN(sizeof(struct ipt_imq_info))) { + printk(KERN_WARNING "IMQ: invalid targinfosize\n"); + return 0; + } + mr = (struct ipt_imq_info*)targinfo; + + if (strcmp(tablename, "mangle") != 0) { + printk(KERN_WARNING + "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n", + tablename); + return 0; + } + + if (mr->todev > IMQ_MAX_DEVS) { + printk(KERN_WARNING + "IMQ: invalid device specified, highest is %u\n", + IMQ_MAX_DEVS); + return 0; + } + + return 1; +} + +static struct ipt_target ipt_imq_reg = { + { NULL, NULL}, + "IMQ", + imq_target, + imq_checkentry, + NULL, + THIS_MODULE +}; + +static int __init init(void) +{ + if (ipt_register_target(&ipt_imq_reg)) + return -EINVAL; + + return 0; +} + +static void __exit fini(void) +{ + ipt_unregister_target(&ipt_imq_reg); +} + +module_init(init); +module_exit(fini); +MODULE_LICENSE("GPL"); diff -urN linux-2.4.23.org/net/ipv4/netfilter/Makefile linux-2.4.23/net/ipv4/netfilter/Makefile --- linux-2.4.23.org/net/ipv4/netfilter/Makefile 2003-12-01 23:04:11.173102762 +0100 +++ linux-2.4.23/net/ipv4/netfilter/Makefile 2003-12-01 23:09:01.130774173 +0100 @@ -189,6 +189,7 @@ obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o obj-$(CONFIG_IP_NF_TARGET_DSCP) += ipt_DSCP.o obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o +obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o obj-$(CONFIG_IP_NF_TARGET_IPMARK) += ipt_IPMARK.o obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o diff -urN linux-2.4.23.org/net/ipv6/netfilter/Config.in linux-2.4.23/net/ipv6/netfilter/Config.in --- linux-2.4.23.org/net/ipv6/netfilter/Config.in 2003-12-01 23:04:12.073915340 +0100 +++ linux-2.4.23/net/ipv6/netfilter/Config.in 2003-12-01 23:09:20.915657702 +0100 @@ -83,6 +83,7 @@ if [ "$CONFIG_IP6_NF_MANGLE" != "n" ]; then # dep_tristate ' TOS target support' CONFIG_IP6_NF_TARGET_TOS $CONFIG_IP_NF_MANGLE dep_tristate ' MARK target support' CONFIG_IP6_NF_TARGET_MARK $CONFIG_IP6_NF_MANGLE + dep_tristate ' IMQ target support' CONFIG_IP6_NF_TARGET_IMQ $CONFIG_IP6_NF_MANGLE dep_mbool ' ROUTE target support' CONFIG_IP6_NF_TARGET_ROUTE $CONFIG_IP6_NF_MANGLE fi #dep_tristate ' LOG target support' CONFIG_IP6_NF_TARGET_LOG $CONFIG_IP6_NF_IPTABLES diff -urN linux-2.4.23.org/net/ipv6/netfilter/ip6t_IMQ.c linux-2.4.23/net/ipv6/netfilter/ip6t_IMQ.c --- linux-2.4.23.org/net/ipv6/netfilter/ip6t_IMQ.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.4.23/net/ipv6/netfilter/ip6t_IMQ.c 2003-12-01 23:09:20.862668727 +0100 @@ -0,0 +1,78 @@ +/* This target marks packets to be enqueued to an imq device */ +#include +#include +#include +#include +#include + +static unsigned int imq_target(struct sk_buff **pskb, + unsigned int hooknum, + const struct net_device *in, + const struct net_device *out, + const void *targinfo, + void *userinfo) +{ + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo; + + (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE; + (*pskb)->nfcache |= NFC_ALTERED; + + return IP6T_CONTINUE; +} + +static int imq_checkentry(const char *tablename, + const struct ip6t_entry *e, + void *targinfo, + unsigned int targinfosize, + unsigned int hook_mask) +{ + struct ip6t_imq_info *mr; + + if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_imq_info))) { + printk(KERN_WARNING "IMQ: invalid targinfosize\n"); + return 0; + } + mr = (struct ip6t_imq_info*)targinfo; + + if (strcmp(tablename, "mangle") != 0) { + printk(KERN_WARNING + "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n", + tablename); + return 0; + } + + if (mr->todev > IMQ_MAX_DEVS) { + printk(KERN_WARNING + "IMQ: invalid device specified, highest is %u\n", + IMQ_MAX_DEVS); + return 0; + } + + return 1; +} + +static struct ip6t_target ip6t_imq_reg = { + { NULL, NULL}, + "IMQ", + imq_target, + imq_checkentry, + NULL, + THIS_MODULE +}; + +static int __init init(void) +{ + if (ip6t_register_target(&ip6t_imq_reg)) + return -EINVAL; + + return 0; +} + +static void __exit fini(void) +{ + ip6t_unregister_target(&ip6t_imq_reg); +} + +module_init(init); +module_exit(fini); +MODULE_LICENSE("GPL"); diff -urN linux-2.4.23.org/net/ipv6/netfilter/Makefile linux-2.4.23/net/ipv6/netfilter/Makefile --- linux-2.4.23.org/net/ipv6/netfilter/Makefile 2003-12-01 23:04:12.067916588 +0100 +++ linux-2.4.23/net/ipv6/netfilter/Makefile 2003-12-01 23:09:21.138611314 +0100 @@ -30,6 +30,7 @@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o +obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o obj-$(CONFIG_IP6_NF_TARGET_ROUTE) += ip6t_ROUTE.o obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o