From 695f6dab7eba79a3b1fb34a501cacd671df4fbb8 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 22 Apr 2010 20:24:06 +0200 Subject: make rb532 bootable from nand again --- target/linux/config/Config.in.fs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'target/linux') diff --git a/target/linux/config/Config.in.fs b/target/linux/config/Config.in.fs index 6e85b0b08..b981c530f 100644 --- a/target/linux/config/Config.in.fs +++ b/target/linux/config/Config.in.fs @@ -1,5 +1,29 @@ menu "Filesystems support" +config ADK_KERNEL_YAFFS_FS + tristate + default n + +config ADK_KERNEL_YAFFS_YAFFS1 + boolean + default n + +config ADK_KERNEL_YAFFS_YAFFS2 + boolean + default n + +config ADK_KERNEL_YAFFS_AUTO_YAFFS2 + boolean + default n + +config ADK_KERNEL_YAFFS_CHECKPOINT_RESERVED_BLOCKS + int + default 0 + +config ADK_KERNEL_YAFFS_SHORT_NAMES_IN_RAM + boolean + default n + config ADK_KERNEL_MISC_FILESYSTEMS boolean default n -- cgit v1.2.3 From ab0fccc6bc1991aa1a9e37fde4b6e27361b7ff44 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 25 Apr 2010 03:14:44 +0200 Subject: fix nat helpers for ipv4, add rtsp nat helper --- target/linux/config/Config.in.netfilter | 291 +--- target/linux/config/Config.in.netfilter.core | 182 ++ target/linux/config/Config.in.netfilter.ebt | 229 +++ target/linux/config/Config.in.netfilter.ip4 | 123 +- target/linux/config/Config.in.netfilter.ip6 | 2 + target/linux/patches/2.6.33/rtsp.patch | 2316 ++++++++++++++++++++++++++ 6 files changed, 2734 insertions(+), 409 deletions(-) create mode 100644 target/linux/config/Config.in.netfilter.core create mode 100644 target/linux/config/Config.in.netfilter.ebt create mode 100644 target/linux/patches/2.6.33/rtsp.patch (limited to 'target/linux') diff --git a/target/linux/config/Config.in.netfilter b/target/linux/config/Config.in.netfilter index e831fd594..cb71b6551 100644 --- a/target/linux/config/Config.in.netfilter +++ b/target/linux/config/Config.in.netfilter @@ -138,62 +138,7 @@ config ADK_KERNEL_IP_NF_MATCH_STRING default n menu "Core Netfilter Configuration" - -config ADK_KPACKAGE_KMOD_NF_CONNTRACK - tristate 'Netfilter connection tracking support' - select ADK_KERNEL_NETFILTER_XTABLES - help - Connection tracking keeps a record of what packets have passed - through your machine, in order to figure out how they are related - into connections. - - Layer 3 independent connection tracking is experimental scheme - which generalize ip_conntrack to support other layer 3 protocols. - -config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_CLASSIFY - tristate '"CLASSIFY" target support' - select ADK_KERNEL_NETFILTER_XTABLES - help - This option adds a `CLASSIFY' target, which enables the user to set - the priority of a packet. Some qdiscs can use this value for - classification, among these are: - - atm, cbq, dsmark, pfifo_fast, htb, prio - -config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_CONNMARK - tristate '"CONNMARK" target support' - select ADK_KERNEL_NETFILTER_XTABLES - select ADK_KPACKAGE_KMOD_NF_CONNTRACK - help - This option adds a `CONNMARK' target, which allows one to manipulate - the connection mark value. Similar to the MARK target, but - affects the connection mark value rather than the packet mark value. - -config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_MARK - tristate '"MARK" target support' - select ADK_KERNEL_NETFILTER_XTABLES - help - This option adds a `MARK' target, which allows you to create rules - in the `mangle' table which alter the netfilter mark (nfmark) field - associated with the packet prior to routing. This can change - the routing method (see `Use netfilter MARK value as routing - key') and can also be used by other subsystems to change their - behavior. - -config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_NFQUEUE - tristate '"NFQUEUE" target support' - select ADK_KERNEL_NETFILTER_XTABLES - help - This target replaced the old obsolete QUEUE target. - - As opposed to QUEUE, it supports 65535 different queues, - not just one. - -config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_TCPMSS - tristate 'TCPMSS target' - select ADK_KERNEL_NETFILTER_XTABLES - help - +source target/linux/config/Config.in.netfilter.core endmenu menu "IP: Netfilter Configuration" @@ -206,239 +151,11 @@ source target/linux/config/Config.in.netfilter.ip6 endmenu menu "Ethernet bridge firewalling" - -config ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - tristate 'Ethernet Bridge tables (ebtables) support' - select ADK_KERNEL_BRIDGE_NETFILTER - help - ebtables is a general, extensible frame/packet identification - framework. Say 'Y' or 'M' here if you want to do Ethernet - filtering/NAT/brouting on the Ethernet bridge. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_BROUTE - tristate "ebt: broute table support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - The ebtables broute table is used to define rules that decide between - bridging and routing frames, giving Linux the functionality of a - brouter. See the man page for ebtables(8) and examples on the ebtables - website. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_T_FILTER - tristate "ebt: filter table support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - The ebtables filter table is used to define frame filtering rules at - local input, forwarding and local output. See the man page for - ebtables(8). - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_T_NAT - tristate "ebt: nat table support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - The ebtables nat table is used to define rules that alter the MAC - source address (MAC SNAT) or the MAC destination address (MAC DNAT). - See the man page for ebtables(8). - - To compile it as a module, choose M here. If unsure, say N. -# -# matches -# -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_802_3 - tristate "ebt: 802.3 filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds matching support for 802.3 Ethernet frames. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_AMONG - tristate "ebt: among filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the among match, which allows matching the MAC source - and/or destination address on a list of addresses. Optionally, - MAC/IP address pairs can be matched, f.e. for anti-spoofing rules. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_ARP - tristate "ebt: ARP filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the ARP match, which allows ARP and RARP header field - filtering. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_IP - tristate "ebt: IP filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the IP match, which allows basic IP header field - filtering. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_IP6 - tristate "ebt: IP6 filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES && ADK_KPACKAGE_KMOD_IPV6 - help - This option adds the IP6 match, which allows basic IPV6 header field - filtering. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_LIMIT - tristate "ebt: limit match support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the limit match, which allows you to control - the rate at which a rule can be matched. This match is the - equivalent of the iptables limit match. - - If you want to compile it as a module, say M here and read - . If unsure, say `N'. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_MARK - tristate "ebt: mark filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the mark match, which allows matching frames based on - the 'nfmark' value in the frame. This can be set by the mark target. - This value is the same as the one used in the iptables mark match and - target. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_PKTTYPE - tristate "ebt: packet type filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the packet type match, which allows matching on the - type of packet based on its Ethernet "class" (as determined by - the generic networking code): broadcast, multicast, - for this host alone or for another host. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_STP - tristate "ebt: STP filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the Spanning Tree Protocol match, which - allows STP header field filtering. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_VLAN - tristate "ebt: 802.1Q VLAN filter support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the 802.1Q vlan match, which allows the filtering of - 802.1Q vlan fields. - - To compile it as a module, choose M here. If unsure, say N. -# -# targets -# -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_ARPREPLY - tristate "ebt: arp reply target support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the arp reply target, which allows - automatically sending arp replies to arp requests. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_DNAT - tristate "ebt: dnat target support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the MAC DNAT target, which allows altering the MAC - destination address of frames. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_MARK_T - tristate "ebt: mark target support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the mark target, which allows marking frames by - setting the 'nfmark' value in the frame. - This value is the same as the one used in the iptables mark match and - target. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_REDIRECT - tristate "ebt: redirect target support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the MAC redirect target, which allows altering the MAC - destination address of a frame to that of the device it arrived on. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_SNAT - tristate "ebt: snat target support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the MAC SNAT target, which allows altering the MAC - source address of frames. - - To compile it as a module, choose M here. If unsure, say N. -# -# watchers -# -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_LOG - tristate "ebt: log support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option adds the log watcher, that you can use in any rule - in any ebtables table. It records info about the frame header - to the syslog. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_ULOG - tristate "ebt: ulog support (OBSOLETE)" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option enables the old bridge-specific "ebt_ulog" implementation - which has been obsoleted by the new "nfnetlink_log" code (see - CONFIG_NETFILTER_NETLINK_LOG). - - This option adds the ulog watcher, that you can use in any rule - in any ebtables table. The packet is passed to a userspace - logging daemon using netlink multicast sockets. This differs - from the log watcher in the sense that the complete packet is - sent to userspace instead of a descriptive text and that - netlink multicast sockets are used instead of the syslog. - - To compile it as a module, choose M here. If unsure, say N. - -config ADK_KPACKAGE_KMOD_BRIDGE_EBT_NFLOG - tristate "ebt: nflog support" - depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES - help - This option enables the nflog watcher, which allows to LOG - messages through the netfilter logging API, which can use - either the old LOG target, the old ULOG target or nfnetlink_log - as backend. - - This option adds the nflog watcher, that you can use in any rule - in any ebtables table. - - To compile it as a module, choose M here. If unsure, say N. - - +source target/linux/config/Config.in.netfilter.ebt endmenu +menu "Netfilter Addons" source package/ipset/Config.in.kmod +endmenu endmenu diff --git a/target/linux/config/Config.in.netfilter.core b/target/linux/config/Config.in.netfilter.core new file mode 100644 index 000000000..0231b2d13 --- /dev/null +++ b/target/linux/config/Config.in.netfilter.core @@ -0,0 +1,182 @@ +config ADK_KPACKAGE_KMOD_NF_CONNTRACK + tristate 'Netfilter connection tracking support' + select ADK_KERNEL_NETFILTER_XTABLES + help + Connection tracking keeps a record of what packets have passed + through your machine, in order to figure out how they are related + into connections. + + Layer 3 independent connection tracking is experimental scheme + which generalize ip_conntrack to support other layer 3 protocols. + +config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_CLASSIFY + tristate '"CLASSIFY" target support' + select ADK_KERNEL_NETFILTER_XTABLES + help + This option adds a `CLASSIFY' target, which enables the user to set + the priority of a packet. Some qdiscs can use this value for + classification, among these are: + + atm, cbq, dsmark, pfifo_fast, htb, prio + +config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_CONNMARK + tristate '"CONNMARK" target support' + select ADK_KERNEL_NETFILTER_XTABLES + select ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + This option adds a `CONNMARK' target, which allows one to manipulate + the connection mark value. Similar to the MARK target, but + affects the connection mark value rather than the packet mark value. + +config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_MARK + tristate '"MARK" target support' + select ADK_KERNEL_NETFILTER_XTABLES + help + This option adds a `MARK' target, which allows you to create rules + in the `mangle' table which alter the netfilter mark (nfmark) field + associated with the packet prior to routing. This can change + the routing method (see `Use netfilter MARK value as routing + key') and can also be used by other subsystems to change their + behavior. + +config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_NFQUEUE + tristate '"NFQUEUE" target support' + select ADK_KERNEL_NETFILTER_XTABLES + help + This target replaced the old obsolete QUEUE target. + + As opposed to QUEUE, it supports 65535 different queues, + not just one. + +config ADK_KPACKAGE_KMOD_NETFILTER_XT_TARGET_TCPMSS + tristate 'TCPMSS target' + select ADK_KERNEL_NETFILTER_XTABLES + help + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_MARK + bool 'Connection mark tracking support' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + select ADK_KERNEL_IP_NF_MATCH_CONNMARK + help + This option enables support for connection marks, used by the + `CONNMARK' target and `connmark' match. Similar to the mark value + of packets, but this mark value is kept in the conntrack session + instead of the individual packets. + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_SECMARK + bool 'Connection tracking security mark support' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + #FIXME select NETWORK_SECMARK + help + This option enables security markings to be applied to + connections. Typically they are copied to connections from + packets using the CONNSECMARK target and copied back from + connections to packets with the same target, with the packets + being originally labeled via SECMARK. + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_FTP + tristate 'FTP protocol support' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + Tracking FTP connections is problematic: special helpers are + required for tracking them, and doing masquerading and other forms + of Network Address Translation on them. + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_RTSP + tristate 'RTSP protocol support' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + Tracking RTSP connections might be required for IPTV. + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_IRC + tristate 'IRC protocol support' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + There is a commonly-used extension to IRC called + Direct Client-to-Client Protocol (DCC). This enables users to send + files to each other, and also chat to each other without the need + of a server. DCC Sending is used anywhere you send files over IRC, + and DCC Chat is most commonly used by Eggdrop bots. If you are + using NAT, this extension will enable you to send files and initiate + chats. Note that you do NOT need this extension to get files or + have others initiate chats, or everything else in IRC. + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_NETBIOS_NS + tristate 'NetBIOS name service protocol support (EXPERIMENTAL)' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + NetBIOS name service requests are sent as broadcast messages from an + unprivileged port and responded to with unicast messages to the + same port. This make them hard to firewall properly because connection + tracking doesn't deal with broadcasts. This helper tracks locally + originating NetBIOS name service requests and the corresponding + responses. It relies on correct IP address configuration, specifically + netmask and broadcast address. When properly configured, the output + of "ip address show" should look similar to this: + + $ ip -4 address show eth0 + 4: eth0: mtu 1500 qdisc pfifo_fast qlen 1000 + inet 172.16.2.252/24 brd 172.16.2.255 scope global eth0 + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_TFTP + tristate 'TFTP protocol support' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + TFTP connection tracking helper, this is required depending + on how restrictive your ruleset is. + If you are using a tftp client behind -j SNAT or -j MASQUERADING + you will need this. + +#config ADK_KPACKAGE_KMOD_NF_CONNTRACK_AMANDA +# tristate 'Amanda backup protocol support' +# depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK +# #FIXME TEXTSEARCH && TEXTSEARCH_KMP +# help +# If you are running the Amanda backup package +# on this machine or machines that will be MASQUERADED through this +# machine, then you may want to enable this feature. This allows the +# connection tracking and natting code to allow the sub-channels that +# Amanda requires for communication of the backup data, messages and +# index. + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_PPTP + tristate 'PPTP protocol support' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + This module adds support for PPTP (Point to Point Tunnelling + Protocol, RFC2637) connection tracking and NAT. + + If you are running PPTP sessions over a stateful firewall or NAT + box, you may want to enable this feature. + + Please note that not all PPTP modes of operation are supported yet. + For more info, read top of the file + net/ipv4/netfilter/ip_conntrack_pptp.c + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_H323 + tristate 'H.323 protocol support (EXPERIMENTAL)' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + H.323 is a VoIP signalling protocol from ITU-T. As one of the most + important VoIP protocols, it is widely used by voice hardware and + software including voice gateways, IP phones, Netmeeting, OpenPhone, + Gnomemeeting, etc. + + With this module you can support H.323 on a connection tracking/NAT + firewall. + + This module supports RAS, Fast Start, H.245 Tunnelling, Call + Forwarding, RTP/RTCP and T.120 based audio, video, fax, chat, + whiteboard, file transfer, etc. For more information, please + visit http://nath323.sourceforge.net/. + +config ADK_KPACKAGE_KMOD_NF_CONNTRACK_SIP + tristate 'SIP protocol support (EXPERIMENTAL)' + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK + help + SIP is an application-layer control protocol that can establish, + modify, and terminate multimedia sessions (conferences) such as + Internet telephony calls. With the ip_conntrack_sip and + the ip_nat_sip modules you can support the protocol on a connection + tracking/NATing firewall. + diff --git a/target/linux/config/Config.in.netfilter.ebt b/target/linux/config/Config.in.netfilter.ebt new file mode 100644 index 000000000..9dfb5e5b9 --- /dev/null +++ b/target/linux/config/Config.in.netfilter.ebt @@ -0,0 +1,229 @@ +config ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + tristate 'Ethernet Bridge tables (ebtables) support' + select ADK_KERNEL_BRIDGE_NETFILTER + help + ebtables is a general, extensible frame/packet identification + framework. Say 'Y' or 'M' here if you want to do Ethernet + filtering/NAT/brouting on the Ethernet bridge. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_BROUTE + tristate "ebt: broute table support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + The ebtables broute table is used to define rules that decide between + bridging and routing frames, giving Linux the functionality of a + brouter. See the man page for ebtables(8) and examples on the ebtables + website. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_T_FILTER + tristate "ebt: filter table support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + The ebtables filter table is used to define frame filtering rules at + local input, forwarding and local output. See the man page for + ebtables(8). + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_T_NAT + tristate "ebt: nat table support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + The ebtables nat table is used to define rules that alter the MAC + source address (MAC SNAT) or the MAC destination address (MAC DNAT). + See the man page for ebtables(8). + + To compile it as a module, choose M here. If unsure, say N. +# +# matches +# +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_802_3 + tristate "ebt: 802.3 filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds matching support for 802.3 Ethernet frames. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_AMONG + tristate "ebt: among filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the among match, which allows matching the MAC source + and/or destination address on a list of addresses. Optionally, + MAC/IP address pairs can be matched, f.e. for anti-spoofing rules. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_ARP + tristate "ebt: ARP filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the ARP match, which allows ARP and RARP header field + filtering. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_IP + tristate "ebt: IP filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the IP match, which allows basic IP header field + filtering. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_IP6 + tristate "ebt: IP6 filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES && ADK_KPACKAGE_KMOD_IPV6 + help + This option adds the IP6 match, which allows basic IPV6 header field + filtering. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_LIMIT + tristate "ebt: limit match support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the limit match, which allows you to control + the rate at which a rule can be matched. This match is the + equivalent of the iptables limit match. + + If you want to compile it as a module, say M here and read + . If unsure, say `N'. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_MARK + tristate "ebt: mark filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the mark match, which allows matching frames based on + the 'nfmark' value in the frame. This can be set by the mark target. + This value is the same as the one used in the iptables mark match and + target. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_PKTTYPE + tristate "ebt: packet type filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the packet type match, which allows matching on the + type of packet based on its Ethernet "class" (as determined by + the generic networking code): broadcast, multicast, + for this host alone or for another host. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_STP + tristate "ebt: STP filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the Spanning Tree Protocol match, which + allows STP header field filtering. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_VLAN + tristate "ebt: 802.1Q VLAN filter support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the 802.1Q vlan match, which allows the filtering of + 802.1Q vlan fields. + + To compile it as a module, choose M here. If unsure, say N. +# +# targets +# +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_ARPREPLY + tristate "ebt: arp reply target support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the arp reply target, which allows + automatically sending arp replies to arp requests. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_DNAT + tristate "ebt: dnat target support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the MAC DNAT target, which allows altering the MAC + destination address of frames. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_MARK_T + tristate "ebt: mark target support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the mark target, which allows marking frames by + setting the 'nfmark' value in the frame. + This value is the same as the one used in the iptables mark match and + target. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_REDIRECT + tristate "ebt: redirect target support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the MAC redirect target, which allows altering the MAC + destination address of a frame to that of the device it arrived on. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_SNAT + tristate "ebt: snat target support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the MAC SNAT target, which allows altering the MAC + source address of frames. + + To compile it as a module, choose M here. If unsure, say N. +# +# watchers +# +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_LOG + tristate "ebt: log support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option adds the log watcher, that you can use in any rule + in any ebtables table. It records info about the frame header + to the syslog. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_ULOG + tristate "ebt: ulog support (OBSOLETE)" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option enables the old bridge-specific "ebt_ulog" implementation + which has been obsoleted by the new "nfnetlink_log" code (see + CONFIG_NETFILTER_NETLINK_LOG). + + This option adds the ulog watcher, that you can use in any rule + in any ebtables table. The packet is passed to a userspace + logging daemon using netlink multicast sockets. This differs + from the log watcher in the sense that the complete packet is + sent to userspace instead of a descriptive text and that + netlink multicast sockets are used instead of the syslog. + + To compile it as a module, choose M here. If unsure, say N. + +config ADK_KPACKAGE_KMOD_BRIDGE_EBT_NFLOG + tristate "ebt: nflog support" + depends on ADK_KPACKAGE_KMOD_BRIDGE_NF_EBTABLES + help + This option enables the nflog watcher, which allows to LOG + messages through the netfilter logging API, which can use + either the old LOG target, the old ULOG target or nfnetlink_log + as backend. + + This option adds the nflog watcher, that you can use in any rule + in any ebtables table. + + To compile it as a module, choose M here. If unsure, say N. + diff --git a/target/linux/config/Config.in.netfilter.ip4 b/target/linux/config/Config.in.netfilter.ip4 index 34eb14449..95a71b917 100644 --- a/target/linux/config/Config.in.netfilter.ip4 +++ b/target/linux/config/Config.in.netfilter.ip4 @@ -8,7 +8,7 @@ config ADK_KPACKAGE_KMOD_NF_CONNTRACK_IPV4 config ADK_KPACKAGE_KMOD_IP_NF_CT_ACCT bool 'Connection tracking flow accounting' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK + depends on ADK_KPACKAGE_KMOD_NF_CONNTRACK help If this option is enabled, the connection tracking code will keep per-flow packet and byte counters. @@ -16,127 +16,6 @@ config ADK_KPACKAGE_KMOD_IP_NF_CT_ACCT Those counters can be used for flow-based accounting or the `connbytes' match. -config ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK_MARK - bool 'Connection mark tracking support' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - select ADK_KERNEL_IP_NF_MATCH_CONNMARK - help - This option enables support for connection marks, used by the - `CONNMARK' target and `connmark' match. Similar to the mark value - of packets, but this mark value is kept in the conntrack session - instead of the individual packets. - -config ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK_SECMARK - bool 'Connection tracking security mark support' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - #FIXME select NETWORK_SECMARK - help - This option enables security markings to be applied to - connections. Typically they are copied to connections from - packets using the CONNSECMARK target and copied back from - connections to packets with the same target, with the packets - being originally labeled via SECMARK. - -config ADK_KPACKAGE_KMOD_IP_NF_FTP - tristate 'FTP protocol support' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - help - Tracking FTP connections is problematic: special helpers are - required for tracking them, and doing masquerading and other forms - of Network Address Translation on them. - -config ADK_KPACKAGE_KMOD_IP_NF_IRC - tristate 'IRC protocol support' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - help - There is a commonly-used extension to IRC called - Direct Client-to-Client Protocol (DCC). This enables users to send - files to each other, and also chat to each other without the need - of a server. DCC Sending is used anywhere you send files over IRC, - and DCC Chat is most commonly used by Eggdrop bots. If you are - using NAT, this extension will enable you to send files and initiate - chats. Note that you do NOT need this extension to get files or - have others initiate chats, or everything else in IRC. - -config ADK_KPACKAGE_KMOD_IP_NF_NETBIOS_NS - tristate 'NetBIOS name service protocol support (EXPERIMENTAL)' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - help - NetBIOS name service requests are sent as broadcast messages from an - unprivileged port and responded to with unicast messages to the - same port. This make them hard to firewall properly because connection - tracking doesn't deal with broadcasts. This helper tracks locally - originating NetBIOS name service requests and the corresponding - responses. It relies on correct IP address configuration, specifically - netmask and broadcast address. When properly configured, the output - of "ip address show" should look similar to this: - - $ ip -4 address show eth0 - 4: eth0: mtu 1500 qdisc pfifo_fast qlen 1000 - inet 172.16.2.252/24 brd 172.16.2.255 scope global eth0 - -config ADK_KPACKAGE_KMOD_IP_NF_TFTP - tristate 'TFTP protocol support' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - help - TFTP connection tracking helper, this is required depending - on how restrictive your ruleset is. - If you are using a tftp client behind -j SNAT or -j MASQUERADING - you will need this. - -config ADK_KPACKAGE_KMOD_IP_NF_AMANDA - tristate 'Amanda backup protocol support' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - #FIXME TEXTSEARCH && TEXTSEARCH_KMP - help - If you are running the Amanda backup package - on this machine or machines that will be MASQUERADED through this - machine, then you may want to enable this feature. This allows the - connection tracking and natting code to allow the sub-channels that - Amanda requires for communication of the backup data, messages and - index. - -config ADK_KPACKAGE_KMOD_IP_NF_PPTP - tristate 'PPTP protocol support' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - help - This module adds support for PPTP (Point to Point Tunnelling - Protocol, RFC2637) connection tracking and NAT. - - If you are running PPTP sessions over a stateful firewall or NAT - box, you may want to enable this feature. - - Please note that not all PPTP modes of operation are supported yet. - For more info, read top of the file - net/ipv4/netfilter/ip_conntrack_pptp.c - -config ADK_KPACKAGE_KMOD_IP_NF_H323 - tristate 'H.323 protocol support (EXPERIMENTAL)' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - help - H.323 is a VoIP signalling protocol from ITU-T. As one of the most - important VoIP protocols, it is widely used by voice hardware and - software including voice gateways, IP phones, Netmeeting, OpenPhone, - Gnomemeeting, etc. - - With this module you can support H.323 on a connection tracking/NAT - firewall. - - This module supports RAS, Fast Start, H.245 Tunnelling, Call - Forwarding, RTP/RTCP and T.120 based audio, video, fax, chat, - whiteboard, file transfer, etc. For more information, please - visit http://nath323.sourceforge.net/. - -config ADK_KPACKAGE_KMOD_IP_NF_SIP - tristate 'SIP protocol support (EXPERIMENTAL)' - depends on ADK_KPACKAGE_KMOD_IP_NF_CONNTRACK - help - SIP is an application-layer control protocol that can establish, - modify, and terminate multimedia sessions (conferences) such as - Internet telephony calls. With the ip_conntrack_sip and - the ip_nat_sip modules you can support the protocol on a connection - tracking/NATing firewall. - config ADK_KPACKAGE_KMOD_IP_NF_IPTABLES tristate 'IP tables support (required for filtering/masq/NAT)' diff --git a/target/linux/config/Config.in.netfilter.ip6 b/target/linux/config/Config.in.netfilter.ip6 index a0bb7beba..cb9700cbd 100644 --- a/target/linux/config/Config.in.netfilter.ip6 +++ b/target/linux/config/Config.in.netfilter.ip6 @@ -1,6 +1,7 @@ config ADK_KPACKAGE_KMOD_NF_CONNTRACK_IPV6 tristate "IPv6 connection tracking support" select ADK_KPACKAGE_KMOD_NF_CONNTRACK + select ADK_KPACKAGE_KMOD_IPV6 ---help--- Connection tracking keeps a record of what packets have passed through your machine, in order to figure out how they are related @@ -15,6 +16,7 @@ config ADK_KPACKAGE_KMOD_NF_CONNTRACK_IPV6 config ADK_KPACKAGE_KMOD_IP6_NF_IPTABLES tristate "IP6 tables support (required for filtering)" select ADK_KERNEL_NETFILTER_XTABLES + select ADK_KPACKAGE_KMOD_IPV6 help ip6tables is a general, extensible packet identification framework. Currently only the packet filtering and packet mangling subsystem diff --git a/target/linux/patches/2.6.33/rtsp.patch b/target/linux/patches/2.6.33/rtsp.patch new file mode 100644 index 000000000..317c06d8e --- /dev/null +++ b/target/linux/patches/2.6.33/rtsp.patch @@ -0,0 +1,2316 @@ +diff -Nur linux-2.6.33.orig/include/linux/netfilter/nf_conntrack_rtsp.h linux-2.6.33/include/linux/netfilter/nf_conntrack_rtsp.h +--- linux-2.6.33.orig/include/linux/netfilter/nf_conntrack_rtsp.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.33/include/linux/netfilter/nf_conntrack_rtsp.h 2010-04-25 01:09:20.000000000 +0200 +@@ -0,0 +1,63 @@ ++/* ++ * RTSP extension for IP connection tracking. ++ * (C) 2003 by Tom Marshall ++ * 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 1 ++#define IP_NF_RTSP_VERSION "0.6.21" ++ ++#ifdef __KERNEL__ ++/* 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 ++}; ++ ++extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb, ++ enum ip_conntrack_info ctinfo, ++ unsigned int matchoff, unsigned int matchlen, ++ struct ip_ct_rtsp_expect *prtspexp, ++ struct nf_conntrack_expect *exp); ++ ++extern void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp); ++ ++#define RTSP_PORT 554 ++ ++#endif /* __KERNEL__ */ ++ ++#endif /* _IP_CONNTRACK_RTSP_H */ +diff -Nur linux-2.6.33.orig/include/linux/netfilter_helpers.h linux-2.6.33/include/linux/netfilter_helpers.h +--- linux-2.6.33.orig/include/linux/netfilter_helpers.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.33/include/linux/netfilter_helpers.h 2010-04-25 01:09:20.000000000 +0200 +@@ -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 ++#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 -Nur linux-2.6.33.orig/include/linux/netfilter_mime.h linux-2.6.33/include/linux/netfilter_mime.h +--- linux-2.6.33.orig/include/linux/netfilter_mime.h 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.33/include/linux/netfilter_mime.h 2010-04-25 01:09:20.000000000 +0200 +@@ -0,0 +1,89 @@ ++/* ++ * 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 ++ ++/* ++ * 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 -Nur linux-2.6.33.orig/net/ipv4/netfilter/Kconfig linux-2.6.33/net/ipv4/netfilter/Kconfig +--- linux-2.6.33.orig/net/ipv4/netfilter/Kconfig 2010-02-24 19:52:17.000000000 +0100 ++++ linux-2.6.33/net/ipv4/netfilter/Kconfig 2010-04-25 01:09:20.000000000 +0200 +@@ -257,6 +257,11 @@ + depends on NF_CONNTRACK && NF_NAT + default NF_NAT && NF_CONNTRACK_IRC + ++config NF_NAT_RTSP ++ tristate ++ depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT ++ default NF_NAT && NF_CONNTRACK_RTSP ++ + config NF_NAT_TFTP + tristate + depends on NF_CONNTRACK && NF_NAT +diff -Nur linux-2.6.33.orig/net/ipv4/netfilter/Makefile linux-2.6.33/net/ipv4/netfilter/Makefile +--- linux-2.6.33.orig/net/ipv4/netfilter/Makefile 2010-02-24 19:52:17.000000000 +0100 ++++ linux-2.6.33/net/ipv4/netfilter/Makefile 2010-04-25 01:09:20.000000000 +0200 +@@ -26,6 +26,7 @@ + obj-$(CONFIG_NF_NAT_FTP) += nf_nat_ftp.o + obj-$(CONFIG_NF_NAT_H323) += nf_nat_h323.o + obj-$(CONFIG_NF_NAT_IRC) += nf_nat_irc.o ++obj-$(CONFIG_NF_NAT_RTSP) += nf_nat_rtsp.o + obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o + obj-$(CONFIG_NF_NAT_SIP) += nf_nat_sip.o + obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o +diff -Nur linux-2.6.33.orig/net/ipv4/netfilter/nf_nat_rtsp.c linux-2.6.33/net/ipv4/netfilter/nf_nat_rtsp.c +--- linux-2.6.33.orig/net/ipv4/netfilter/nf_nat_rtsp.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.33/net/ipv4/netfilter/nf_nat_rtsp.c 2010-04-25 01:09:20.000000000 +0200 +@@ -0,0 +1,496 @@ ++/* ++ * RTSP extension for TCP NAT alteration ++ * (C) 2003 by Tom Marshall ++ * based on ip_nat_irc.c ++ * ++ * 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. ++ * ++ * Module load syntax: ++ * insmod nf_nat_rtsp.o ports=port1,port2,...port ++ * stunaddr=
++ * destaction=[auto|strip|none] ++ * ++ * If no ports are specified, the default will be port 554 only. ++ * ++ * stunaddr specifies the address used to detect that a client is using STUN. ++ * If this address is seen in the destination parameter, it is assumed that ++ * the client has already punched a UDP hole in the firewall, so we don't ++ * mangle the client_port. If none is specified, it is autodetected. It ++ * only needs to be set if you have multiple levels of NAT. It should be ++ * set to the external address that the STUN clients detect. Note that in ++ * this case, it will not be possible for clients to use UDP with servers ++ * between the NATs. ++ * ++ * If no destaction is specified, auto is used. ++ * destaction=auto: strip destination parameter if it is not stunaddr. ++ * destaction=strip: always strip destination parameter (not recommended). ++ * destaction=none: do not touch destination parameter (not recommended). ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#define NF_NEED_STRNCASECMP ++#define NF_NEED_STRTOU16 ++#include ++#define NF_NEED_MIME_NEXTLINE ++#include ++ ++#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) ++#if 0 ++#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args) ++#else ++#define DEBUGP(fmt, args...) ++#endif ++ ++#define MAX_PORTS 8 ++#define DSTACT_AUTO 0 ++#define DSTACT_STRIP 1 ++#define DSTACT_NONE 2 ++ ++static char* stunaddr = NULL; ++static char* destaction = NULL; ++ ++static u_int32_t extip = 0; ++static int dstact = 0; ++ ++MODULE_AUTHOR("Tom Marshall "); ++MODULE_DESCRIPTION("RTSP network address translation module"); ++MODULE_LICENSE("GPL"); ++module_param(stunaddr, charp, 0644); ++MODULE_PARM_DESC(stunaddr, "Address for detecting STUN"); ++module_param(destaction, charp, 0644); ++MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)"); ++ ++#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; } ++ ++/*** helper functions ***/ ++ ++static void ++get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen) ++{ ++ struct iphdr* iph = ip_hdr(skb); ++ struct tcphdr* tcph = (void *)iph + ip_hdrlen(skb); ++ ++ *pptcpdata = (char*)tcph + tcph->doff*4; ++ *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata; ++} ++ ++/*** nat functions ***/ ++ ++/* ++ * Mangle the "Transport:" header: ++ * - Replace all occurences of "client_port=" ++ * - Handle destination parameter ++ * ++ * In: ++ * ct, ctinfo = conntrack context ++ * skb = packet ++ * tranoff = Transport header offset from TCP data ++ * tranlen = Transport header length (incl. CRLF) ++ * rport_lo = replacement low port (host endian) ++ * rport_hi = replacement high port (host endian) ++ * ++ * Returns packet size difference. ++ * ++ * Assumes that a complete transport header is present, ending with CR or LF ++ */ ++static int ++rtsp_mangle_tran(enum ip_conntrack_info ctinfo, ++ struct nf_conntrack_expect* exp, ++ struct ip_ct_rtsp_expect* prtspexp, ++ struct sk_buff* skb, uint tranoff, uint tranlen) ++{ ++ char* ptcp; ++ uint tcplen; ++ char* ptran; ++ char rbuf1[16]; /* Replacement buffer (one port) */ ++ uint rbuf1len; /* Replacement len (one port) */ ++ char rbufa[16]; /* Replacement buffer (all ports) */ ++ uint rbufalen; /* Replacement len (all ports) */ ++ u_int32_t newip; ++ u_int16_t loport, hiport; ++ uint off = 0; ++ uint diff; /* Number of bytes we removed */ ++ ++ struct nf_conn *ct = exp->master; ++ struct nf_conntrack_tuple *t; ++ ++ char szextaddr[15+1]; ++ uint extaddrlen; ++ int is_stun; ++ ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ ptran = ptcp+tranoff; ++ ++ if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen || ++ tranlen < 10 || !iseol(ptran[tranlen-1]) || ++ nf_strncasecmp(ptran, "Transport:", 10) != 0) ++ { ++ INFOP("sanity check failed\n"); ++ return 0; ++ } ++ off += 10; ++ SKIP_WSPACE(ptcp+tranoff, tranlen, off); ++ ++ newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip; ++ t = &exp->tuple; ++ t->dst.u3.ip = newip; ++ ++ extaddrlen = extip ? sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(extip)) ++ : sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(newip)); ++ DEBUGP("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto")); ++ ++ rbuf1len = rbufalen = 0; ++ switch (prtspexp->pbtype) ++ { ++ case pb_single: ++ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(loport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ DEBUGP("using port %hu\n", loport); ++ break; ++ } ++ } ++ if (loport != 0) ++ { ++ rbuf1len = sprintf(rbuf1, "%hu", loport); ++ rbufalen = sprintf(rbufa, "%hu", loport); ++ } ++ break; ++ case pb_range: ++ for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(loport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ hiport = loport + ~exp->mask.src.u.udp.port; ++ DEBUGP("using ports %hu-%hu\n", loport, hiport); ++ break; ++ } ++ } ++ if (loport != 0) ++ { ++ rbuf1len = sprintf(rbuf1, "%hu", loport); ++ rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1); ++ } ++ break; ++ case pb_discon: ++ for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(loport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ DEBUGP("using port %hu (1 of 2)\n", loport); ++ break; ++ } ++ } ++ for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */ ++ { ++ t->dst.u.udp.port = htons(hiport); ++ if (nf_ct_expect_related(exp) == 0) ++ { ++ DEBUGP("using port %hu (2 of 2)\n", hiport); ++ break; ++ } ++ } ++ if (loport != 0 && hiport != 0) ++ { ++ rbuf1len = sprintf(rbuf1, "%hu", loport); ++ if (hiport == loport+1) ++ { ++ rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport); ++ } ++ else ++ { ++ rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport); ++ } ++ } ++ break; ++ } ++ ++ if (rbuf1len == 0) ++ { ++ return 0; /* cannot get replacement port(s) */ ++ } ++ ++ /* Transport: tran;field;field=val,tran;field;field=val,... */ ++ while (off < tranlen) ++ { ++ uint saveoff; ++ const char* pparamend; ++ uint nextparamoff; ++ ++ pparamend = memchr(ptran+off, ',', tranlen-off); ++ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1; ++ nextparamoff = pparamend-ptcp; ++ ++ /* ++ * We pass over each param twice. On the first pass, we look for a ++ * destination= field. It is handled by the security policy. If it ++ * is present, allowed, and equal to our external address, we assume ++ * that STUN is being used and we leave the client_port= field alone. ++ */ ++ is_stun = 0; ++ saveoff = off; ++ while (off < nextparamoff) ++ { ++ const char* pfieldend; ++ uint nextfieldoff; ++ ++ pfieldend = memchr(ptran+off, ';', nextparamoff-off); ++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; ++ ++ if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0) ++ { ++ if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0) ++ { ++ is_stun = 1; ++ } ++ if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun)) ++ { ++ diff = nextfieldoff-off; ++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, ++ off, diff, NULL, 0)) ++ { ++ /* mangle failed, all we can do is bail */ ++ nf_ct_unexpect_related(exp); ++ return 0; ++ } ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ ptran = ptcp+tranoff; ++ tranlen -= diff; ++ nextparamoff -= diff; ++ nextfieldoff -= diff; ++ } ++ } ++ ++ off = nextfieldoff; ++ } ++ if (is_stun) ++ { ++ continue; ++ } ++ off = saveoff; ++ while (off < nextparamoff) ++ { ++ const char* pfieldend; ++ uint nextfieldoff; ++ ++ pfieldend = memchr(ptran+off, ';', nextparamoff-off); ++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1; ++ ++ if (strncmp(ptran+off, "client_port=", 12) == 0) ++ { ++ u_int16_t port; ++ uint numlen; ++ uint origoff; ++ uint origlen; ++ char* rbuf = rbuf1; ++ uint rbuflen = rbuf1len; ++ ++ off += 12; ++ origoff = (ptran-ptcp)+off; ++ origlen = 0; ++ numlen = nf_strtou16(ptran+off, &port); ++ off += numlen; ++ origlen += numlen; ++ if (port != prtspexp->loport) ++ { ++ DEBUGP("multiple ports found, port %hu ignored\n", port); ++ } ++ else ++ { ++ if (ptran[off] == '-' || ptran[off] == '/') ++ { ++ off++; ++ origlen++; ++ numlen = nf_strtou16(ptran+off, &port); ++ off += numlen; ++ origlen += numlen; ++ rbuf = rbufa; ++ rbuflen = rbufalen; ++ } ++ ++ /* ++ * note we cannot just memcpy() if the sizes are the same. ++ * the mangle function does skb resizing, checks for a ++ * cloned skb, and updates the checksums. ++ * ++ * parameter 4 below is offset from start of tcp data. ++ */ ++ diff = origlen-rbuflen; ++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, ++ origoff, origlen, rbuf, rbuflen)) ++ { ++ /* mangle failed, all we can do is bail */ ++ nf_ct_unexpect_related(exp); ++ return 0; ++ } ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ ptran = ptcp+tranoff; ++ tranlen -= diff; ++ nextparamoff -= diff; ++ nextfieldoff -= diff; ++ } ++ } ++ ++ off = nextfieldoff; ++ } ++ ++ off = nextparamoff; ++ } ++ ++ return 1; ++} ++ ++static uint ++help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, ++ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, ++ struct nf_conntrack_expect* exp) ++{ ++ char* ptcp; ++ uint tcplen; ++ uint hdrsoff; ++ uint hdrslen; ++ uint lineoff; ++ uint linelen; ++ uint off; ++ ++ //struct iphdr* iph = (struct iphdr*)skb->nh.iph; ++ //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4); ++ ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq); ++ hdrslen = matchlen; ++ off = hdrsoff; ++ DEBUGP("NAT rtsp help_out\n"); ++ ++ while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen)) ++ { ++ if (linelen == 0) ++ { ++ break; ++ } ++ if (off > hdrsoff+hdrslen) ++ { ++ INFOP("!! overrun !!"); ++ break; ++ } ++ DEBUGP("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); ++ ++ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) ++ { ++ uint oldtcplen = tcplen; ++ DEBUGP("hdr: Transport\n"); ++ if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, lineoff, linelen)) ++ { ++ DEBUGP("hdr: Transport mangle failed"); ++ break; ++ } ++ get_skb_tcpdata(skb, &ptcp, &tcplen); ++ hdrslen -= (oldtcplen-tcplen); ++ off -= (oldtcplen-tcplen); ++ lineoff -= (oldtcplen-tcplen); ++ linelen -= (oldtcplen-tcplen); ++ DEBUGP("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff); ++ } ++ } ++ ++ return NF_ACCEPT; ++} ++ ++static unsigned int ++help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, ++ unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp, ++ struct nf_conntrack_expect* exp) ++{ ++ int dir = CTINFO2DIR(ctinfo); ++ int rc = NF_ACCEPT; ++ ++ switch (dir) ++ { ++ case IP_CT_DIR_ORIGINAL: ++ rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp, exp); ++ break; ++ case IP_CT_DIR_REPLY: ++ DEBUGP("unmangle ! %u\n", ctinfo); ++ /* XXX: unmangle */ ++ rc = NF_ACCEPT; ++ break; ++ } ++ //UNLOCK_BH(&ip_rtsp_lock); ++ ++ return rc; ++} ++ ++static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp) ++{ ++ struct nf_nat_multi_range_compat mr; ++ u_int32_t newdstip, newsrcip, newip; ++ ++ struct nf_conn *master = ct->master; ++ ++ newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; ++ newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip; ++ //FIXME (how to port that ?) ++ //code from 2.4 : newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip; ++ newip = newdstip; ++ ++ DEBUGP("newsrcip=%u.%u.%u.%u, newdstip=%u.%u.%u.%u, newip=%u.%u.%u.%u\n", ++ NIPQUAD(newsrcip), NIPQUAD(newdstip), NIPQUAD(newip)); ++ ++ mr.rangesize = 1; ++ // We don't want to manip the per-protocol, just the IPs. ++ mr.range[0].flags = IP_NAT_RANGE_MAP_IPS; ++ mr.range[0].min_ip = mr.range[0].max_ip = newip; ++ ++ nf_nat_setup_info(ct, &mr.range[0], IP_NAT_MANIP_DST); ++} ++ ++ ++static void __exit fini(void) ++{ ++ nf_nat_rtsp_hook = NULL; ++ nf_nat_rtsp_hook_expectfn = NULL; ++ synchronize_net(); ++} ++ ++static int __init init(void) ++{ ++ printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n"); ++ ++ BUG_ON(nf_nat_rtsp_hook); ++ nf_nat_rtsp_hook = help; ++ nf_nat_rtsp_hook_expectfn = &expected; ++ ++ 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 0; ++} ++ ++module_init(init); ++module_exit(fini); +diff -Nur linux-2.6.33.orig/net/netfilter/Kconfig linux-2.6.33/net/netfilter/Kconfig +--- linux-2.6.33.orig/net/netfilter/Kconfig 2010-02-24 19:52:17.000000000 +0100 ++++ linux-2.6.33/net/netfilter/Kconfig 2010-04-25 01:09:20.000000000 +0200 +@@ -268,6 +268,16 @@ + + To compile it as a module, choose M here. If unsure, say N. + ++config NF_CONNTRACK_RTSP ++ tristate "RTSP protocol support" ++ depends on NF_CONNTRACK ++ help ++ 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'. ++ + config NF_CT_NETLINK + tristate 'Connection tracking netlink interface' + select NETFILTER_NETLINK +diff -Nur linux-2.6.33.orig/net/netfilter/Kconfig.orig linux-2.6.33/net/netfilter/Kconfig.orig +--- linux-2.6.33.orig/net/netfilter/Kconfig.orig 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.33/net/netfilter/Kconfig.orig 2010-02-24 19:52:17.000000000 +0100 +@@ -0,0 +1,937 @@ ++menu "Core Netfilter Configuration" ++ depends on NET && INET && NETFILTER ++ ++config NETFILTER_NETLINK ++ tristate ++ ++config NETFILTER_NETLINK_QUEUE ++ tristate "Netfilter NFQUEUE over N