Skip to contentSkip to conversation

Add arptables mangle module

PATCH In review Bart De Schuymer 2 participants 2 messages Jun 26, 2003

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

PATCH 1/1 Add arptables mangle module

Hello Dave,

This time without the added pln.
Note that the only publicly available arptables userspace tool that I know of is the one in my CVS, so there's no major risk of breaking anything.
The module could also be useful in 2.4, I'll make a patch if you want it in 2.4.

cheers,
Bart

net/ipv4/netfilter/Makefile renamed from net/ipv4/netfilter/Makefile.old +1 -0
@@ -79,6 +79,7 @@
 
 # generic ARP tables
 obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o
+obj-$(CONFIG_IP_NF_ARP_MANGLE) += arpt_mangle.o
 
 # just filtering instance of ARP tables for now
 obj-$(CONFIG_IP_NF_ARPFILTER) += arptable_filter.o
net/ipv4/netfilter/Kconfig renamed from net/ipv4/netfilter/Kconfig.old +7 -0
@@ -540,6 +540,13 @@
 	tristate "ARP packet filtering"
 	depends on IP_NF_ARPTABLES
 
+config IP_NF_ARP_MANGLE
+	tristate "ARP payload mangling"
+	depends on IP_NF_ARPTABLES
+	help
+	  Allows altering the ARP packet payload: source and destination
+	  hardware and network addresses.
+
 # Backwards compatibility modules: only if you don't build in the others.
 config IP_NF_COMPAT_IPCHAINS
 	tristate "ipchains (2.2-style) support"
net/ipv4/netfilter/arpt_mangle.c new file +101 -0

101 lines not on this page · raw message

include/linux/netfilter_arp/arpt_mangle.h new file +26 -0
@@ -0,0 +1,26 @@
+#ifndef _ARPT_MANGLE_H
+#define _ARPT_MANGLE_H
+#include <linux/netfilter_arp/arp_tables.h>
+
+#define ARPT_MANGLE_ADDR_LEN_MAX sizeof(struct in_addr)
+struct arpt_mangle
+{
+	char src_devaddr[ARPT_DEV_ADDR_LEN_MAX];
+	char tgt_devaddr[ARPT_DEV_ADDR_LEN_MAX];
+	union {
+		struct in_addr src_ip;
+	} u_s;
+	union {
+		struct in_addr tgt_ip;
+	} u_t;
+	u_int8_t flags;
+	int target;
+};
+
+#define ARPT_MANGLE_SDEV 0x01
+#define ARPT_MANGLE_TDEV 0x02
+#define ARPT_MANGLE_SIP 0x04
+#define ARPT_MANGLE_TIP 0x08
+#define ARPT_MANGLE_MASK 0x0f
+
+#endif /* _ARPT_MANGLE_H */
#1 lore raw

From: Bart De Schuymer <[email protected]>
Date: Thu, 26 Jun 2003 08:16:49 +0200

Note that the only publicly available arptables userspace tool that I know of is the one in my CVS, so there's no major risk of breaking anything.

I know that people have crafted their own private tools in order to use vanilla 2.4.x with certain IPVS configurations.

I don't think they'll be too happy if you change the API, at leas tin 2.4.x, for that reason.

The module could also be useful in 2.4, I'll make a patch if you want it in 2.4.

I agree, please do.