Skip to contentSkip to conversation

netfilter: major amanda helper update

PATCH Applied Harald Welte 2 participants 2 messages Nov 30, 2003 – Dec 2, 2003

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

PATCH 1/1 netfilter: major amanda helper update

Hi Dave!

This mail contains the third netfilter patch, please apply.

Author: Patrick McHardy <[email protected]>

Fix various issues with the amanda conntrack+NAT helpers

ip_conntrack_amanda:
- udp checksum checked even if not set
- memory not validated to be inside packet at all or validated like
this: if (*data and data < data_limit)
- would create expectation with port 0 which makes nat-helper throw away packet (which makes exploiting the race-condition trivial even on UP)
- expectation had no mask.src.* set so connections were accepted from anywhere
- helper_unregister called after failed helper_register

ip_nat_amanda:
- drops packet if amanda_data_fixup fails without clearing the offset field in the expectation which is used as a flag to indicate that the current packet needs mangling. Problem arises from the fact that the conntrack helper creates multiple expectations at once and even if it clears the offset field for the current expectation the following expectations will not have it cleared and will mangle the next packet they see.
- same unregister after failed register problem

include/linux/netfilter_ipv4/ip_conntrack_amanda.h +2 -19
diff -Nru a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h b/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
@@ -2,28 +2,11 @@
 #define _IP_CONNTRACK_AMANDA_H
 /* AMANDA tracking. */
 
-#ifdef __KERNEL__
-
-#include <linux/netfilter_ipv4/lockhelp.h>
-
-/* Protects amanda part of conntracks */
-DECLARE_LOCK_EXTERN(ip_amanda_lock);
-
-#endif
-
-struct conn {
-	char* match;
-	int matchlen;
-};
-
-#define NUM_MSGS 	3
-
-
 struct ip_ct_amanda_expect
 {
 	u_int16_t port;		/* port number of this expectation */
-	u_int16_t offset;	/* offset of the port specification in ctrl packet */
-	u_int16_t len;		/* the length of the port number specification */
+	u_int16_t offset;	/* offset of port in ctrl packet */
+	u_int16_t len;		/* length of the port number string */
 };
 
 #endif /* _IP_CONNTRACK_AMANDA_H */
net/ipv4/netfilter/ip_conntrack_amanda.c +57 -148

269 lines not on this page · raw message

net/ipv4/netfilter/ip_nat_amanda.c +42 -120

254 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