Skip to contentSkip to conversation

Add arptables mangle module

PATCH Applied Bart De Schuymer 2 participants 2 messages Jun 26, 2003 – Jun 27, 2003

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

PATCH 1/1 Add arptables mangle module

Hello Dave,

Here's the patch for 2.4.21

cheers,
Bart

net/ipv4/netfilter/Makefile renamed from net/ipv4/netfilter/Makefile.old +1 -0
@@ -100,6 +100,7 @@ obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt
 
 # 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/Config.in renamed from net/ipv4/netfilter/Config.in.old +3 -0
@@ -113,6 +113,9 @@ tristate 'ARP tables support' CONFIG_IP_
 if [ "$CONFIG_IP_NF_ARPTABLES" != "n" ]; then
   dep_tristate '  ARP packet filtering' CONFIG_IP_NF_ARPFILTER $CONFIG_IP_NF_ARPTABLES 
 fi
+if [ "$CONFIG_IP_NF_ARPTABLES" != "n" ]; then
+  dep_tristate '  ARP payload mangling' CONFIG_IP_NF_ARP_MANGLE $CONFIG_IP_NF_ARPTABLES
+fi
 
 # Backwards compatibility modules: only if you don't build in the others.
 if [ "$CONFIG_IP_NF_CONNTRACK" != "y" ]; then
Documentation/Configure.help renamed from Documentation/Configure.help.old +5 -0
@@ -3052,6 +3052,11 @@ CONFIG_IP6_NF_TARGET_MARK
   If you want to compile it as a module, say M here and read
   <file:Documentation/modules.txt>.  If unsure, say `N'.
 
+ARP payload mangling
+CONFIG_IP_NF_ARP_MANGLE
+  Allows altering the ARP packet payload: source and destination
+  hardware and network addresses.
+
 TCP Explicit Congestion Notification support
 CONFIG_INET_ECN
   Explicit Congestion Notification (ECN) allows routers to notify
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 */