pom-ng: SIP helper updates for 2.6.13
Subsystems (2)
PATCH 1/1 pom-ng: SIP helper updates for 2.6.13
Harald,
This updates SIP helper to support 2.6.13 conntrack helper API
changes.
- expect's refcounts
- kill lockhelp.h
Cheers,
Signature · 1 line
Christian Hentschel <[email protected]>
include/linux/netfilter_ipv4/ip_conntrack_sip.h +78 -0
@@ -0,0 +1,78 @@ +#ifndef __IP_CONNTRACK_SIP_H__ +#define __IP_CONNTRACK_SIP_H__ +/* SIP tracking. */ + +#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_CONECTION 5 +#define POS_REQ_HEADER 6 +#define POS_SDP_HEADER 7 + +struct sip_header_nfo { +const char *lname; +size_t lnlen; +const char *sname; +size_t snlen; +const char *ln_str; +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); + +/* For NAT to hook in when on expect. */ +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); + +/* get line lenght until first CR or LF seen. */ +static __inline__int ct_sip_lnlen (const char *line,const char *limit) +{ +const char *k = line; + +while ((line <= limit) && (*line =='\r' || *line =='\n' )) + line++; + +while (line <= limit) { +if (*line =='\r' || *line =='\n' ) +break ; + line++; + } +return line - k; +} + +/* Linear string search, case sensitive. */ +static __inline__ +const char *ct_sip_search (const char *needle,const char *haystack, +size_t needle_len,size_t haystack_len) +{ +const char *limit = haystack + (haystack_len - needle_len); + +while (haystack <= limit) { +if (memcmp (haystack, needle, needle_len) ==0 ) +return haystack; + haystack++; + } +return NULL ; +} +#endif /* __KERNEL__ */ + +#endif /* __IP_CONNTRACK_SIP_H__ */
net/ipv4/netfilter/Makefile.ladd +6 -0
@@ -0,0 +1,6 @@ +obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o + +# SIP support +obj-$(CONFIG_IP_NF_SIP) += ip_conntrack_sip.o +obj-$(CONFIG_IP_NF_NAT_SIP) += ip_nat_sip.o +
net/ipv4/netfilter/Kconfig.ladd +18 -0
@@ -0,0 +1,18 @@ +config IP_NF_NAT_SIP + tristate + depends on IP_NF_CONNTRACK!=n && IP_NF_NAT!=n + default IP_NF_NAT if IP_NF_SIP=y + default m if IP_NF_SIP=m + +config IP_NF_SIP + tristate 'SIP support' + depends on 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. + + If you want to compile it as a module, say 'M' here and read + Documentation/modules.txt. If unsure, say 'N'.
net/ipv4/netfilter/ip_conntrack_sip.c +412 -0
412 lines not on this page · raw message
net/ipv4/netfilter/ip_nat_sip.c +249 -0
249 lines not on this page · raw message
info +1 -1
@@ -1,5 +1,5 @@ Title: SIP connection tracking and NAT helper Author: Christian Hentschel <[email protected]> -Status: Alpha +Status: Testing Repository: extra Requires: linux-2.6 >= 2.6.11
Harald Welte
AppliedQuoted 3 lines · Christian Hentschel
Harald,
This updates SIP helper to support 2.6.13 conntrack helper API
changes.
thanks, applied.
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie