: nf_conntrack/nf_nat: add SIP helper port
Subsystems (2)
PATCH 2/2 : nf_conntrack/nf_nat: add SIP helper port
A port of the SIP conntrack/NAT helpers to nf_conntrack. Only IPv4 tested, which works fine so far.
[NETFILTER]: nf_conntrack/nf_nat: add SIP helper port
Signed-off-by Patrick McHardy <[email protected]>
---
commit a6c08049039463f18272fa8e7139aadb8a950d22
tree aaf3f5caed98ee4363dd3ce3d63931b4f76c8ac8
parent 49993257192a278f6dc7f288e6ef62059ba88762
author Patrick McHardy <[email protected]> Sat, 04 Nov 2006 23:58:50 +0100 committer Patrick McHardy <[email protected]> Sat, 04 Nov 2006 23:58:50 +0100
include/linux/netfilter/nf_conntrack_sip.h | 44 ++ net/ipv4/netfilter/Kconfig | 5 net/ipv4/netfilter/Makefile | 1 net/ipv4/netfilter/nf_nat_sip.c | 250 ++++++++++++++ net/netfilter/Kconfig | 12 + net/netfilter/Makefile | 1 net/netfilter/nf_conntrack_sip.c | 505 ++++++++++++++++++++++++++++ 7 files changed, 818 insertions(+), 0 deletions(-)
include/linux/netfilter/nf_conntrack_sip.h new file +44 -0
@@ -0,0 +1,44 @@ +#ifndef __NF_CONNTRACK_SIP_H__ +#define __NF_CONNTRACK_SIP_H__ +#ifdef __KERNEL__ + +#define SIP_PORT 5060 +#define SIP_TIMEOUT 3600 + +#define POS_VIA 0 +#define POS_CONTACT 1 +#define POS_CONTENT 2 +#define POS_MEDIA 3 +#define POS_OWNER 4 +#define POS_CONNECTION 5 +#define POS_REQ_HEADER 6 +#define POS_SDP_HEADER 7 + +struct sip_header_nfo { +const char *lname; +const char *sname; +const char *ln_str; +size_t lnlen; +size_t snlen; +size_t ln_strlen; +int (*match_len)(struct nf_conn *,const char *, +const char *,int *); +}; + +extern unsigned int (*nf_nat_sip_hook)(struct sk_buff **pskb, +enum ip_conntrack_info ctinfo, +struct nf_conn *ct, +const char **dptr); +extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff **pskb, +enum ip_conntrack_info ctinfo, +struct nf_conntrack_expect *exp, +const char *dptr); + +extern int ct_sip_get_info (struct nf_conn *,const char *dptr,size_t dlen, +unsigned int *matchoff,unsigned int *matchlen, +struct sip_header_nfo *hnfo); +extern int ct_sip_lnlen (const char *line,const char *limit); +extern const char *ct_sip_search (const char *needle,const char *haystack, +size_t needle_len,size_t haystack_len); +#endif /* __KERNEL__ */ +#endif /* __NF_CONNTRACK_SIP_H__ */
net/ipv4/netfilter/Kconfig +5 -0
@@ -537,6 +537,11 @@ config IP_NF_NAT_SIP default IP_NF_NAT if IP_NF_SIP=y default m if IP_NF_SIP=m +config NF_NAT_SIP + tristate + depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT + default NF_NAT && NF_CONNTRACK_SIP + # mangle + specific targets config IP_NF_MANGLE tristate "Packet mangling"
net/ipv4/netfilter/Makefile +1 -0
@@ -51,6 +51,7 @@ obj-$(CONFIG_IP_NF_NAT_SIP) += ip_nat_si # NAT helpers (nf_conntrack) obj-$(CONFIG_NF_NAT_FTP) += nf_nat_ftp.o +obj-$(CONFIG_NF_NAT_SIP) += nf_nat_sip.o # generic IP tables obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
net/ipv4/netfilter/nf_nat_sip.c new file +250 -0
250 lines not on this page · raw message
net/netfilter/Kconfig +12 -0
@@ -150,6 +150,18 @@ config NF_CONNTRACK_FTP To compile it as a module, choose M here. If unsure, say N. +config NF_CONNTRACK_SIP + tristate "SIP support on new connection tracking (EXPERIMENTAL)" + depends on EXPERIMENTAL && 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 nf_nat_sip modules you can support the protocol on a connection + tracking/NATing firewall. + + To compile it as a module, choose M here. If unsure, say N. + config NF_CT_NETLINK tristate 'Connection tracking netlink interface (EXPERIMENTAL)' depends on EXPERIMENTAL && NF_CONNTRACK && NETFILTER_NETLINK
net/netfilter/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_NF_CT_NETLINK) += nf_conntr # connection tracking helpers obj-$(CONFIG_NF_CONNTRACK_FTP) += nf_conntrack_ftp.o +obj-$(CONFIG_NF_CONNTRACK_SIP) += nf_conntrack_sip.o # generic X tables obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o
net/netfilter/nf_conntrack_sip.c new file +505 -0
505 lines not on this page · raw message