: Add SIP connection tracking helper
Subsystems (2)
RFC 1/1 : Add SIP connection tracking helper
Hi Christian,
I finally got around to adding bidirection SIP support to the SIP helper. Tested with calls crossing a single asterisk box in multiple directions, everything appears to be working fine. I also ran the PROTOS c07-sip test-suite against the helper, it didn't find any problems. If there are no objections from your side I'll submit it once 2.6.17 is out.
Cheers,
Patrick
[NETFILTER]: Add SIP connection tracking helper
Add SIP connection tracking helper. Originally written by Christian Hentschel <[email protected]>, some cleanup and bidirectional SIP support added by myself.
---
commit e6e5a670aeb4a0515c93e657dbaa10fa002eef28
tree 72a66241bda2e1c0a8d92cd949d573c136f9b9b5
parent a54c9d30dbb06391ec4422aaf0e1dc2c8c53bd3e
author Patrick McHardy <[email protected]> Fri, 19 May 2006 18:47:08 +0200 committer Patrick McHardy <[email protected]> Fri, 19 May 2006 18:47:08 +0200
include/linux/netfilter_ipv4/ip_conntrack_sip.h | 44 ++ net/ipv4/netfilter/Kconfig | 18 + net/ipv4/netfilter/Makefile | 2 net/ipv4/netfilter/ip_conntrack_sip.c | 471 +++++++++++++++++++++++ net/ipv4/netfilter/ip_nat_sip.c | 249 ++++++++++++ 5 files changed, 784 insertions(+), 0 deletions(-)
include/linux/netfilter_ipv4/ip_conntrack_sip.h new file +44 -0
@@ -0,0 +1,44 @@ +#ifndef __IP_CONNTRACK_SIP_H__ +#define __IP_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)(const char *,const char *,int *); +}; + +extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb, +enum ip_conntrack_info ctinfo, +struct ip_conntrack *ct, +const char **dptr); +extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb, +enum ip_conntrack_info ctinfo, +struct ip_conntrack_expect *exp, +const char *dptr); + +extern int ct_sip_get_info (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 /* __IP_CONNTRACK_SIP_H__ */
net/ipv4/netfilter/Kconfig +18 -0
@@ -109,6 +109,18 @@ config IP_NF_IRC To compile it as a module, choose M here. If unsure, say Y. +config IP_NF_SIP + tristate "SIP support (EXPERIMENTAL)" + depends on IP_NF_CONNTRACK && EXPERIMENTAL + 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. + + To compile it as a module, choose M here. If unsure, say Y. + config IP_NF_NETBIOS_NS tristate "NetBIOS name service protocol support (EXPERIMENTAL)" depends on IP_NF_CONNTRACK && EXPERIMENTAL
@@ -501,6 +513,12 @@ config IP_NF_NAT_H323 default IP_NF_NAT if IP_NF_H323=y default m if IP_NF_H323=m +config IP_NF_NAT_SIP + tristate + depends on IP_NF_IPTABLES!=n && IP_NF_CONNTRACK!=n && IP_NF_NAT!=n + default IP_NF_NAT if IP_NF_SIP=y + default m if IP_NF_SIP=m + # mangle + specific targets config IP_NF_MANGLE tristate "Packet mangling"
net/ipv4/netfilter/Makefile +2 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_IP_NF_AMANDA) += ip_conntra obj-$(CONFIG_IP_NF_TFTP) += ip_conntrack_tftp.o obj-$(CONFIG_IP_NF_FTP) += ip_conntrack_ftp.o obj-$(CONFIG_IP_NF_IRC) += ip_conntrack_irc.o +obj-$(CONFIG_IP_NF_SIP) += ip_conntrack_sip.o obj-$(CONFIG_IP_NF_NETBIOS_NS) += ip_conntrack_netbios_ns.o # NAT helpers
@@ -40,6 +41,7 @@ obj-$(CONFIG_IP_NF_NAT_AMANDA) += ip_nat obj-$(CONFIG_IP_NF_NAT_TFTP) += ip_nat_tftp.o obj-$(CONFIG_IP_NF_NAT_FTP) += ip_nat_ftp.o obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o +obj-$(CONFIG_IP_NF_NAT_SIP) += ip_nat_sip.o # generic IP tables obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
net/ipv4/netfilter/ip_conntrack_sip.c new file +471 -0
471 lines not on this page · raw message
net/ipv4/netfilter/ip_nat_sip.c new file +249 -0
249 lines not on this page · raw message