pom-ng: update sip-conntrack-nat for 2.6.12
PATCH 3/3 pom-ng: update sip-conntrack-nat for 2.6.12
Hi,
the attached patch updates the sip-conntrack-nat patchlet in pom-ng for 2.6.12.
Compile-tested by me on 2.6.13-rc3-mm1, I haven't been able to verify the functionality, but at least the module loads :-)
Regards,
Sven
Signature · 2 lines
Linux zion 2.6.13-rc3-mm1 #12 PREEMPT Sun Jul 24 02:04:45 CEST 2005 i686 athlon i386 GNU/Linux 21:05:06 up 1 day, 21:14, 1 user, load average: 0.30, 0.58, 0.33
patchlets/sip-conntrack-nat/linux-2.6.12/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__ */
patchlets/sip-conntrack-nat/linux-2.6.12/net/ipv4/netfilter/ip_conntrack_sip.c +407 -0
407 lines not on this page · raw message
patchlets/sip-conntrack-nat/linux-2.6.12/net/ipv4/netfilter/ip_nat_sip.c +253 -0
253 lines not on this page · raw message
patchlets/sip-conntrack-nat/linux-2.6.12/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'.
patchlets/sip-conntrack-nat/linux-2.6.12/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 +
Harald Welte
AppliedQuoted 5 lines · Sven Schuster
Hi,
the attached patch updates the sip-conntrack-nat patchlet in pom-ng for 2.6.12.
thanks, applied.
Quoted 2 lines
Compile-tested by me on 2.6.13-rc3-mm1, I haven't been able to verify the functionality, but at least the module loads :-)
the changes are non-intrusive and only affect changing from lockhelp macros to regular locking functions. I don't see how those four changed lines would create a bug.
btw: if you do any future merges (2.6.13 and beyond have yet another change in the helper api...), please just send me an incremental diff to the last version in patch-o-matic-ng (e.g. to 2.6.12 in the 2.6.13 case).
I will make a 'svn cp' of the 2.6.12 code and then apply your diff on top of it. Right now I have to do 'svn cp', apply your patch to some other location, copy the files over, and then do 'svn diff' in order to see what you actually changed.
thanks!
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
Hi Harald,
On Fri, Jul 29, 2005 at 12:56:12PM +0200, Harald Welte told us:
Quoted 3 lines
the changes are non-intrusive and only affect changing from lockhelp macros to regular locking functions. I don't see how those four changed lines would create a bug.
of course, but who nows :-)
Quoted 5 lines
btw: if you do any future merges (2.6.13 and beyond have yet another change in the helper api...), please just send me an incremental diff to the last version in patch-o-matic-ng (e.g. to 2.6.12 in the 2.6.13 case).
alright, I'll do so!!
Thanks,
Sven
Quoted 13 lines
I will make a 'svn cp' of the 2.6.12 code and then apply your diff on top of it. Right now I have to do 'svn cp', apply your patch to some other location, copy the files over, and then do 'svn diff' in order to see what you actually changed.
thanks!
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
Signature · 2 lines
Linux zion 2.6.13-rc3-mm1 #17 PREEMPT Thu Jul 28 02:56:37 CEST 2005 i686 athlon i386 GNU/Linux 18:44:59 up 1 day, 15:44, 3 users, load average: 0.27, 0.09, 0.03