1 diff -urN linux-2.4.32.orig/arch/mips/kernel/mips_ksyms.c linux-2.4.32/arch/mips/kernel/mips_ksyms.c
2 --- linux-2.4.32.orig/arch/mips/kernel/mips_ksyms.c 2005-12-29 12:17:49.000000000 +0100
3 +++ linux-2.4.32/arch/mips/kernel/mips_ksyms.c 2005-12-29 12:18:26.000000000 +0100
8 +EXPORT_SYMBOL_NOVERS(memchr);
9 EXPORT_SYMBOL_NOVERS(memcmp);
10 EXPORT_SYMBOL_NOVERS(memset);
11 EXPORT_SYMBOL_NOVERS(memcpy);
12 diff -urN linux-2.4.32.orig/Documentation/Configure.help linux-2.4.32/Documentation/Configure.help
13 --- linux-2.4.32.orig/Documentation/Configure.help 2005-12-29 12:17:55.000000000 +0100
14 +++ linux-2.4.32/Documentation/Configure.help 2005-12-29 12:18:26.000000000 +0100
15 @@ -2817,6 +2817,14 @@
16 Documentation/modules.txt. If unsure, say `N'.
19 +RTSP protocol support
21 + Support the RTSP protocol. This allows UDP transports to be setup
22 + properly, including RTP and RDT.
24 + If you want to compile it as a module, say 'M' here and read
25 + Documentation/modules.txt. If unsure, say 'Y'.
27 IRC Send/Chat protocol support
29 There is a commonly-used extension to IRC called
30 diff -urN linux-2.4.32.orig/include/linux/netfilter_helpers.h linux-2.4.32/include/linux/netfilter_helpers.h
31 --- linux-2.4.32.orig/include/linux/netfilter_helpers.h 1970-01-01 01:00:00.000000000 +0100
32 +++ linux-2.4.32/include/linux/netfilter_helpers.h 2005-12-29 12:18:26.000000000 +0100
35 + * Helpers for netfiler modules. This file provides implementations for basic
36 + * functions such as strncasecmp(), etc.
38 + * gcc will warn for defined but unused functions, so we only include the
39 + * functions requested. The following macros are used:
40 + * NF_NEED_STRNCASECMP nf_strncasecmp()
41 + * NF_NEED_STRTOU16 nf_strtou16()
42 + * NF_NEED_STRTOU32 nf_strtou32()
44 +#ifndef _NETFILTER_HELPERS_H
45 +#define _NETFILTER_HELPERS_H
47 +/* Only include these functions for kernel code. */
50 +#include <linux/ctype.h>
51 +#define iseol(c) ( (c) == '\r' || (c) == '\n' )
54 + * The standard strncasecmp()
56 +#ifdef NF_NEED_STRNCASECMP
58 +nf_strncasecmp(const char* s1, const char* s2, u_int32_t len)
60 + if (s1 == NULL || s2 == NULL)
62 + if (s1 == NULL && s2 == NULL)
66 + return (s1 == NULL) ? -1 : 1;
68 + while (len > 0 && tolower(*s1) == tolower(*s2))
74 + return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) );
76 +#endif /* NF_NEED_STRNCASECMP */
79 + * Parse a string containing a 16-bit unsigned integer.
80 + * Returns the number of chars used, or zero if no number is found.
82 +#ifdef NF_NEED_STRTOU16
84 +nf_strtou16(const char* pbuf, u_int16_t* pval)
89 + while (isdigit(pbuf[n]))
91 + *pval = (*pval * 10) + (pbuf[n] - '0');
97 +#endif /* NF_NEED_STRTOU16 */
100 + * Parse a string containing a 32-bit unsigned integer.
101 + * Returns the number of chars used, or zero if no number is found.
103 +#ifdef NF_NEED_STRTOU32
105 +nf_strtou32(const char* pbuf, u_int32_t* pval)
110 + while (pbuf[n] >= '0' && pbuf[n] <= '9')
112 + *pval = (*pval * 10) + (pbuf[n] - '0');
118 +#endif /* NF_NEED_STRTOU32 */
121 + * Given a buffer and length, advance to the next line and mark the current
124 +#ifdef NF_NEED_NEXTLINE
126 +nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
136 + while (p[off] != '\n')
147 + /* if we saw a crlf, physlen needs adjusted */
148 + if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
153 + /* advance past the newline */
157 + *plinelen = physlen;
162 +#endif /* NF_NEED_NEXTLINE */
164 +#endif /* __KERNEL__ */
166 +#endif /* _NETFILTER_HELPERS_H */
167 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
168 --- linux-2.4.32.orig/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-29 12:17:55.000000000 +0100
169 +++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack.h 2005-12-29 12:18:26.000000000 +0100
173 /* Add protocol helper include file here */
174 +#include <linux/netfilter_ipv4/ip_conntrack_rtsp.h>
175 #include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
177 #include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
179 /* per expectation: application helper private data */
180 union ip_conntrack_expect_help {
181 /* insert conntrack helper private data (expect) here */
182 + struct ip_ct_rtsp_expect exp_rtsp_info;
183 struct ip_ct_amanda_expect exp_amanda_info;
184 struct ip_ct_ftp_expect exp_ftp_info;
185 struct ip_ct_irc_expect exp_irc_info;
187 /* per conntrack: application helper private data */
188 union ip_conntrack_help {
189 /* insert conntrack helper private data (master) here */
190 + struct ip_ct_rtsp_master ct_rtsp_info;
191 struct ip_ct_ftp_master ct_ftp_info;
192 struct ip_ct_irc_master ct_irc_info;
193 struct ip_ct_pptp_master ct_pptp_info;
194 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
195 --- linux-2.4.32.orig/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h 1970-01-01 01:00:00.000000000 +0100
196 +++ linux-2.4.32/include/linux/netfilter_ipv4/ip_conntrack_rtsp.h 2005-12-29 12:18:26.000000000 +0100
199 + * RTSP extension for IP connection tracking.
200 + * (C) 2003 by Tom Marshall <tmarshall@real.com>
201 + * based on ip_conntrack_irc.h
203 + * This program is free software; you can redistribute it and/or
204 + * modify it under the terms of the GNU General Public License
205 + * as published by the Free Software Foundation; either version
206 + * 2 of the License, or (at your option) any later version.
208 +#ifndef _IP_CONNTRACK_RTSP_H
209 +#define _IP_CONNTRACK_RTSP_H
211 +/* #define IP_NF_RTSP_DEBUG */
212 +#define IP_NF_RTSP_VERSION "0.01"
214 +/* port block types */
216 + pb_single, /* client_port=x */
217 + pb_range, /* client_port=x-y */
218 + pb_discon /* client_port=x/y (rtspbis) */
221 +/* We record seq number and length of rtsp headers here, all in host order. */
224 + * This structure is per expected connection. It is a member of struct
225 + * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored
226 + * there and we are expected to only store the length of the data which
227 + * needs replaced. If a packet contains multiple RTSP messages, we create
228 + * one expected connection per message.
230 + * We use these variables to mark the entire header block. This may seem
231 + * like overkill, but the nature of RTSP requires it. A header may appear
232 + * multiple times in a message. We must treat two Transport headers the
233 + * same as one Transport header with two entries.
235 +struct ip_ct_rtsp_expect
237 + u_int32_t len; /* length of header block */
238 + portblock_t pbtype; /* Type of port block that was requested */
239 + u_int16_t loport; /* Port that was requested, low or first */
240 + u_int16_t hiport; /* Port that was requested, high or second */
242 + uint method; /* RTSP method */
243 + uint cseq; /* CSeq from request */
247 +/* This structure exists only once per master */
248 +struct ip_ct_rtsp_master
256 +#include <linux/netfilter_ipv4/lockhelp.h>
258 +#define RTSP_PORT 554
260 +/* Protects rtsp part of conntracks */
261 +DECLARE_LOCK_EXTERN(ip_rtsp_lock);
263 +#endif /* __KERNEL__ */
265 +#endif /* _IP_CONNTRACK_RTSP_H */
266 diff -urN linux-2.4.32.orig/include/linux/netfilter_mime.h linux-2.4.32/include/linux/netfilter_mime.h
267 --- linux-2.4.32.orig/include/linux/netfilter_mime.h 1970-01-01 01:00:00.000000000 +0100
268 +++ linux-2.4.32/include/linux/netfilter_mime.h 2005-12-29 12:18:26.000000000 +0100
271 + * MIME functions for netfilter modules. This file provides implementations
272 + * for basic MIME parsing. MIME headers are used in many protocols, such as
273 + * HTTP, RTSP, SIP, etc.
275 + * gcc will warn for defined but unused functions, so we only include the
276 + * functions requested. The following macros are used:
277 + * NF_NEED_MIME_NEXTLINE nf_mime_nextline()
279 +#ifndef _NETFILTER_MIME_H
280 +#define _NETFILTER_MIME_H
282 +/* Only include these functions for kernel code. */
285 +#include <linux/kernel.h>
286 +#include <linux/ctype.h>
289 + * Given a buffer and length, advance to the next line and mark the current
290 + * line. If the current line is empty, *plinelen will be set to zero. If
291 + * not, it will be set to the actual line length (including CRLF).
293 + * 'line' in this context means logical line (includes LWS continuations).
294 + * Returns 1 on success, 0 on failure.
296 +#ifdef NF_NEED_MIME_NEXTLINE
298 +nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
302 + int is_first_line = 1;
311 + while (p[off] != '\n')
322 + /* if we saw a crlf, physlen needs adjusted */
323 + if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
328 + /* advance past the newline */
331 + /* check for an empty line */
337 + /* check for colon on the first physical line */
341 + if (memchr(p+(*poff), ':', physlen) == NULL)
347 + while (p[off] == ' ' || p[off] == '\t');
350 + *plinelen = (physlen == 0) ? 0 : (off - *poff);
355 +#endif /* NF_NEED_MIME_NEXTLINE */
357 +#endif /* __KERNEL__ */
359 +#endif /* _NETFILTER_MIME_H */
360 diff -urN linux-2.4.32.orig/net/ipv4/netfilter/Config.in linux-2.4.32/net/ipv4/netfilter/Config.in
361 --- linux-2.4.32.orig/net/ipv4/netfilter/Config.in 2005-12-29 12:17:55.000000000 +0100
362 +++ linux-2.4.32/net/ipv4/netfilter/Config.in 2005-12-29 12:20:42.000000000 +0100
364 dep_tristate ' SIP protocol support' CONFIG_IP_NF_SIP $CONFIG_IP_NF_CONNTRACK
365 dep_tristate ' H.323 (netmeeting) support' CONFIG_IP_NF_H323 $CONFIG_IP_NF_CONNTRACK
366 dep_tristate ' MMS protocol support' CONFIG_IP_NF_MMS $CONFIG_IP_NF_CONNTRACK
367 + dep_tristate ' RTSP protocol support' CONFIG_IP_NF_RTSP $CONFIG_IP_NF_CONNTRACK
370 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
372 define_tristate CONFIG_IP_NF_NAT_MMS $CONFIG_IP_NF_NAT
375 + if [ "$CONFIG_IP_NF_RTSP" = "m" ]; then
376 + define_tristate CONFIG_IP_NF_NAT_RTSP m
378 + if [ "$CONFIG_IP_NF_RTSP" = "y" ]; then
379 + define_tristate CONFIG_IP_NF_NAT_RTSP $CONFIG_IP_NF_NAT
382 if [ "$CONFIG_IP_NF_AMANDA" = "m" ]; then
383 define_tristate CONFIG_IP_NF_NAT_AMANDA m
385 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
386 --- linux-2.4.32.orig/net/ipv4/netfilter/ip_conntrack_rtsp.c 1970-01-01 01:00:00.000000000 +0100
387 +++ linux-2.4.32/net/ipv4/netfilter/ip_conntrack_rtsp.c 2005-12-29 12:18:26.000000000 +0100
390 + * RTSP extension for IP connection tracking
391 + * (C) 2003 by Tom Marshall <tmarshall@real.com>
392 + * based on ip_conntrack_irc.c
394 + * This program is free software; you can redistribute it and/or
395 + * modify it under the terms of the GNU General Public License
396 + * as published by the Free Software Foundation; either version
397 + * 2 of the License, or (at your option) any later version.
399 + * Module load syntax:
400 + * insmod ip_conntrack_rtsp.o ports=port1,port2,...port<MAX_PORTS>
401 + * max_outstanding=n setup_timeout=secs
403 + * If no ports are specified, the default will be port 554.
405 + * With max_outstanding you can define the maximum number of not yet
406 + * answered SETUP requests per RTSP session (default 8).
407 + * With setup_timeout you can specify how long the system waits for
408 + * an expected data channel (default 300 seconds).
411 +#include <linux/config.h>
412 +#include <linux/module.h>
413 +#include <linux/netfilter.h>
414 +#include <linux/ip.h>
415 +#include <net/checksum.h>
416 +#include <net/tcp.h>
418 +#include <linux/netfilter_ipv4/lockhelp.h>
419 +#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
420 +#include <linux/netfilter_ipv4/ip_conntrack_rtsp.h>
422 +#include <linux/ctype.h>
423 +#define NF_NEED_STRNCASECMP
424 +#define NF_NEED_STRTOU16
425 +#define NF_NEED_STRTOU32
426 +#define NF_NEED_NEXTLINE
427 +#include <linux/netfilter_helpers.h>
428 +#define NF_NEED_MIME_NEXTLINE
429 +#include <linux/netfilter_mime.h>
431 +#define MAX_SIMUL_SETUP 8 /* XXX: use max_outstanding */
433 +#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
434 +#ifdef IP_NF_RTSP_DEBUG
435 +#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
437 +#define DEBUGP(fmt, args...)
441 +static int ports[MAX_PORTS];
442 +static int num_ports = 0;
443 +static int max_outstanding = 8;
444 +static unsigned int setup_timeout = 300;
446 +MODULE_AUTHOR("Tom Marshall <tmarshall@real.com>");
447 +MODULE_DESCRIPTION("RTSP connection tracking module");
448 +MODULE_LICENSE("GPL");
450 +MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
451 +MODULE_PARM_DESC(ports, "port numbers of RTSP servers");
452 +MODULE_PARM(max_outstanding, "i");
453 +MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session");
454 +MODULE_PARM(setup_timeout, "i");
455 +MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels");
458 +DECLARE_LOCK(ip_rtsp_lock);
459 +struct module* ip_conntrack_rtsp = THIS_MODULE;
462 + * Max mappings we will allow for one RTSP connection (for RTP, the number
463 + * of allocated ports is twice this value). Note that SMIL burns a lot of
464 + * ports so keep this reasonably high. If this is too low, you will see a
465 + * lot of "no free client map entries" messages.
467 +#define MAX_PORT_MAPS 16
469 +/*** default port list was here in the masq code: 554, 3030, 4040 ***/
471 +#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
474 + * Parse an RTSP packet.
476 + * Returns zero if parsing failed.
479 + * IN ptcp tcp data pointer
480 + * IN tcplen tcp data len
481 + * IN/OUT ptcpoff points to current tcp offset
482 + * OUT phdrsoff set to offset of rtsp headers
483 + * OUT phdrslen set to length of rtsp headers
484 + * OUT pcseqoff set to offset of CSeq header
485 + * OUT pcseqlen set to length of CSeq header
488 +rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff,
489 + uint* phdrsoff, uint* phdrslen,
490 + uint* pcseqoff, uint* pcseqlen)
492 + uint entitylen = 0;
496 + if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen))
501 + *phdrsoff = *ptcpoff;
502 + while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen))
508 + *ptcpoff += min(entitylen, tcplen - *ptcpoff);
512 + if (lineoff+linelen > tcplen)
514 + INFOP("!! overrun !!\n");
518 + if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0)
520 + *pcseqoff = lineoff;
521 + *pcseqlen = linelen;
523 + if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0)
525 + uint off = lineoff+15;
526 + SKIP_WSPACE(ptcp+lineoff, linelen, off);
527 + nf_strtou32(ptcp+off, &entitylen);
530 + *phdrslen = (*ptcpoff) - (*phdrsoff);
536 + * Find lo/hi client ports (if any) in transport header
538 + * ptcp, tcplen = packet
539 + * tranoff, tranlen = buffer to search
542 + * pport_lo, pport_hi = lo/hi ports (host endian)
544 + * Returns nonzero if any client ports found
546 + * Note: it is valid (and expected) for the client to request multiple
547 + * transports, so we need to parse the entire line.
550 +rtsp_parse_transport(char* ptran, uint tranlen,
551 + struct ip_ct_rtsp_expect* prtspexp)
556 + if (tranlen < 10 || !iseol(ptran[tranlen-1]) ||
557 + nf_strncasecmp(ptran, "Transport:", 10) != 0)
559 + INFOP("sanity check failed\n");
562 + DEBUGP("tran='%.*s'\n", (int)tranlen, ptran);
564 + SKIP_WSPACE(ptran, tranlen, off);
566 + /* Transport: tran;field;field=val,tran;field;field=val,... */
567 + while (off < tranlen)
569 + const char* pparamend;
572 + pparamend = memchr(ptran+off, ',', tranlen-off);
573 + pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
574 + nextparamoff = pparamend-ptran;
576 + while (off < nextparamoff)
578 + const char* pfieldend;
581 + pfieldend = memchr(ptran+off, ';', nextparamoff-off);
582 + nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
584 + if (strncmp(ptran+off, "client_port=", 12) == 0)
590 + numlen = nf_strtou16(ptran+off, &port);
592 + if (prtspexp->loport != 0 && prtspexp->loport != port)
594 + DEBUGP("multiple ports found, port %hu ignored\n", port);
598 + prtspexp->loport = prtspexp->hiport = port;
599 + if (ptran[off] == '-')
602 + numlen = nf_strtou16(ptran+off, &port);
604 + prtspexp->pbtype = pb_range;
605 + prtspexp->hiport = port;
607 + // If we have a range, assume rtp:
608 + // loport must be even, hiport must be loport+1
609 + if ((prtspexp->loport & 0x0001) != 0 ||
610 + prtspexp->hiport != prtspexp->loport+1)
612 + DEBUGP("incorrect range: %hu-%hu, correcting\n",
613 + prtspexp->loport, prtspexp->hiport);
614 + prtspexp->loport &= 0xfffe;
615 + prtspexp->hiport = prtspexp->loport+1;
618 + else if (ptran[off] == '/')
621 + numlen = nf_strtou16(ptran+off, &port);
623 + prtspexp->pbtype = pb_discon;
624 + prtspexp->hiport = port;
631 + * Note we don't look for the destination parameter here.
632 + * If we are using NAT, the NAT module will handle it. If not,
633 + * and the client is sending packets elsewhere, the expectation
634 + * will quietly time out.
637 + off = nextfieldoff;
640 + off = nextparamoff;
646 +/*** conntrack functions ***/
648 +/* outbound packet: client->server */
650 +help_out(const struct iphdr* iph, size_t pktlen,
651 + struct ip_conntrack* ct, enum ip_conntrack_info ctinfo)
653 + int dir = CTINFO2DIR(ctinfo); /* = IP_CT_DIR_ORIGINAL */
654 + struct tcphdr* tcph = (void*)iph + iph->ihl * 4;
655 + uint tcplen = pktlen - iph->ihl * 4;
656 + char* pdata = (char*)tcph + tcph->doff * 4;
657 + uint datalen = tcplen - tcph->doff * 4;
660 + struct ip_conntrack_expect exp;
662 + while (dataoff < datalen)
664 + uint cmdoff = dataoff;
674 + if (!rtsp_parse_message(pdata, datalen, &dataoff,
675 + &hdrsoff, &hdrslen,
676 + &cseqoff, &cseqlen))
678 + break; /* not a valid message */
681 + if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0)
683 + continue; /* not a SETUP message */
685 + DEBUGP("found a setup message\n");
687 + memset(&exp, 0, sizeof(exp));
690 + while (nf_mime_nextline(pdata+hdrsoff, hdrslen, &off,
691 + &lineoff, &linelen))
697 + if (off > hdrsoff+hdrslen)
699 + INFOP("!! overrun !!");
703 + if (nf_strncasecmp(pdata+hdrsoff+lineoff, "Transport:", 10) == 0)
705 + rtsp_parse_transport(pdata+hdrsoff+lineoff, linelen,
706 + &exp.help.exp_rtsp_info);
710 + if (exp.help.exp_rtsp_info.loport == 0)
712 + DEBUGP("no udp transports found\n");
713 + continue; /* no udp transports found */
716 + DEBUGP("udp transport found, ports=(%d,%hu,%hu)\n",
717 + (int)exp.help.exp_rtsp_info.pbtype,
718 + exp.help.exp_rtsp_info.loport,
719 + exp.help.exp_rtsp_info.hiport);
721 + LOCK_BH(&ip_rtsp_lock);
722 + exp.seq = ntohl(tcph->seq) + hdrsoff; /* mark all the headers */
723 + exp.help.exp_rtsp_info.len = hdrslen;
725 + exp.tuple.src.ip = ct->tuplehash[!dir].tuple.src.ip;
726 + exp.mask.src.ip = 0xffffffff;
727 + exp.tuple.dst.ip = ct->tuplehash[dir].tuple.src.ip;
728 + exp.mask.dst.ip = 0xffffffff;
729 + exp.tuple.dst.u.udp.port = exp.help.exp_rtsp_info.loport;
730 + exp.mask.dst.u.udp.port = (exp.help.exp_rtsp_info.pbtype == pb_range) ? 0xfffe : 0xffff;
731 + exp.tuple.dst.protonum = IPPROTO_UDP;
732 + exp.mask.dst.protonum = 0xffff;
734 + DEBUGP("expect_related %u.%u.%u.%u:%u-%u.%u.%u.%u:%u\n",
735 + NIPQUAD(exp.tuple.src.ip),
736 + ntohs(exp.tuple.src.u.tcp.port),
737 + NIPQUAD(exp.tuple.dst.ip),
738 + ntohs(exp.tuple.dst.u.tcp.port));
740 + /* pass the request off to the nat helper */
741 + rc = ip_conntrack_expect_related(ct, &exp);
742 + UNLOCK_BH(&ip_rtsp_lock);
745 + DEBUGP("ip_conntrack_expect_related succeeded\n");
749 + INFOP("ip_conntrack_expect_related failed (%d)\n", rc);
756 +/* inbound packet: server->client */
758 +help_in(const struct iphdr* iph, size_t pktlen,
759 + struct ip_conntrack* ct, enum ip_conntrack_info ctinfo)
765 +help(const struct iphdr* iph, size_t pktlen,
766 + struct ip_conntrack* ct, enum ip_conntrack_info ctinfo)
768 + /* tcplen not negative guarenteed by ip_conntrack_tcp.c */
769 + struct tcphdr* tcph = (void*)iph + iph->ihl * 4;
770 + u_int32_t tcplen = pktlen - iph->ihl * 4;
772 + /* Until there's been traffic both ways, don't look in packets. */
773 + if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY)
775 + DEBUGP("conntrackinfo = %u\n", ctinfo);
779 + /* Not whole TCP header? */
780 + if (tcplen < sizeof(struct tcphdr) || tcplen < tcph->doff * 4)
782 + DEBUGP("tcplen = %u\n", (unsigned)tcplen);
786 + /* Checksum invalid? Ignore. */
787 + /* FIXME: Source route IP option packets --RR */
788 + if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr,
789 + csum_partial((char*)tcph, tcplen, 0)))
791 + DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n",
792 + tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr));
796 + switch (CTINFO2DIR(ctinfo))
798 + case IP_CT_DIR_ORIGINAL:
799 + help_out(iph, pktlen, ct, ctinfo);
801 + case IP_CT_DIR_REPLY:
802 + help_in(iph, pktlen, ct, ctinfo);
809 +static struct ip_conntrack_helper rtsp_helpers[MAX_PORTS];
810 +static char rtsp_names[MAX_PORTS][10];
812 +/* This function is intentionally _NOT_ defined as __exit */
817 + for (i = 0; i < num_ports; i++)
819 + DEBUGP("unregistering port %d\n", ports[i]);
820 + ip_conntrack_helper_unregister(&rtsp_helpers[i]);
828 + struct ip_conntrack_helper *hlpr;
831 + printk("ip_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n");
833 + if (max_outstanding < 1)
835 + printk("ip_conntrack_rtsp: max_outstanding must be a positive integer\n");
838 + if (setup_timeout < 0)
840 + printk("ip_conntrack_rtsp: setup_timeout must be a positive integer\n");
844 + /* If no port given, default to standard rtsp port */
847 + ports[0] = RTSP_PORT;
850 + for (i = 0; (i < MAX_PORTS) && ports[i]; i++)
852 + hlpr = &rtsp_helpers[i];
853 + memset(hlpr, 0, sizeof(struct ip_conntrack_helper));
854 + hlpr->tuple.src.u.tcp.port = htons(ports[i]);
855 + hlpr->tuple.dst.protonum = IPPROTO_TCP;
856 + hlpr->mask.src.u.tcp.port = 0xFFFF;
857 + hlpr->mask.dst.protonum = 0xFFFF;
858 + hlpr->max_expected = max_outstanding;
859 + hlpr->timeout = setup_timeout;
860 + hlpr->flags = IP_CT_HELPER_F_REUSE_EXPECT;
861 + hlpr->me = ip_conntrack_rtsp;
864 + tmpname = &rtsp_names[i][0];
865 + if (ports[i] == RTSP_PORT)
867 + sprintf(tmpname, "rtsp");
871 + sprintf(tmpname, "rtsp-%d", i);
873 + hlpr->name = tmpname;
875 + DEBUGP("port #%d: %d\n", i, ports[i]);
877 + ret = ip_conntrack_helper_register(hlpr);
881 + printk("ip_conntrack_rtsp: ERROR registering port %d\n", ports[i]);
890 +#ifdef CONFIG_IP_NF_NAT_NEEDED
891 +EXPORT_SYMBOL(ip_rtsp_lock);
896 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
897 --- linux-2.4.32.orig/net/ipv4/netfilter/ip_nat_rtsp.c 1970-01-01 01:00:00.000000000 +0100
898 +++ linux-2.4.32/net/ipv4/netfilter/ip_nat_rtsp.c 2005-12-29 12:18:26.000000000 +0100
901 + * RTSP extension for TCP NAT alteration
902 + * (C) 2003 by Tom Marshall <tmarshall@real.com>
903 + * based on ip_nat_irc.c
905 + * This program is free software; you can redistribute it and/or
906 + * modify it under the terms of the GNU General Public License
907 + * as published by the Free Software Foundation; either version
908 + * 2 of the License, or (at your option) any later version.
910 + * Module load syntax:
911 + * insmod ip_nat_rtsp.o ports=port1,port2,...port<MAX_PORTS>
912 + * stunaddr=<address>
913 + * destaction=[auto|strip|none]
915 + * If no ports are specified, the default will be port 554 only.
917 + * stunaddr specifies the address used to detect that a client is using STUN.
918 + * If this address is seen in the destination parameter, it is assumed that
919 + * the client has already punched a UDP hole in the firewall, so we don't
920 + * mangle the client_port. If none is specified, it is autodetected. It
921 + * only needs to be set if you have multiple levels of NAT. It should be
922 + * set to the external address that the STUN clients detect. Note that in
923 + * this case, it will not be possible for clients to use UDP with servers
924 + * between the NATs.
926 + * If no destaction is specified, auto is used.
927 + * destaction=auto: strip destination parameter if it is not stunaddr.
928 + * destaction=strip: always strip destination parameter (not recommended).
929 + * destaction=none: do not touch destination parameter (not recommended).
932 +#include <linux/module.h>
933 +#include <linux/netfilter_ipv4.h>
934 +#include <linux/ip.h>
935 +#include <linux/tcp.h>
936 +#include <linux/kernel.h>
937 +#include <net/tcp.h>
938 +#include <linux/netfilter_ipv4/ip_nat.h>
939 +#include <linux/netfilter_ipv4/ip_nat_helper.h>
940 +#include <linux/netfilter_ipv4/ip_nat_rule.h>
941 +#include <linux/netfilter_ipv4/ip_conntrack_rtsp.h>
942 +#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
944 +#include <linux/inet.h>
945 +#include <linux/ctype.h>
946 +#define NF_NEED_STRNCASECMP
947 +#define NF_NEED_STRTOU16
948 +#include <linux/netfilter_helpers.h>
949 +#define NF_NEED_MIME_NEXTLINE
950 +#include <linux/netfilter_mime.h>
952 +#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
953 +#ifdef IP_NF_RTSP_DEBUG
954 +#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
956 +#define DEBUGP(fmt, args...)
960 +#define DSTACT_AUTO 0
961 +#define DSTACT_STRIP 1
962 +#define DSTACT_NONE 2
964 +static int ports[MAX_PORTS];
965 +static char* stunaddr = NULL;
966 +static char* destaction = NULL;
968 +static int num_ports = 0;
969 +static u_int32_t extip = 0;
970 +static int dstact = 0;
972 +MODULE_AUTHOR("Tom Marshall <tmarshall@real.com>");
973 +MODULE_DESCRIPTION("RTSP network address translation module");
974 +MODULE_LICENSE("GPL");
976 +MODULE_PARM(ports, "1-" __MODULE_STRING(MAX_PORTS) "i");
977 +MODULE_PARM_DESC(ports, "port numbers of RTSP servers");
978 +MODULE_PARM(stunaddr, "s");
979 +MODULE_PARM_DESC(stunaddr, "Address for detecting STUN");
980 +MODULE_PARM(destaction, "s");
981 +MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)");
984 +/* protects rtsp part of conntracks */
985 +DECLARE_LOCK_EXTERN(ip_rtsp_lock);
987 +#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
989 +/*** helper functions ***/
992 +get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen)
994 + struct iphdr* iph = (struct iphdr*)skb->nh.iph;
995 + struct tcphdr* tcph = (struct tcphdr*)((char*)iph + iph->ihl*4);
997 + *pptcpdata = (char*)tcph + tcph->doff*4;
998 + *ptcpdatalen = ((char*)skb->h.raw + skb->len) - *pptcpdata;
1001 +/*** nat functions ***/
1004 + * Mangle the "Transport:" header:
1005 + * - Replace all occurences of "client_port=<spec>"
1006 + * - Handle destination parameter
1009 + * ct, ctinfo = conntrack context
1011 + * tranoff = Transport header offset from TCP data
1012 + * tranlen = Transport header length (incl. CRLF)
1013 + * rport_lo = replacement low port (host endian)
1014 + * rport_hi = replacement high port (host endian)
1016 + * Returns packet size difference.
1018 + * Assumes that a complete transport header is present, ending with CR or LF
1021 +rtsp_mangle_tran(struct ip_conntrack* ct, enum ip_conntrack_info ctinfo,
1022 + struct ip_conntrack_expect* exp,
1023 + struct sk_buff** pskb, uint tranoff, uint tranlen)
1028 + char rbuf1[16]; /* Replacement buffer (one port) */
1029 + uint rbuf1len; /* Replacement len (one port) */
1030 + char rbufa[16]; /* Replacement buffer (all ports) */
1031 + uint rbufalen; /* Replacement len (all ports) */
1033 + u_int16_t loport, hiport;
1035 + uint diff; /* Number of bytes we removed */
1037 + struct ip_ct_rtsp_expect* prtspexp = &exp->help.exp_rtsp_info;
1038 + struct ip_conntrack_tuple t;
1040 + char szextaddr[15+1];
1044 + get_skb_tcpdata(*pskb, &ptcp, &tcplen);
1045 + ptran = ptcp+tranoff;
1047 + if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen ||
1048 + tranlen < 10 || !iseol(ptran[tranlen-1]) ||
1049 + nf_strncasecmp(ptran, "Transport:", 10) != 0)
1051 + INFOP("sanity check failed\n");
1055 + SKIP_WSPACE(ptcp+tranoff, tranlen, off);
1057 + newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip;
1061 + extaddrlen = extip ? sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(extip))
1062 + : sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(newip));
1063 + DEBUGP("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto"));
1065 + rbuf1len = rbufalen = 0;
1066 + switch (prtspexp->pbtype)
1069 + for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */
1071 + t.dst.u.udp.port = htons(loport);
1072 + if (ip_conntrack_change_expect(exp, &t) == 0)
1074 + DEBUGP("using port %hu\n", loport);
1080 + rbuf1len = sprintf(rbuf1, "%hu", loport);
1081 + rbufalen = sprintf(rbufa, "%hu", loport);
1085 + for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */
1087 + t.dst.u.udp.port = htons(loport);
1088 + if (ip_conntrack_change_expect(exp, &t) == 0)
1090 + hiport = loport + ~exp->mask.dst.u.udp.port;
1091 + DEBUGP("using ports %hu-%hu\n", loport, hiport);
1097 + rbuf1len = sprintf(rbuf1, "%hu", loport);
1098 + rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1);
1102 + for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */
1104 + t.dst.u.udp.port = htons(loport);
1105 + if (ip_conntrack_change_expect(exp, &t) == 0)
1107 + DEBUGP("using port %hu (1 of 2)\n", loport);
1111 + for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */
1113 + t.dst.u.udp.port = htons(hiport);
1114 + if (ip_conntrack_change_expect(exp, &t) == 0)
1116 + DEBUGP("using port %hu (2 of 2)\n", hiport);
1120 + if (loport != 0 && hiport != 0)
1122 + rbuf1len = sprintf(rbuf1, "%hu", loport);
1123 + if (hiport == loport+1)
1125 + rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport);
1129 + rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport);
1135 + if (rbuf1len == 0)
1137 + return 0; /* cannot get replacement port(s) */
1140 + /* Transport: tran;field;field=val,tran;field;field=val,... */
1141 + while (off < tranlen)
1144 + const char* pparamend;
1145 + uint nextparamoff;
1147 + pparamend = memchr(ptran+off, ',', tranlen-off);
1148 + pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
1149 + nextparamoff = pparamend-ptcp;
1152 + * We pass over each param twice. On the first pass, we look for a
1153 + * destination= field. It is handled by the security policy. If it
1154 + * is present, allowed, and equal to our external address, we assume
1155 + * that STUN is being used and we leave the client_port= field alone.
1159 + while (off < nextparamoff)
1161 + const char* pfieldend;
1162 + uint nextfieldoff;
1164 + pfieldend = memchr(ptran+off, ';', nextparamoff-off);
1165 + nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
1167 + if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0)
1169 + if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0)
1173 + if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun))
1175 + diff = nextfieldoff-off;
1176 + if (!ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,
1177 + off, diff, NULL, 0))
1179 + /* mangle failed, all we can do is bail */
1182 + get_skb_tcpdata(*pskb, &ptcp, &tcplen);
1183 + ptran = ptcp+tranoff;
1185 + nextparamoff -= diff;
1186 + nextfieldoff -= diff;
1190 + off = nextfieldoff;
1197 + while (off < nextparamoff)
1199 + const char* pfieldend;
1200 + uint nextfieldoff;
1202 + pfieldend = memchr(ptran+off, ';', nextparamoff-off);
1203 + nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
1205 + if (strncmp(ptran+off, "client_port=", 12) == 0)
1211 + char* rbuf = rbuf1;
1212 + uint rbuflen = rbuf1len;
1215 + origoff = (ptran-ptcp)+off;
1217 + numlen = nf_strtou16(ptran+off, &port);
1219 + origlen += numlen;
1220 + if (port != prtspexp->loport)
1222 + DEBUGP("multiple ports found, port %hu ignored\n", port);
1226 + if (ptran[off] == '-' || ptran[off] == '/')
1230 + numlen = nf_strtou16(ptran+off, &port);
1232 + origlen += numlen;
1234 + rbuflen = rbufalen;
1238 + * note we cannot just memcpy() if the sizes are the same.
1239 + * the mangle function does skb resizing, checks for a
1240 + * cloned skb, and updates the checksums.
1242 + * parameter 4 below is offset from start of tcp data.
1244 + diff = origlen-rbuflen;
1245 + if (!ip_nat_mangle_tcp_packet(pskb, ct, ctinfo,
1246 + origoff, origlen, rbuf, rbuflen))
1248 + /* mangle failed, all we can do is bail */
1251 + get_skb_tcpdata(*pskb, &ptcp, &tcplen);
1252 + ptran = ptcp+tranoff;
1254 + nextparamoff -= diff;
1255 + nextfieldoff -= diff;
1259 + off = nextfieldoff;
1262 + off = nextparamoff;
1268 +static unsigned int
1269 +expected(struct sk_buff **pskb, uint hooknum, struct ip_conntrack* ct, struct ip_nat_info* info)
1271 + struct ip_nat_multi_range mr;
1272 + u_int32_t newdstip, newsrcip, newip;
1274 + struct ip_conntrack *master = master_ct(ct);
1276 + IP_NF_ASSERT(info);
1277 + IP_NF_ASSERT(master);
1279 + IP_NF_ASSERT(!(info->initialized & (1 << HOOK2MANIP(hooknum))));
1281 + newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip;
1282 + newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip;
1283 + newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip;
1285 + DEBUGP("newsrcip=%u.%u.%u.%u, newdstip=%u.%u.%u.%u, newip=%u.%u.%u.%u\n",
1286 + NIPQUAD(newsrcip), NIPQUAD(newdstip), NIPQUAD(newip));
1289 + /* We don't want to manip the per-protocol, just the IPs. */
1290 + mr.range[0].flags = IP_NAT_RANGE_MAP_IPS;
1291 + mr.range[0].min_ip = mr.range[0].max_ip = newip;
1293 + return ip_nat_setup_info(ct, &mr, hooknum);
1297 +help_out(struct ip_conntrack* ct, enum ip_conntrack_info ctinfo,
1298 + struct ip_conntrack_expect* exp, struct sk_buff** pskb)
1308 + struct iphdr* iph = (struct iphdr*)(*pskb)->nh.iph;
1309 + struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4);
1311 + struct ip_ct_rtsp_expect* prtspexp = &exp->help.exp_rtsp_info;
1313 + get_skb_tcpdata(*pskb, &ptcp, &tcplen);
1315 + hdrsoff = exp->seq - ntohl(tcph->seq);
1316 + hdrslen = prtspexp->len;
1319 + while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen))
1325 + if (off > hdrsoff+hdrslen)
1327 + INFOP("!! overrun !!");
1330 + DEBUGP("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
1332 + if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0)
1334 + uint oldtcplen = tcplen;
1335 + if (!rtsp_mangle_tran(ct, ctinfo, exp, pskb, lineoff, linelen))
1339 + get_skb_tcpdata(*pskb, &ptcp, &tcplen);
1340 + hdrslen -= (oldtcplen-tcplen);
1341 + off -= (oldtcplen-tcplen);
1342 + lineoff -= (oldtcplen-tcplen);
1343 + linelen -= (oldtcplen-tcplen);
1344 + DEBUGP("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
1352 +help_in(struct ip_conntrack* ct, enum ip_conntrack_info ctinfo,
1353 + struct ip_conntrack_expect* exp, struct sk_buff** pskb)
1355 + /* XXX: unmangle */
1360 +help(struct ip_conntrack* ct,
1361 + struct ip_conntrack_expect* exp,
1362 + struct ip_nat_info* info,
1363 + enum ip_conntrack_info ctinfo,
1364 + unsigned int hooknum,
1365 + struct sk_buff** pskb)
1367 + struct iphdr* iph = (struct iphdr*)(*pskb)->nh.iph;
1368 + struct tcphdr* tcph = (struct tcphdr*)((char*)iph + iph->ihl * 4);
1371 + struct ip_ct_rtsp_expect* ct_rtsp_info;
1372 + int rc = NF_ACCEPT;
1374 + if (ct == NULL || exp == NULL || info == NULL || pskb == NULL)
1376 + DEBUGP("!! null ptr (%p,%p,%p,%p) !!\n", ct, exp, info, pskb);
1380 + ct_rtsp_info = &exp->help.exp_rtsp_info;
1383 + * Only mangle things once: original direction in POST_ROUTING
1384 + * and reply direction on PRE_ROUTING.
1386 + dir = CTINFO2DIR(ctinfo);
1387 + if (!((hooknum == NF_IP_POST_ROUTING && dir == IP_CT_DIR_ORIGINAL)
1388 + || (hooknum == NF_IP_PRE_ROUTING && dir == IP_CT_DIR_REPLY)))
1390 + DEBUGP("Not touching dir %s at hook %s\n",
1391 + dir == IP_CT_DIR_ORIGINAL ? "ORIG" : "REPLY",
1392 + hooknum == NF_IP_POST_ROUTING ? "POSTROUTING"
1393 + : hooknum == NF_IP_PRE_ROUTING ? "PREROUTING"
1394 + : hooknum == NF_IP_LOCAL_OUT ? "OUTPUT" : "???");
1397 + DEBUGP("got beyond not touching\n");
1399 + datalen = (*pskb)->len - iph->ihl * 4 - tcph->doff * 4;
1401 + LOCK_BH(&ip_rtsp_lock);
1402 + /* Ensure the packet contains all of the marked data */
1403 + if (!between(exp->seq + ct_rtsp_info->len,
1404 + ntohl(tcph->seq), ntohl(tcph->seq) + datalen))
1406 + /* Partial retransmission? Probably a hacker. */
1407 + if (net_ratelimit())
1409 + INFOP("partial packet %u/%u in %u/%u\n",
1410 + exp->seq, ct_rtsp_info->len, ntohl(tcph->seq), ntohl(tcph->seq) + datalen);
1412 + UNLOCK_BH(&ip_rtsp_lock);
1418 + case IP_CT_DIR_ORIGINAL:
1419 + rc = help_out(ct, ctinfo, exp, pskb);
1421 + case IP_CT_DIR_REPLY:
1422 + rc = help_in(ct, ctinfo, exp, pskb);
1425 + UNLOCK_BH(&ip_rtsp_lock);
1430 +static struct ip_nat_helper ip_nat_rtsp_helpers[MAX_PORTS];
1431 +static char rtsp_names[MAX_PORTS][10];
1433 +/* This function is intentionally _NOT_ defined as __exit */
1439 + for (i = 0; i < num_ports; i++)
1441 + DEBUGP("unregistering helper for port %d\n", ports[i]);
1442 + ip_nat_helper_unregister(&ip_nat_rtsp_helpers[i]);
1451 + struct ip_nat_helper* hlpr;
1454 + printk("ip_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n");
1456 + if (ports[0] == 0)
1458 + ports[0] = RTSP_PORT;
1461 + for (i = 0; (i < MAX_PORTS) && ports[i] != 0; i++)
1463 + hlpr = &ip_nat_rtsp_helpers[i];
1464 + memset(hlpr, 0, sizeof(struct ip_nat_helper));
1466 + hlpr->tuple.dst.protonum = IPPROTO_TCP;
1467 + hlpr->tuple.src.u.tcp.port = htons(ports[i]);
1468 + hlpr->mask.src.u.tcp.port = 0xFFFF;
1469 + hlpr->mask.dst.protonum = 0xFFFF;
1470 + hlpr->help = help;
1472 + hlpr->me = THIS_MODULE;
1473 + hlpr->expect = expected;
1475 + tmpname = &rtsp_names[i][0];
1476 + if (ports[i] == RTSP_PORT)
1478 + sprintf(tmpname, "rtsp");
1482 + sprintf(tmpname, "rtsp-%d", i);
1484 + hlpr->name = tmpname;
1486 + DEBUGP("registering helper for port %d: name %s\n", ports[i], hlpr->name);
1487 + ret = ip_nat_helper_register(hlpr);
1491 + printk("ip_nat_rtsp: error registering helper for port %d\n", ports[i]);
1497 + if (stunaddr != NULL)
1499 + extip = in_aton(stunaddr);
1501 + if (destaction != NULL)
1503 + if (strcmp(destaction, "auto") == 0)
1505 + dstact = DSTACT_AUTO;
1507 + if (strcmp(destaction, "strip") == 0)
1509 + dstact = DSTACT_STRIP;
1511 + if (strcmp(destaction, "none") == 0)
1513 + dstact = DSTACT_NONE;
1521 diff -urN linux-2.4.32.orig/net/ipv4/netfilter/Makefile linux-2.4.32/net/ipv4/netfilter/Makefile
1522 --- linux-2.4.32.orig/net/ipv4/netfilter/Makefile 2005-12-29 12:17:55.000000000 +0100
1523 +++ linux-2.4.32/net/ipv4/netfilter/Makefile 2005-12-29 12:18:26.000000000 +0100
1525 obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o
1527 # connection tracking helpers
1529 +# rtsp protocol support
1530 +obj-$(CONFIG_IP_NF_RTSP) += ip_conntrack_rtsp.o
1531 +ifdef CONFIG_IP_NF_NAT_RTSP
1532 + export-objs += ip_conntrack_rtsp.o
1534 +obj-$(CONFIG_IP_NF_NAT_RTSP) += ip_nat_rtsp.o
1536 obj-$(CONFIG_IP_NF_AMANDA) += ip_conntrack_amanda.o
1537 ifdef CONFIG_IP_NF_AMANDA
1538 export-objs += ip_conntrack_amanda.o