Skip to contentSkip to conversation

new iptables modules (iprange, CLASSIFY, SAME, NETMAP)

PATCH Applied Harald Welte 2 participants 2 messages Aug 24, 2003 – Aug 25, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 new iptables modules (iprange, CLASSIFY, SAME, NETMAP)

Hi Dave!

The following patch against 2.6.0-test4 adds four more iptables modules. They are adding the following functionality
- iprange: matching against an arbitrary contiguous range of ip addresses
- CLASSIFY: setting skb->priority from iptables (so you can skip tc filter)
- NETMAP: SNAT a whole network 1:1 to another network
- SAME: tries to keep the assigned ip per client the same within an SNAT pool

Please apply, thanks!

include/linux/netfilter_ipv4/ipt_CLASSIFY.h +8 -0
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linuxppc25-030824-unclean-unexp-mirror-cosmetic/include/linux/netfilter_ipv4/ipt_CLASSIFY.h linuxppc25-030824-unclean-unexperimental-mirror-cosmetic/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
@@ -0,0 +1,8 @@
+#ifndef _IPT_CLASSIFY_H
+#define _IPT_CLASSIFY_H
+
+struct ipt_classify_target_info {
+	u_int32_t priority;
+};
+
+#endif /*_IPT_CLASSIFY_H */
include/linux/netfilter_ipv4/ipt_SAME.h +19 -0
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linuxppc25-030824-unclean-unexp-mirror-cosmetic/include/linux/netfilter_ipv4/ipt_SAME.h linuxppc25-030824-unclean-unexperimental-mirror-cosmetic/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -0,0 +1,19 @@
+#ifndef _IPT_SAME_H
+#define _IPT_SAME_H
+
+#define IPT_SAME_MAX_RANGE	10
+
+#define IPT_SAME_NODST		0x01
+
+struct ipt_same_info
+{
+	unsigned char info;
+	u_int32_t rangesize;
+	u_int32_t ipnum;
+	u_int32_t *iparray;
+
+	/* hangs off end. */
+	struct ip_nat_range range[IPT_SAME_MAX_RANGE];
+};
+
+#endif /*_IPT_SAME_H*/
include/linux/netfilter_ipv4/ipt_iprange.h +23 -0
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linuxppc25-030824-unclean-unexp-mirror-cosmetic/include/linux/netfilter_ipv4/ipt_iprange.h linuxppc25-030824-unclean-unexperimental-mirror-cosmetic/include/linux/netfilter_ipv4/ipt_iprange.h
@@ -0,0 +1,23 @@
+#ifndef _IPT_IPRANGE_H
+#define _IPT_IPRANGE_H
+
+#define IPRANGE_SRC		0x01	/* Match source IP address */
+#define IPRANGE_DST		0x02	/* Match destination IP address */
+#define IPRANGE_SRC_INV		0x10	/* Negate the condition */
+#define IPRANGE_DST_INV		0x20	/* Negate the condition */
+
+struct ipt_iprange {
+	/* Inclusive: network order. */
+	u_int32_t min_ip, max_ip;
+};
+
+struct ipt_iprange_info
+{
+	struct ipt_iprange src;
+	struct ipt_iprange dst;
+
+	/* Flags from above */
+	u_int8_t flags;
+};
+
+#endif /* _IPT_IPRANGE_H */
net/ipv4/netfilter/Kconfig +45 -0

63 lines not on this page · raw message

net/ipv4/netfilter/Makefile +4 -0
diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linuxppc25-030824-unclean-unexp-mirror-cosmetic/net/ipv4/netfilter/Makefile linuxppc25-030824-unclean-unexperimental-mirror-cosmetic/net/ipv4/netfilter/Makefile
@@ -44,6 +44,7 @@
 obj-$(CONFIG_IP_NF_MATCH_LIMIT) += ipt_limit.o
 obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o
 obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o
+obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o
 
 obj-$(CONFIG_IP_NF_MATCH_PKTTYPE) += ipt_pkttype.o
 obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o
@@ -73,6 +74,9 @@
 obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o
 obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
 obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
+obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
+obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o
+obj-$(CONFIG_IP_NF_TARGET_CLASSIFY) += ipt_CLASSIFY.o
 obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o
 obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
 obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o
net/ipv4/netfilter/ipt_CLASSIFY.c +86 -0

86 lines not on this page · raw message

net/ipv4/netfilter/ipt_NETMAP.c +112 -0

112 lines not on this page · raw message

net/ipv4/netfilter/ipt_SAME.c +206 -0

206 lines not on this page · raw message

net/ipv4/netfilter/ipt_iprange.c +97 -0

97 lines not on this page · raw message

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#1 lore raw
Quoted 7 lines · On Sun, 24 Aug 2003 16:38:28 +0200 Harald Welte <[email protected]> wrote:

The following patch against 2.6.0-test4 adds four more iptables modules. They are adding the following functionality
- iprange: matching against an arbitrary contiguous range of ip addresses
- CLASSIFY: setting skb->priority from iptables (so you can skip tc filter)
- NETMAP: SNAT a whole network 1:1 to another network
- SAME: tries to keep the assigned ip per client the same within an SNAT pool

Applied, thanks.