Removed SIP connection tracking helper, licence unclear, unresolved symbols

SVN-Revision: 3292
master
Florian Fainelli 19 years ago
parent 45f64e34f3
commit 3b8e92c0b4
  1. 2
      openwrt/target/linux/ar531x-2.4/config
  2. 2
      openwrt/target/linux/ar7-2.4/config
  3. 2
      openwrt/target/linux/brcm-2.4/config
  4. 66
      openwrt/target/linux/generic-2.4/patches/613-netfilter_nat_h323.patch
  5. 1254
      openwrt/target/linux/generic-2.4/patches/613-netfilter_nat_sip.patch
  6. 935
      openwrt/target/linux/generic-2.4/patches/614-netfilter_nat_rtsp.patch
  7. 58
      openwrt/target/linux/generic-2.4/patches/615-netfilter_nat_mms.patch
  8. 0
      openwrt/target/linux/generic-2.4/patches/617-netfilter_time.patch
  9. 0
      openwrt/target/linux/generic-2.4/patches/618-netfilter_multiport_backport.patch
  10. 1
      openwrt/target/linux/package/Makefile
  11. 2
      openwrt/target/linux/x86-2.4/config

@ -345,7 +345,6 @@ CONFIG_IP_NF_CT_ACCT=m
CONFIG_IP_NF_MATCH_CONNBYTES=m
CONFIG_IP_NF_CT_PROTO_GRE=m
CONFIG_IP_NF_PPTP=m
CONFIG_IP_NF_SIP=m
CONFIG_IP_NF_H323=m
CONFIG_IP_NF_MMS=m
CONFIG_IP_NF_RTSP=m
@ -399,7 +398,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_IP_NF_TARGET_NETMAP=m
CONFIG_IP_NF_NAT_PPTP=m
CONFIG_IP_NF_NAT_PROTO_GRE=m
CONFIG_IP_NF_NAT_SIP=m
CONFIG_IP_NF_NAT_H323=m
CONFIG_IP_NF_NAT_MMS=m
CONFIG_IP_NF_NAT_RTSP=m

@ -347,7 +347,6 @@ CONFIG_IP_NF_CT_ACCT=m
CONFIG_IP_NF_MATCH_CONNBYTES=m
CONFIG_IP_NF_CT_PROTO_GRE=m
CONFIG_IP_NF_PPTP=m
CONFIG_IP_NF_SIP=m
CONFIG_IP_NF_H323=m
CONFIG_IP_NF_MMS=m
CONFIG_IP_NF_RTSP=m
@ -401,7 +400,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_IP_NF_TARGET_NETMAP=m
CONFIG_IP_NF_NAT_PPTP=m
CONFIG_IP_NF_NAT_PROTO_GRE=m
CONFIG_IP_NF_NAT_SIP=m
CONFIG_IP_NF_NAT_H323=m
CONFIG_IP_NF_NAT_MMS=m
CONFIG_IP_NF_NAT_RTSP=m

@ -353,7 +353,6 @@ CONFIG_IP_NF_CT_ACCT=m
CONFIG_IP_NF_MATCH_CONNBYTES=m
CONFIG_IP_NF_CT_PROTO_GRE=m
CONFIG_IP_NF_PPTP=m
CONFIG_IP_NF_SIP=m
CONFIG_IP_NF_H323=m
CONFIG_IP_NF_MMS=m
CONFIG_IP_NF_RTSP=m
@ -407,7 +406,6 @@ CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_IP_NF_TARGET_NETMAP=m
CONFIG_IP_NF_NAT_PPTP=m
CONFIG_IP_NF_NAT_PROTO_GRE=m
CONFIG_IP_NF_NAT_SIP=m
CONFIG_IP_NF_NAT_H323=m
CONFIG_IP_NF_NAT_MMS=m
CONFIG_IP_NF_NAT_RTSP=m

@ -1,16 +1,16 @@
diff -urN linux-2.4.32/net/ipv4/netfilter/Config.in linux-2.4.32/net/ipv4/netfilter/Config.in
--- linux-2.4.32/net/ipv4/netfilter/Config.in 2005-12-12 11:13:17.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/Config.in 2005-12-12 11:18:47.000000000 +0100
@@ -16,6 +16,7 @@
diff -urN linux-2.4.32/net/ipv4/netfilter/Config.in linux-2.4.32.new/net/ipv4/netfilter/Config.in
--- linux-2.4.32/net/ipv4/netfilter/Config.in 2006-03-01 00:49:36.652505800 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/Config.in 2006-03-01 00:50:18.692114808 +0100
@@ -15,6 +15,7 @@
dep_tristate ' Connection byte counter support' CONFIG_IP_NF_MATCH_CONNBYTES $CONFIG_IP_NF_CT_ACCT $CONFIG_IP_NF_CONNTRACK $CONFIG_IP_NF_IPTABLES
dep_tristate ' GRE protocol support' CONFIG_IP_NF_CT_PROTO_GRE $CONFIG_IP_NF_CONNTRACK
dep_tristate ' PPTP protocol support' CONFIG_IP_NF_PPTP $CONFIG_IP_NF_CT_PROTO_GRE
dep_tristate ' SIP protocol support' CONFIG_IP_NF_SIP $CONFIG_IP_NF_CONNTRACK
+ dep_tristate ' H.323 (netmeeting) support' CONFIG_IP_NF_H323 $CONFIG_IP_NF_CONNTRACK
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
@@ -112,6 +113,13 @@
define_tristate CONFIG_IP_NF_NAT_SIP $CONFIG_IP_NF_NAT
@@ -111,6 +112,13 @@
define_tristate CONFIG_IP_NF_NAT_AMANDA $CONFIG_IP_NF_NAT
fi
fi
+ if [ "$CONFIG_IP_NF_H323" = "m" ]; then
@ -20,15 +20,15 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/Config.in linux-2.4.32/net/ipv4/netfil
+ define_tristate CONFIG_IP_NF_NAT_H323 $CONFIG_IP_NF_NAT
+ fi
+ fi
if [ "$CONFIG_IP_NF_AMANDA" = "m" ]; then
define_tristate CONFIG_IP_NF_NAT_AMANDA m
else
diff -urN linux-2.4.32/net/ipv4/netfilter/Makefile linux-2.4.32/net/ipv4/netfilter/Makefile
--- linux-2.4.32/net/ipv4/netfilter/Makefile 2005-12-12 11:13:17.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/Makefile 2005-12-12 11:17:37.000000000 +0100
@@ -57,6 +57,10 @@
ifdef CONFIG_IP_NF_NAT_SIP
export-objs += ip_conntrack_sip.o
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
dep_tristate ' Basic SNMP-ALG support (EXPERIMENTAL)' CONFIG_IP_NF_NAT_SNMP_BASIC $CONFIG_IP_NF_NAT
fi
diff -urN linux-2.4.32/net/ipv4/netfilter/Makefile linux-2.4.32.new/net/ipv4/netfilter/Makefile
--- linux-2.4.32/net/ipv4/netfilter/Makefile 2006-03-01 00:49:36.654505496 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/Makefile 2006-03-01 00:50:18.693114656 +0100
@@ -53,6 +53,10 @@
ifdef CONFIG_IP_NF_NAT_PPTP
export-objs += ip_conntrack_pptp.o
endif
+obj-$(CONFIG_IP_NF_H323) += ip_conntrack_h323.o
+ifdef CONFIG_IP_NF_NAT_H323
@ -37,17 +37,17 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/Makefile linux-2.4.32/net/ipv4/netfilt
# NAT helpers
@@ -67,6 +71,7 @@
@@ -62,6 +66,7 @@
obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o
obj-$(CONFIG_IP_NF_NAT_PROTO_GRE) += ip_nat_proto_gre.o
obj-$(CONFIG_IP_NF_NAT_PPTP) += ip_nat_pptp.o
obj-$(CONFIG_IP_NF_NAT_SIP) += ip_nat_sip.o
+obj-$(CONFIG_IP_NF_NAT_H323) += ip_nat_h323.o
# generic IP tables
obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_conntrack_h323.c linux-2.4.32/net/ipv4/netfilter/ip_conntrack_h323.c
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_conntrack_h323.c linux-2.4.32.new/net/ipv4/netfilter/ip_conntrack_h323.c
--- linux-2.4.32/net/ipv4/netfilter/ip_conntrack_h323.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/ip_conntrack_h323.c 2005-12-12 11:14:54.000000000 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/ip_conntrack_h323.c 2006-03-01 00:50:18.694114504 +0100
@@ -0,0 +1,302 @@
+/*
+ * H.323 'brute force' extension for H.323 connection tracking.
@ -351,9 +351,9 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/ip_conntrack_h323.c linux-2.4.32/net/i
+
+module_init(init);
+module_exit(fini);
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_nat_h323.c /linux-2.4.32/net/ipv4/netfilter/ip_nat_h323.c
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_nat_h323.c linux-2.4.32.new/net/ipv4/netfilter/ip_nat_h323.c
--- linux-2.4.32/net/ipv4/netfilter/ip_nat_h323.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/ip_nat_h323.c 2005-12-12 11:14:54.000000000 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/ip_nat_h323.c 2006-03-01 00:50:18.698113896 +0100
@@ -0,0 +1,403 @@
+/*
+ * H.323 'brute force' extension for NAT alteration.
@ -758,36 +758,36 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/ip_nat_h323.c /linux-2.4.32/net/ipv4/n
+
+module_init(init);
+module_exit(fini);
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-12 11:13:17.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-12 11:16:13.000000000 +0100
@@ -72,6 +72,7 @@
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack.h
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2006-03-01 00:49:36.474532856 +0100
+++ linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack.h 2006-03-01 00:50:18.699113744 +0100
@@ -71,6 +71,7 @@
#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
#include <linux/netfilter_ipv4/ip_conntrack_sip.h>
+#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
/* per expectation: application helper private data */
union ip_conntrack_expect_help {
@@ -81,6 +82,7 @@
@@ -79,6 +80,7 @@
struct ip_ct_ftp_expect exp_ftp_info;
struct ip_ct_irc_expect exp_irc_info;
struct ip_ct_pptp_expect exp_pptp_info;
struct ip_ct_sip_expect exp_sip_info;
+ struct ip_ct_h225_expect exp_h225_info;
#ifdef CONFIG_IP_NF_NAT_NEEDED
union {
@@ -96,6 +98,7 @@
@@ -93,6 +95,7 @@
struct ip_ct_ftp_master ct_ftp_info;
struct ip_ct_irc_master ct_irc_info;
struct ip_ct_pptp_master ct_pptp_info;
struct ip_ct_sip_master ct_sip_info;
+ struct ip_ct_h225_master ct_h225_info;
};
#ifdef CONFIG_IP_NF_NAT_NEEDED
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_h323.h linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_h323.h
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_h323.h linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack_h323.h
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_h323.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_h323.h 2005-12-12 11:14:54.000000000 +0100
+++ linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack_h323.h 2006-03-01 00:50:18.700113592 +0100
@@ -0,0 +1,30 @@
+#ifndef _IP_CONNTRACK_H323_H
+#define _IP_CONNTRACK_H323_H

@ -1,375 +1,16 @@
diff -urN linux-2.4.32.orig/arch/mips/kernel/mips_ksyms.c linux-2.4.32/arch/mips/kernel/mips_ksyms.c
--- linux-2.4.32.orig/arch/mips/kernel/mips_ksyms.c 2005-12-29 12:17:49.000000000 +0100
+++ linux-2.4.32/arch/mips/kernel/mips_ksyms.c 2005-12-29 12:18:26.000000000 +0100
@@ -52,6 +52,7 @@
/*
* String functions
*/
+EXPORT_SYMBOL_NOVERS(memchr);
EXPORT_SYMBOL_NOVERS(memcmp);
EXPORT_SYMBOL_NOVERS(memset);
EXPORT_SYMBOL_NOVERS(memcpy);
diff -urN linux-2.4.32.orig/Documentation/Configure.help linux-2.4.32/Documentation/Configure.help
--- linux-2.4.32.orig/Documentation/Configure.help 2005-12-29 12:17:55.000000000 +0100
+++ linux-2.4.32/Documentation/Configure.help 2005-12-29 12:18:26.000000000 +0100
@@ -2817,6 +2817,14 @@
Documentation/modules.txt. If unsure, say `N'.
+RTSP protocol support
+CONFIG_IP_NF_RTSP
+ Support the RTSP protocol. This allows UDP transports to be setup
+ properly, including RTP and RDT.
+
+ If you want to compile it as a module, say 'M' here and read
+ Documentation/modules.txt. If unsure, say 'Y'.
+
IRC Send/Chat protocol support
CONFIG_IP_NF_IRC
There is a commonly-used extension to IRC called
diff -urN linux-2.4.32.orig/include/linux/netfilter_helpers.h linux-2.4.32/include/linux/netfilter_helpers.h
--- linux-2.4.32.orig/include/linux/netfilter_helpers.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_helpers.h 2005-12-29 12:18:26.000000000 +0100
@@ -0,0 +1,133 @@
+/*
+ * Helpers for netfiler modules. This file provides implementations for basic
+ * functions such as strncasecmp(), etc.
+ *
+ * gcc will warn for defined but unused functions, so we only include the
+ * functions requested. The following macros are used:
+ * NF_NEED_STRNCASECMP nf_strncasecmp()
+ * NF_NEED_STRTOU16 nf_strtou16()
+ * NF_NEED_STRTOU32 nf_strtou32()
+ */
+#ifndef _NETFILTER_HELPERS_H
+#define _NETFILTER_HELPERS_H
+
+/* Only include these functions for kernel code. */
+#ifdef __KERNEL__
+
+#include <linux/ctype.h>
+#define iseol(c) ( (c) == '\r' || (c) == '\n' )
+
+/*
+ * The standard strncasecmp()
+ */
+#ifdef NF_NEED_STRNCASECMP
+static int
+nf_strncasecmp(const char* s1, const char* s2, u_int32_t len)
+{
+ if (s1 == NULL || s2 == NULL)
+ {
+ if (s1 == NULL && s2 == NULL)
+ {
+ return 0;
+ }
+ return (s1 == NULL) ? -1 : 1;
+ }
+ while (len > 0 && tolower(*s1) == tolower(*s2))
+ {
+ len--;
+ s1++;
+ s2++;
+ }
+ return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) );
+}
+#endif /* NF_NEED_STRNCASECMP */
+
+/*
+ * Parse a string containing a 16-bit unsigned integer.
+ * Returns the number of chars used, or zero if no number is found.
+ */
+#ifdef NF_NEED_STRTOU16
+static int
+nf_strtou16(const char* pbuf, u_int16_t* pval)
+{
+ int n = 0;
+
+ *pval = 0;
+ while (isdigit(pbuf[n]))
+ {
+ *pval = (*pval * 10) + (pbuf[n] - '0');
+ n++;
+ }
+
+ return n;
+}
+#endif /* NF_NEED_STRTOU16 */
+
+/*
+ * Parse a string containing a 32-bit unsigned integer.
+ * Returns the number of chars used, or zero if no number is found.
+ */
+#ifdef NF_NEED_STRTOU32
+static int
+nf_strtou32(const char* pbuf, u_int32_t* pval)
+{
+ int n = 0;
+
+ *pval = 0;
+ while (pbuf[n] >= '0' && pbuf[n] <= '9')
+ {
+ *pval = (*pval * 10) + (pbuf[n] - '0');
+ n++;
+ }
+
+ return n;
+}
+#endif /* NF_NEED_STRTOU32 */
+
+/*
+ * Given a buffer and length, advance to the next line and mark the current
+ * line.
+ */
+#ifdef NF_NEED_NEXTLINE
+static int
+nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
+{
+ uint off = *poff;
+ uint physlen = 0;
+
+ if (off >= len)
+ {
+ return 0;
+ }
+
+ while (p[off] != '\n')
+ {
+ if (len-off <= 1)
+ {
+ return 0;
+ }
+
+ physlen++;
+ off++;
+ }
+
+ /* if we saw a crlf, physlen needs adjusted */
+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
+ {
+ physlen--;
+ }
+
+ /* advance past the newline */
+ off++;
+
+ *plineoff = *poff;
+ *plinelen = physlen;
+ *poff = off;
+
+ return 1;
+}
+#endif /* NF_NEED_NEXTLINE */
+
+#endif /* __KERNEL__ */
+
+#endif /* _NETFILTER_HELPERS_H */
diff -urN linux-2.4.32.orig/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h
--- linux-2.4.32.orig/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-29 12:17:55.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-29 12:18:26.000000000 +0100
@@ -66,6 +66,7 @@
};
/* Add protocol helper include file here */
+#include <linux/netfilter_ipv4/ip_conntrack_rtsp.h>
#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
@@ -78,6 +79,7 @@
/* per expectation: application helper private data */
union ip_conntrack_expect_help {
/* insert conntrack helper private data (expect) here */
+ struct ip_ct_rtsp_expect exp_rtsp_info;
struct ip_ct_amanda_expect exp_amanda_info;
struct ip_ct_ftp_expect exp_ftp_info;
struct ip_ct_irc_expect exp_irc_info;
@@ -96,6 +98,7 @@
/* per conntrack: application helper private data */
union ip_conntrack_help {
/* insert conntrack helper private data (master) here */
+ struct ip_ct_rtsp_master ct_rtsp_info;
struct ip_ct_ftp_master ct_ftp_info;
struct ip_ct_irc_master ct_irc_info;
struct ip_ct_pptp_master ct_pptp_info;
diff -urN linux-2.4.32.orig/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h
--- linux-2.4.32.orig/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h 2005-12-29 12:18:26.000000000 +0100
@@ -0,0 +1,68 @@
+/*
+ * RTSP extension for IP connection tracking.
+ * (C) 2003 by Tom Marshall <tmarshall@real.com>
+ * based on ip_conntrack_irc.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef _IP_CONNTRACK_RTSP_H
+#define _IP_CONNTRACK_RTSP_H
+
+/* #define IP_NF_RTSP_DEBUG */
+#define IP_NF_RTSP_VERSION "0.01"
+
+/* port block types */
+typedef enum {
+ pb_single, /* client_port=x */
+ pb_range, /* client_port=x-y */
+ pb_discon /* client_port=x/y (rtspbis) */
+} portblock_t;
+
+/* We record seq number and length of rtsp headers here, all in host order. */
+
+/*
+ * This structure is per expected connection. It is a member of struct
+ * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored
+ * there and we are expected to only store the length of the data which
+ * needs replaced. If a packet contains multiple RTSP messages, we create
+ * one expected connection per message.
+ *
+ * We use these variables to mark the entire header block. This may seem
+ * like overkill, but the nature of RTSP requires it. A header may appear
+ * multiple times in a message. We must treat two Transport headers the
+ * same as one Transport header with two entries.
+ */
+struct ip_ct_rtsp_expect
+{
+ u_int32_t len; /* length of header block */
+ portblock_t pbtype; /* Type of port block that was requested */
+ u_int16_t loport; /* Port that was requested, low or first */
+ u_int16_t hiport; /* Port that was requested, high or second */
+#if 0
+ uint method; /* RTSP method */
+ uint cseq; /* CSeq from request */
+#endif
+};
+
+/* This structure exists only once per master */
+struct ip_ct_rtsp_master
+{
+ /* Empty (?) */
+};
+
+
+#ifdef __KERNEL__
+
+#include <linux/netfilter_ipv4/lockhelp.h>
+
+#define RTSP_PORT 554
+
+/* Protects rtsp part of conntracks */
+DECLARE_LOCK_EXTERN(ip_rtsp_lock);
+
+#endif /* __KERNEL__ */
+
+#endif /* _IP_CONNTRACK_RTSP_H */
diff -urN linux-2.4.32.orig/include/linux/netfilter_mime.h linux-2.4.32/include/linux/netfilter_mime.h
--- linux-2.4.32.orig/include/linux/netfilter_mime.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_mime.h 2005-12-29 12:18:26.000000000 +0100
@@ -0,0 +1,90 @@
+/*
+ * MIME functions for netfilter modules. This file provides implementations
+ * for basic MIME parsing. MIME headers are used in many protocols, such as
+ * HTTP, RTSP, SIP, etc.
+ *
+ * gcc will warn for defined but unused functions, so we only include the
+ * functions requested. The following macros are used:
+ * NF_NEED_MIME_NEXTLINE nf_mime_nextline()
+ */
+#ifndef _NETFILTER_MIME_H
+#define _NETFILTER_MIME_H
+
+/* Only include these functions for kernel code. */
+#ifdef __KERNEL__
+
+#include <linux/kernel.h>
+#include <linux/ctype.h>
+
+/*
+ * Given a buffer and length, advance to the next line and mark the current
+ * line. If the current line is empty, *plinelen will be set to zero. If
+ * not, it will be set to the actual line length (including CRLF).
+ *
+ * 'line' in this context means logical line (includes LWS continuations).
+ * Returns 1 on success, 0 on failure.
+ */
+#ifdef NF_NEED_MIME_NEXTLINE
+static int
+nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
+{
+ uint off = *poff;
+ uint physlen = 0;
+ int is_first_line = 1;
+
+ if (off >= len)
+ {
+ return 0;
+ }
+
+ do
+ {
+ while (p[off] != '\n')
+ {
+ if (len-off <= 1)
+ {
+ return 0;
+ }
+
+ physlen++;
+ off++;
+ }
+
+ /* if we saw a crlf, physlen needs adjusted */
+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
+ {
+ physlen--;
+ }
+
+ /* advance past the newline */
+ off++;
+
+ /* check for an empty line */
+ if (physlen == 0)
+ {
+ break;
+ }
+
+ /* check for colon on the first physical line */
+ if (is_first_line)
+ {
+ is_first_line = 0;
+ if (memchr(p+(*poff), ':', physlen) == NULL)
+ {
+ return 0;
+ }
+ }
+ }
+ while (p[off] == ' ' || p[off] == '\t');
+
+ *plineoff = *poff;
+ *plinelen = (physlen == 0) ? 0 : (off - *poff);
+ *poff = off;
+
+ return 1;
+}
+#endif /* NF_NEED_MIME_NEXTLINE */
+
+#endif /* __KERNEL__ */
+
+#endif /* _NETFILTER_MIME_H */
diff -urN linux-2.4.32.orig/net/ipv4/netfilter/Config.in linux-2.4.32/net/ipv4/netfilter/Config.in
--- linux-2.4.32.orig/net/ipv4/netfilter/Config.in 2005-12-29 12:17:55.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/Config.in 2005-12-29 12:20:42.000000000 +0100
@@ -18,6 +18,7 @@
dep_tristate ' SIP protocol support' CONFIG_IP_NF_SIP $CONFIG_IP_NF_CONNTRACK
diff -urN linux-2.4.32/net/ipv4/netfilter/Config.in linux-2.4.32.new/net/ipv4/netfilter/Config.in
--- linux-2.4.32/net/ipv4/netfilter/Config.in 2006-03-01 00:53:57.884792456 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/Config.in 2006-03-01 00:55:14.462150928 +0100
@@ -16,6 +16,7 @@
dep_tristate ' GRE protocol support' CONFIG_IP_NF_CT_PROTO_GRE $CONFIG_IP_NF_CONNTRACK
dep_tristate ' PPTP protocol support' CONFIG_IP_NF_PPTP $CONFIG_IP_NF_CT_PROTO_GRE
dep_tristate ' H.323 (netmeeting) support' CONFIG_IP_NF_H323 $CONFIG_IP_NF_CONNTRACK
dep_tristate ' MMS protocol support' CONFIG_IP_NF_MMS $CONFIG_IP_NF_CONNTRACK
+ dep_tristate ' RTSP protocol support' CONFIG_IP_NF_RTSP $CONFIG_IP_NF_CONNTRACK
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
@@ -128,6 +129,13 @@
define_tristate CONFIG_IP_NF_NAT_MMS $CONFIG_IP_NF_NAT
@@ -119,6 +120,13 @@
define_tristate CONFIG_IP_NF_NAT_H323 $CONFIG_IP_NF_NAT
fi
fi
+ if [ "$CONFIG_IP_NF_RTSP" = "m" ]; then
@ -379,12 +20,35 @@ diff -urN linux-2.4.32.orig/net/ipv4/netfilter/Config.in linux-2.4.32/net/ipv4/n
+ define_tristate CONFIG_IP_NF_NAT_RTSP $CONFIG_IP_NF_NAT
+ fi
+ fi
if [ "$CONFIG_IP_NF_AMANDA" = "m" ]; then
define_tristate CONFIG_IP_NF_NAT_AMANDA m
else
diff -urN linux-2.4.32.orig/net/ipv4/netfilter/ip_conntrack_rtsp.c linux-2.4.32/net/ipv4/netfilter/ip_conntrack_rtsp.c
--- linux-2.4.32.orig/net/ipv4/netfilter/ip_conntrack_rtsp.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/ip_conntrack_rtsp.c 2005-12-29 12:18:26.000000000 +0100
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
dep_tristate ' Basic SNMP-ALG support (EXPERIMENTAL)' CONFIG_IP_NF_NAT_SNMP_BASIC $CONFIG_IP_NF_NAT
fi
diff -urN linux-2.4.32/net/ipv4/netfilter/Makefile linux-2.4.32.new/net/ipv4/netfilter/Makefile
--- linux-2.4.32/net/ipv4/netfilter/Makefile 2006-03-01 00:53:57.886792152 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/Makefile 2006-03-01 00:55:14.463150776 +0100
@@ -57,6 +57,11 @@
ifdef CONFIG_IP_NF_NAT_H323
export-objs += ip_conntrack_h323.o
endif
+obj-$(CONFIG_IP_NF_RTSP) += ip_conntrack_rtsp.o
+ifdef CONFIG_IP_NF_NAT_RTSP
+ export-objs += ip_conntrack_rtsp.o
+endif
+
# NAT helpers
@@ -67,6 +72,7 @@
obj-$(CONFIG_IP_NF_NAT_PROTO_GRE) += ip_nat_proto_gre.o
obj-$(CONFIG_IP_NF_NAT_PPTP) += ip_nat_pptp.o
obj-$(CONFIG_IP_NF_NAT_H323) += ip_nat_h323.o
+obj-$(CONFIG_IP_NF_NAT_RTSP) += ip_nat_rtsp.o
# generic IP tables
obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_conntrack_rtsp.c linux-2.4.32.new/net/ipv4/netfilter/ip_conntrack_rtsp.c
--- linux-2.4.32/net/ipv4/netfilter/ip_conntrack_rtsp.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/ip_conntrack_rtsp.c 2006-03-01 00:55:14.465150472 +0100
@@ -0,0 +1,507 @@
+/*
+ * RTSP extension for IP connection tracking
@ -893,9 +557,9 @@ diff -urN linux-2.4.32.orig/net/ipv4/netfilter/ip_conntrack_rtsp.c linux-2.4.32/
+
+module_init(init);
+module_exit(fini);
diff -urN linux-2.4.32.orig/net/ipv4/netfilter/ip_nat_rtsp.c linux-2.4.32/net/ipv4/netfilter/ip_nat_rtsp.c
--- linux-2.4.32.orig/net/ipv4/netfilter/ip_nat_rtsp.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/ip_nat_rtsp.c 2005-12-29 12:18:26.000000000 +0100
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_nat_rtsp.c linux-2.4.32.new/net/ipv4/netfilter/ip_nat_rtsp.c
--- linux-2.4.32/net/ipv4/netfilter/ip_nat_rtsp.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/ip_nat_rtsp.c 2006-03-01 00:55:14.467150168 +0100
@@ -0,0 +1,621 @@
+/*
+ * RTSP extension for TCP NAT alteration
@ -1398,141 +1062,462 @@ diff -urN linux-2.4.32.orig/net/ipv4/netfilter/ip_nat_rtsp.c linux-2.4.32/net/ip
+
+ datalen = (*pskb)->len - iph->ihl * 4 - tcph->doff * 4;
+
+ LOCK_BH(&ip_rtsp_lock);
+ /* Ensure the packet contains all of the marked data */
+ if (!between(exp->seq + ct_rtsp_info->len,
+ ntohl(tcph->seq), ntohl(tcph->seq) + datalen))
+ LOCK_BH(&ip_rtsp_lock);
+ /* Ensure the packet contains all of the marked data */
+ if (!between(exp->seq + ct_rtsp_info->len,
+ ntohl(tcph->seq), ntohl(tcph->seq) + datalen))
+ {
+ /* Partial retransmission? Probably a hacker. */
+ if (net_ratelimit())
+ {
+ INFOP("partial packet %u/%u in %u/%u\n",
+ exp->seq, ct_rtsp_info->len, ntohl(tcph->seq), ntohl(tcph->seq) + datalen);
+ }
+ UNLOCK_BH(&ip_rtsp_lock);
+ return NF_DROP;
+ }
+
+ switch (dir)
+ {
+ case IP_CT_DIR_ORIGINAL:
+ rc = help_out(ct, ctinfo, exp, pskb);
+ break;
+ case IP_CT_DIR_REPLY:
+ rc = help_in(ct, ctinfo, exp, pskb);
+ break;
+ }
+ UNLOCK_BH(&ip_rtsp_lock);
+
+ return rc;
+}
+
+static struct ip_nat_helper ip_nat_rtsp_helpers[MAX_PORTS];
+static char rtsp_names[MAX_PORTS][10];
+
+/* This function is intentionally _NOT_ defined as __exit */
+static void
+fini(void)
+{
+ int i;
+
+ for (i = 0; i < num_ports; i++)
+ {
+ DEBUGP("unregistering helper for port %d\n", ports[i]);
+ ip_nat_helper_unregister(&ip_nat_rtsp_helpers[i]);
+ }
+}
+
+static int __init
+init(void)
+{
+ int ret = 0;
+ int i;
+ struct ip_nat_helper* hlpr;
+ char* tmpname;
+
+ printk("ip_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n");
+
+ if (ports[0] == 0)
+ {
+ ports[0] = RTSP_PORT;
+ }
+
+ for (i = 0; (i < MAX_PORTS) && ports[i] != 0; i++)
+ {
+ hlpr = &ip_nat_rtsp_helpers[i];
+ memset(hlpr, 0, sizeof(struct ip_nat_helper));
+
+ hlpr->tuple.dst.protonum = IPPROTO_TCP;
+ hlpr->tuple.src.u.tcp.port = htons(ports[i]);
+ hlpr->mask.src.u.tcp.port = 0xFFFF;
+ hlpr->mask.dst.protonum = 0xFFFF;
+ hlpr->help = help;
+ hlpr->flags = 0;
+ hlpr->me = THIS_MODULE;
+ hlpr->expect = expected;
+
+ tmpname = &rtsp_names[i][0];
+ if (ports[i] == RTSP_PORT)
+ {
+ sprintf(tmpname, "rtsp");
+ }
+ else
+ {
+ sprintf(tmpname, "rtsp-%d", i);
+ }
+ hlpr->name = tmpname;
+
+ DEBUGP("registering helper for port %d: name %s\n", ports[i], hlpr->name);
+ ret = ip_nat_helper_register(hlpr);
+
+ if (ret)
+ {
+ printk("ip_nat_rtsp: error registering helper for port %d\n", ports[i]);
+ fini();
+ return 1;
+ }
+ num_ports++;
+ }
+ if (stunaddr != NULL)
+ {
+ extip = in_aton(stunaddr);
+ }
+ if (destaction != NULL)
+ {
+ if (strcmp(destaction, "auto") == 0)
+ {
+ dstact = DSTACT_AUTO;
+ }
+ if (strcmp(destaction, "strip") == 0)
+ {
+ dstact = DSTACT_STRIP;
+ }
+ if (strcmp(destaction, "none") == 0)
+ {
+ dstact = DSTACT_NONE;
+ }
+ }
+ return ret;
+}
+
+module_init(init);
+module_exit(fini);
--- linux-2.4.32/arch/mips/kernel/mips_ksyms.c 2006-03-01 00:49:34.142887320 +0100
+++ linux-2.4.32.new/arch/mips/kernel/mips_ksyms.c 2006-03-01 00:55:14.469149864 +0100
@@ -52,6 +52,7 @@
/*
* String functions
*/
+EXPORT_SYMBOL_NOVERS(memchr);
EXPORT_SYMBOL_NOVERS(memcmp);
EXPORT_SYMBOL_NOVERS(memset);
EXPORT_SYMBOL_NOVERS(memcpy);
diff -urN linux-2.4.32/include/linux/netfilter_helpers.h linux-2.4.32.new/include/linux/netfilter_helpers.h
--- linux-2.4.32/include/linux/netfilter_helpers.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32.new/include/linux/netfilter_helpers.h 2006-03-01 00:55:14.470149712 +0100
@@ -0,0 +1,133 @@
+/*
+ * Helpers for netfiler modules. This file provides implementations for basic
+ * functions such as strncasecmp(), etc.
+ *
+ * gcc will warn for defined but unused functions, so we only include the
+ * functions requested. The following macros are used:
+ * NF_NEED_STRNCASECMP nf_strncasecmp()
+ * NF_NEED_STRTOU16 nf_strtou16()
+ * NF_NEED_STRTOU32 nf_strtou32()
+ */
+#ifndef _NETFILTER_HELPERS_H
+#define _NETFILTER_HELPERS_H
+
+/* Only include these functions for kernel code. */
+#ifdef __KERNEL__
+
+#include <linux/ctype.h>
+#define iseol(c) ( (c) == '\r' || (c) == '\n' )
+
+/*
+ * The standard strncasecmp()
+ */
+#ifdef NF_NEED_STRNCASECMP
+static int
+nf_strncasecmp(const char* s1, const char* s2, u_int32_t len)
+{
+ if (s1 == NULL || s2 == NULL)
+ {
+ if (s1 == NULL && s2 == NULL)
+ {
+ return 0;
+ }
+ return (s1 == NULL) ? -1 : 1;
+ }
+ while (len > 0 && tolower(*s1) == tolower(*s2))
+ {
+ len--;
+ s1++;
+ s2++;
+ }
+ return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) );
+}
+#endif /* NF_NEED_STRNCASECMP */
+
+/*
+ * Parse a string containing a 16-bit unsigned integer.
+ * Returns the number of chars used, or zero if no number is found.
+ */
+#ifdef NF_NEED_STRTOU16
+static int
+nf_strtou16(const char* pbuf, u_int16_t* pval)
+{
+ int n = 0;
+
+ *pval = 0;
+ while (isdigit(pbuf[n]))
+ {
+ *pval = (*pval * 10) + (pbuf[n] - '0');
+ n++;
+ }
+
+ return n;
+}
+#endif /* NF_NEED_STRTOU16 */
+
+/*
+ * Parse a string containing a 32-bit unsigned integer.
+ * Returns the number of chars used, or zero if no number is found.
+ */
+#ifdef NF_NEED_STRTOU32
+static int
+nf_strtou32(const char* pbuf, u_int32_t* pval)
+{
+ int n = 0;
+
+ *pval = 0;
+ while (pbuf[n] >= '0' && pbuf[n] <= '9')
+ {
+ *pval = (*pval * 10) + (pbuf[n] - '0');
+ n++;
+ }
+
+ return n;
+}
+#endif /* NF_NEED_STRTOU32 */
+
+/*
+ * Given a buffer and length, advance to the next line and mark the current
+ * line.
+ */
+#ifdef NF_NEED_NEXTLINE
+static int
+nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
+{
+ uint off = *poff;
+ uint physlen = 0;
+
+ if (off >= len)
+ {
+ return 0;
+ }
+
+ while (p[off] != '\n')
+ {
+ /* Partial retransmission? Probably a hacker. */
+ if (net_ratelimit())
+ if (len-off <= 1)
+ {
+ INFOP("partial packet %u/%u in %u/%u\n",
+ exp->seq, ct_rtsp_info->len, ntohl(tcph->seq), ntohl(tcph->seq) + datalen);
+ return 0;
+ }
+ UNLOCK_BH(&ip_rtsp_lock);
+ return NF_DROP;
+
+ physlen++;
+ off++;
+ }
+
+ switch (dir)
+ /* if we saw a crlf, physlen needs adjusted */
+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
+ {
+ case IP_CT_DIR_ORIGINAL:
+ rc = help_out(ct, ctinfo, exp, pskb);
+ break;
+ case IP_CT_DIR_REPLY:
+ rc = help_in(ct, ctinfo, exp, pskb);
+ break;
+ physlen--;
+ }
+ UNLOCK_BH(&ip_rtsp_lock);
+
+ return rc;
+ /* advance past the newline */
+ off++;
+
+ *plineoff = *poff;
+ *plinelen = physlen;
+ *poff = off;
+
+ return 1;
+}
+#endif /* NF_NEED_NEXTLINE */
+
+static struct ip_nat_helper ip_nat_rtsp_helpers[MAX_PORTS];
+static char rtsp_names[MAX_PORTS][10];
+#endif /* __KERNEL__ */
+
+/* This function is intentionally _NOT_ defined as __exit */
+static void
+fini(void)
+{
+ int i;
+#endif /* _NETFILTER_HELPERS_H */
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h 2006-03-01 00:55:14.472149408 +0100
@@ -0,0 +1,68 @@
+/*
+ * RTSP extension for IP connection tracking.
+ * (C) 2003 by Tom Marshall <tmarshall@real.com>
+ * based on ip_conntrack_irc.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef _IP_CONNTRACK_RTSP_H
+#define _IP_CONNTRACK_RTSP_H
+
+ for (i = 0; i < num_ports; i++)
+ {
+ DEBUGP("unregistering helper for port %d\n", ports[i]);
+ ip_nat_helper_unregister(&ip_nat_rtsp_helpers[i]);
+ }
+}
+/* #define IP_NF_RTSP_DEBUG */
+#define IP_NF_RTSP_VERSION "0.01"
+
+static int __init
+init(void)
+{
+ int ret = 0;
+ int i;
+ struct ip_nat_helper* hlpr;
+ char* tmpname;
+/* port block types */
+typedef enum {
+ pb_single, /* client_port=x */
+ pb_range, /* client_port=x-y */
+ pb_discon /* client_port=x/y (rtspbis) */
+} portblock_t;
+
+ printk("ip_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n");
+/* We record seq number and length of rtsp headers here, all in host order. */
+
+ if (ports[0] == 0)
+/*
+ * This structure is per expected connection. It is a member of struct
+ * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored
+ * there and we are expected to only store the length of the data which
+ * needs replaced. If a packet contains multiple RTSP messages, we create
+ * one expected connection per message.
+ *
+ * We use these variables to mark the entire header block. This may seem
+ * like overkill, but the nature of RTSP requires it. A header may appear
+ * multiple times in a message. We must treat two Transport headers the
+ * same as one Transport header with two entries.
+ */
+struct ip_ct_rtsp_expect
+{
+ ports[0] = RTSP_PORT;
+ }
+ u_int32_t len; /* length of header block */
+ portblock_t pbtype; /* Type of port block that was requested */
+ u_int16_t loport; /* Port that was requested, low or first */
+ u_int16_t hiport; /* Port that was requested, high or second */
+#if 0
+ uint method; /* RTSP method */
+ uint cseq; /* CSeq from request */
+#endif
+};
+
+ for (i = 0; (i < MAX_PORTS) && ports[i] != 0; i++)
+/* This structure exists only once per master */
+struct ip_ct_rtsp_master
+{
+ hlpr = &ip_nat_rtsp_helpers[i];
+ memset(hlpr, 0, sizeof(struct ip_nat_helper));
+ /* Empty (?) */
+};
+
+ hlpr->tuple.dst.protonum = IPPROTO_TCP;
+ hlpr->tuple.src.u.tcp.port = htons(ports[i]);
+ hlpr->mask.src.u.tcp.port = 0xFFFF;
+ hlpr->mask.dst.protonum = 0xFFFF;
+ hlpr->help = help;
+ hlpr->flags = 0;
+ hlpr->me = THIS_MODULE;
+ hlpr->expect = expected;
+
+ tmpname = &rtsp_names[i][0];
+ if (ports[i] == RTSP_PORT)
+#ifdef __KERNEL__
+
+#include <linux/netfilter_ipv4/lockhelp.h>
+
+#define RTSP_PORT 554
+
+/* Protects rtsp part of conntracks */
+DECLARE_LOCK_EXTERN(ip_rtsp_lock);
+
+#endif /* __KERNEL__ */
+
+#endif /* _IP_CONNTRACK_RTSP_H */
diff -urN linux-2.4.32/include/linux/netfilter_mime.h linux-2.4.32.new/include/linux/netfilter_mime.h
--- linux-2.4.32/include/linux/netfilter_mime.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32.new/include/linux/netfilter_mime.h 2006-03-01 00:55:14.473149256 +0100
@@ -0,0 +1,90 @@
+/*
+ * MIME functions for netfilter modules. This file provides implementations
+ * for basic MIME parsing. MIME headers are used in many protocols, such as
+ * HTTP, RTSP, SIP, etc.
+ *
+ * gcc will warn for defined but unused functions, so we only include the
+ * functions requested. The following macros are used:
+ * NF_NEED_MIME_NEXTLINE nf_mime_nextline()
+ */
+#ifndef _NETFILTER_MIME_H
+#define _NETFILTER_MIME_H
+
+/* Only include these functions for kernel code. */
+#ifdef __KERNEL__
+
+#include <linux/kernel.h>
+#include <linux/ctype.h>
+
+/*
+ * Given a buffer and length, advance to the next line and mark the current
+ * line. If the current line is empty, *plinelen will be set to zero. If
+ * not, it will be set to the actual line length (including CRLF).
+ *
+ * 'line' in this context means logical line (includes LWS continuations).
+ * Returns 1 on success, 0 on failure.
+ */
+#ifdef NF_NEED_MIME_NEXTLINE
+static int
+nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
+{
+ sprintf(tmpname, "rtsp");
+ }
+ else
+ uint off = *poff;
+ uint physlen = 0;
+ int is_first_line = 1;
+
+ if (off >= len)
+ {
+ sprintf(tmpname, "rtsp-%d", i);
+ return 0;
+ }
+ hlpr->name = tmpname;
+
+ DEBUGP("registering helper for port %d: name %s\n", ports[i], hlpr->name);
+ ret = ip_nat_helper_register(hlpr);
+
+ if (ret)
+ do
+ {
+ printk("ip_nat_rtsp: error registering helper for port %d\n", ports[i]);
+ fini();
+ return 1;
+ while (p[off] != '\n')
+ {
+ if (len-off <= 1)
+ {
+ return 0;
+ }
+ num_ports++;
+
+ physlen++;
+ off++;
+ }
+ if (stunaddr != NULL)
+
+ /* if we saw a crlf, physlen needs adjusted */
+ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
+ {
+ extip = in_aton(stunaddr);
+ physlen--;
+ }
+ if (destaction != NULL)
+ {
+ if (strcmp(destaction, "auto") == 0)
+
+ /* advance past the newline */
+ off++;
+
+ /* check for an empty line */
+ if (physlen == 0)
+ {
+ dstact = DSTACT_AUTO;
+ break;
+ }
+ if (strcmp(destaction, "strip") == 0)
+
+ /* check for colon on the first physical line */
+ if (is_first_line)
+ {
+ dstact = DSTACT_STRIP;
+ }
+ if (strcmp(destaction, "none") == 0)
+ is_first_line = 0;
+ if (memchr(p+(*poff), ':', physlen) == NULL)
+ {
+ dstact = DSTACT_NONE;
+ return 0;
+ }
+ }
+ return ret;
+ }
+ while (p[off] == ' ' || p[off] == '\t');
+
+module_init(init);
+module_exit(fini);
diff -urN linux-2.4.32.orig/net/ipv4/netfilter/Makefile linux-2.4.32/net/ipv4/netfilter/Makefile
--- linux-2.4.32.orig/net/ipv4/netfilter/Makefile 2005-12-29 12:17:55.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/Makefile 2005-12-29 12:18:26.000000000 +0100
@@ -32,6 +32,14 @@
obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o
# connection tracking helpers
+ *plineoff = *poff;
+ *plinelen = (physlen == 0) ? 0 : (off - *poff);
+ *poff = off;
+
+# rtsp protocol support
+obj-$(CONFIG_IP_NF_RTSP) += ip_conntrack_rtsp.o
+ifdef CONFIG_IP_NF_NAT_RTSP
+ export-objs += ip_conntrack_rtsp.o
+endif
+obj-$(CONFIG_IP_NF_NAT_RTSP) += ip_nat_rtsp.o
+ return 1;
+}
+#endif /* NF_NEED_MIME_NEXTLINE */
+
obj-$(CONFIG_IP_NF_AMANDA) += ip_conntrack_amanda.o
ifdef CONFIG_IP_NF_AMANDA
export-objs += ip_conntrack_amanda.o
+#endif /* __KERNEL__ */
+
+#endif /* _NETFILTER_MIME_H */
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2006-03-01 00:53:57.889791696 +0100
+++ linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack.h 2006-03-01 01:06:32.178122440 +0100
@@ -72,6 +72,7 @@
#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
+#include <linux/netfilter_ipv4/ip_conntrack_rtsp.h>
/* per expectation: application helper private data */
union ip_conntrack_expect_help {
@@ -81,6 +82,7 @@
struct ip_ct_irc_expect exp_irc_info;
struct ip_ct_pptp_expect exp_pptp_info;
struct ip_ct_h225_expect exp_h225_info;
+ struct ip_ct_rtsp_expect exp_rtsp_info;
#ifdef CONFIG_IP_NF_NAT_NEEDED
union {
@@ -96,6 +98,7 @@
struct ip_ct_irc_master ct_irc_info;
struct ip_ct_pptp_master ct_pptp_info;
struct ip_ct_h225_master ct_h225_info;
+ struct ip_ct_rtsp_master ct_rtsp_info;
};
#ifdef CONFIG_IP_NF_NAT_NEEDED

@ -1,16 +1,16 @@
diff -urN linux-2.4.32/net/ipv4/netfilter/Config.in linux-2.4.32/net/ipv4/netfilter/Config.in
--- linux-2.4.32/net/ipv4/netfilter/Config.in 2005-12-12 16:29:01.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/Config.in 2005-12-12 16:35:37.000000000 +0100
diff -urN linux-2.4.32/net/ipv4/netfilter/Config.in linux-2.4.32.new/net/ipv4/netfilter/Config.in
--- linux-2.4.32/net/ipv4/netfilter/Config.in 2006-03-01 01:12:48.268947944 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/Config.in 2006-03-01 01:14:53.455916632 +0100
@@ -17,6 +17,7 @@
dep_tristate ' PPTP protocol support' CONFIG_IP_NF_PPTP $CONFIG_IP_NF_CT_PROTO_GRE
dep_tristate ' SIP protocol support' CONFIG_IP_NF_SIP $CONFIG_IP_NF_CONNTRACK
dep_tristate ' H.323 (netmeeting) support' CONFIG_IP_NF_H323 $CONFIG_IP_NF_CONNTRACK
dep_tristate ' RTSP protocol support' CONFIG_IP_NF_RTSP $CONFIG_IP_NF_CONNTRACK
+ dep_tristate ' MMS protocol support' CONFIG_IP_NF_MMS $CONFIG_IP_NF_CONNTRACK
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
@@ -120,6 +121,13 @@
define_tristate CONFIG_IP_NF_NAT_H323 $CONFIG_IP_NF_NAT
@@ -127,6 +128,13 @@
define_tristate CONFIG_IP_NF_NAT_RTSP $CONFIG_IP_NF_NAT
fi
fi
+ if [ "$CONFIG_IP_NF_MMS" = "m" ]; then
@ -20,15 +20,15 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/Config.in linux-2.4.32/net/ipv4/netfil
+ define_tristate CONFIG_IP_NF_NAT_MMS $CONFIG_IP_NF_NAT
+ fi
+ fi
if [ "$CONFIG_IP_NF_AMANDA" = "m" ]; then
define_tristate CONFIG_IP_NF_NAT_AMANDA m
else
diff -urN linux-2.4.32/net/ipv4/netfilter/Makefile linux-2.4.32/net/ipv4/netfilter/Makefile
--- linux-2.4.32/net/ipv4/netfilter/Makefile 2005-12-12 16:29:01.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/Makefile 2005-12-12 16:36:26.000000000 +0100
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
dep_tristate ' Basic SNMP-ALG support (EXPERIMENTAL)' CONFIG_IP_NF_NAT_SNMP_BASIC $CONFIG_IP_NF_NAT
fi
diff -urN linux-2.4.32/net/ipv4/netfilter/Makefile linux-2.4.32.new/net/ipv4/netfilter/Makefile
--- linux-2.4.32/net/ipv4/netfilter/Makefile 2006-03-01 01:12:48.270947640 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/Makefile 2006-03-01 01:15:25.263081208 +0100
@@ -61,6 +61,10 @@
ifdef CONFIG_IP_NF_NAT_H323
export-objs += ip_conntrack_h323.o
ifdef CONFIG_IP_NF_NAT_RTSP
export-objs += ip_conntrack_rtsp.o
endif
+obj-$(CONFIG_IP_NF_MMS) += ip_conntrack_mms.o
+ifdef CONFIG_IP_NF_NAT_MMS
@ -36,18 +36,18 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/Makefile linux-2.4.32/net/ipv4/netfilt
+endif
# NAT helpers
@@ -72,6 +76,7 @@
@@ -73,6 +77,7 @@
obj-$(CONFIG_IP_NF_NAT_PPTP) += ip_nat_pptp.o
obj-$(CONFIG_IP_NF_NAT_SIP) += ip_nat_sip.o
obj-$(CONFIG_IP_NF_NAT_H323) += ip_nat_h323.o
obj-$(CONFIG_IP_NF_NAT_RTSP) += ip_nat_rtsp.o
+obj-$(CONFIG_IP_NF_NAT_MMS) += ip_nat_mms.o
# generic IP tables
obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_conntrack_mms.c linux-2.4.32/net/ipv4/netfilter/ip_conntrack_mms.c
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_conntrack_mms.c linux-2.4.32.new/net/ipv4/netfilter/ip_conntrack_mms.c
--- linux-2.4.32/net/ipv4/netfilter/ip_conntrack_mms.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/ip_conntrack_mms.c 2005-12-12 16:32:54.000000000 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/ip_conntrack_mms.c 2006-03-01 01:13:32.991149136 +0100
@@ -0,0 +1,292 @@
+/* MMS extension for IP connection tracking
+ * (C) 2002 by Filip Sneppe <filip.sneppe@cronos.be>
@ -341,9 +341,9 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/ip_conntrack_mms.c linux-2.4.32/net/ip
+
+module_init(init);
+module_exit(fini);
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_nat_mms.c linux-2.4.32/net/ipv4/netfilter/ip_nat_mms.c
diff -urN linux-2.4.32/net/ipv4/netfilter/ip_nat_mms.c linux-2.4.32.new/net/ipv4/netfilter/ip_nat_mms.c
--- linux-2.4.32/net/ipv4/netfilter/ip_nat_mms.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/net/ipv4/netfilter/ip_nat_mms.c 2005-12-12 16:32:54.000000000 +0100
+++ linux-2.4.32.new/net/ipv4/netfilter/ip_nat_mms.c 2006-03-01 01:13:32.992148984 +0100
@@ -0,0 +1,330 @@
+/* MMS extension for TCP NAT alteration.
+ * (C) 2002 by Filip Sneppe <filip.sneppe@cronos.be>
@ -675,36 +675,36 @@ diff -urN linux-2.4.32/net/ipv4/netfilter/ip_nat_mms.c linux-2.4.32/net/ipv4/net
+
+module_init(init);
+module_exit(fini);
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-12 16:29:01.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-12 16:34:09.000000000 +0100
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack.h
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2006-03-01 01:12:47.910002512 +0100
+++ linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack.h 2006-03-01 01:16:16.710260048 +0100
@@ -73,6 +73,7 @@
#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
#include <linux/netfilter_ipv4/ip_conntrack_sip.h>
#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
#include <linux/netfilter_ipv4/ip_conntrack_rtsp.h>
+#include <linux/netfilter_ipv4/ip_conntrack_mms.h>
/* per expectation: application helper private data */
union ip_conntrack_expect_help {
@@ -83,6 +84,7 @@
struct ip_ct_pptp_expect exp_pptp_info;
struct ip_ct_sip_expect exp_sip_info;
struct ip_ct_h225_expect exp_h225_info;
struct ip_ct_rtsp_expect exp_rtsp_info;
+ struct ip_ct_mms_expect exp_mms_info;
#ifdef CONFIG_IP_NF_NAT_NEEDED
union {
@@ -99,6 +101,7 @@
struct ip_ct_pptp_master ct_pptp_info;
struct ip_ct_sip_master ct_sip_info;
struct ip_ct_h225_master ct_h225_info;
struct ip_ct_rtsp_master ct_rtsp_info;
+ struct ip_ct_mms_master ct_mms_info;
};
#ifdef CONFIG_IP_NF_NAT_NEEDED
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_mms.h linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_mms.h
diff -urN linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_mms.h linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack_mms.h
--- linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_mms.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_mms.h 2005-12-12 16:32:54.000000000 +0100
+++ linux-2.4.32.new/include/linux/netfilter_ipv4/ip_conntrack_mms.h 2006-03-01 01:13:32.993148832 +0100
@@ -0,0 +1,31 @@
+#ifndef _IP_CONNTRACK_MMS_H
+#define _IP_CONNTRACK_MMS_H

@ -17,6 +17,7 @@ package-$(BR2_PACKAGE_KMOD_SWITCH) += switch
package-$(BR2_PACKAGE_KMOD_UEAGLE_ATM) += ueagle-atm
package-$(BR2_PACKAGE_KMOD_DIAG) += diag
package-$(BR2_PACKAGE_KMOD_WLCOMPAT) += wlcompat
package-$(BR2_PACKAGE_KMOD_ZD1211) += zd1211
bcm43xx-dscape-compile: ieee80211-dscape-compile
wlcompat-compile: base-files-compile

@ -286,7 +286,6 @@ CONFIG_IP_NF_CT_ACCT=m
CONFIG_IP_NF_MATCH_CONNBYTES=m
CONFIG_IP_NF_CT_PROTO_GRE=m
CONFIG_IP_NF_PPTP=m
CONFIG_IP_NF_SIP=m
CONFIG_IP_NF_H323=m
CONFIG_IP_NF_MMS=m
CONFIG_IP_NF_RTSP=m
@ -339,7 +338,6 @@ CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_IP_NF_TARGET_NETMAP=m
CONFIG_IP_NF_NAT_PPTP=m
CONFIG_IP_NF_NAT_SIP=m
CONFIG_IP_NF_NAT_H323=m
CONFIG_IP_NF_NAT_PROTO_GRE=m
CONFIG_IP_NF_NAT_MMS=m

Loading…
Cancel
Save