2006-12-03 07:08:46 +01:00
|
|
|
/*
|
|
|
|
* H.323 connection tracking helper
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 Jing Min Zhao <zhaojingmin@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* This source code is licensed under General Public License version 2.
|
|
|
|
*
|
|
|
|
* Based on the 'brute force' H.323 connection tracking module by
|
|
|
|
* Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
|
|
|
|
*
|
|
|
|
* For more information, please see http://nath323.sourceforge.net/
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/inet.h>
|
|
|
|
#include <linux/in.h>
|
|
|
|
#include <linux/ip.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 09:04:11 +01:00
|
|
|
#include <linux/slab.h>
|
2006-12-03 07:08:46 +01:00
|
|
|
#include <linux/udp.h>
|
|
|
|
#include <linux/tcp.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <net/route.h>
|
|
|
|
#include <net/ip6_route.h>
|
|
|
|
|
|
|
|
#include <net/netfilter/nf_conntrack.h>
|
|
|
|
#include <net/netfilter/nf_conntrack_core.h>
|
|
|
|
#include <net/netfilter/nf_conntrack_tuple.h>
|
|
|
|
#include <net/netfilter/nf_conntrack_expect.h>
|
|
|
|
#include <net/netfilter/nf_conntrack_ecache.h>
|
|
|
|
#include <net/netfilter/nf_conntrack_helper.h>
|
2010-02-15 18:13:33 +01:00
|
|
|
#include <net/netfilter/nf_conntrack_zones.h>
|
2006-12-03 07:08:46 +01:00
|
|
|
#include <linux/netfilter/nf_conntrack_h323.h>
|
|
|
|
|
|
|
|
/* Parameters */
|
|
|
|
static unsigned int default_rrq_ttl __read_mostly = 300;
|
|
|
|
module_param(default_rrq_ttl, uint, 0600);
|
|
|
|
MODULE_PARM_DESC(default_rrq_ttl, "use this TTL if it's missing in RRQ");
|
|
|
|
|
|
|
|
static int gkrouted_only __read_mostly = 1;
|
|
|
|
module_param(gkrouted_only, int, 0600);
|
|
|
|
MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper");
|
|
|
|
|
|
|
|
static int callforward_filter __read_mostly = 1;
|
|
|
|
module_param(callforward_filter, bool, 0600);
|
|
|
|
MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations "
|
2007-02-12 20:15:49 +01:00
|
|
|
"if both endpoints are on different sides "
|
2006-12-03 07:08:46 +01:00
|
|
|
"(determined by routing information)");
|
|
|
|
|
|
|
|
/* Hooks for NAT */
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*set_h245_addr_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
H245_TransportAddress *taddr,
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr *addr, __be16 port)
|
2006-12-03 07:08:46 +01:00
|
|
|
__read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*set_h225_addr_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
TransportAddress *taddr,
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr *addr, __be16 port)
|
2006-12-03 07:08:46 +01:00
|
|
|
__read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*set_sig_addr_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data,
|
|
|
|
TransportAddress *taddr, int count) __read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*set_ras_addr_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data,
|
|
|
|
TransportAddress *taddr, int count) __read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
H245_TransportAddress *taddr,
|
|
|
|
__be16 port, __be16 rtp_port,
|
|
|
|
struct nf_conntrack_expect *rtp_exp,
|
|
|
|
struct nf_conntrack_expect *rtcp_exp) __read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*nat_t120_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
H245_TransportAddress *taddr, __be16 port,
|
|
|
|
struct nf_conntrack_expect *exp) __read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*nat_h245_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
TransportAddress *taddr, __be16 port,
|
|
|
|
struct nf_conntrack_expect *exp) __read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*nat_callforwarding_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
TransportAddress *taddr, __be16 port,
|
|
|
|
struct nf_conntrack_expect *exp) __read_mostly;
|
2007-10-15 09:53:15 +02:00
|
|
|
int (*nat_q931_hook) (struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, TransportAddress *taddr, int idx,
|
|
|
|
__be16 port, struct nf_conntrack_expect *exp)
|
|
|
|
__read_mostly;
|
|
|
|
|
|
|
|
static DEFINE_SPINLOCK(nf_h323_lock);
|
|
|
|
static char *h323_buffer;
|
|
|
|
|
|
|
|
static struct nf_conntrack_helper nf_conntrack_helper_h245;
|
|
|
|
static struct nf_conntrack_helper nf_conntrack_helper_q931[];
|
|
|
|
static struct nf_conntrack_helper nf_conntrack_helper_ras[];
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct, enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int *datalen, int *dataoff)
|
|
|
|
{
|
|
|
|
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
2008-01-31 13:50:05 +01:00
|
|
|
const struct tcphdr *th;
|
|
|
|
struct tcphdr _tcph;
|
2006-12-03 07:08:46 +01:00
|
|
|
int tcpdatalen;
|
|
|
|
int tcpdataoff;
|
|
|
|
unsigned char *tpkt;
|
|
|
|
int tpktlen;
|
|
|
|
int tpktoff;
|
|
|
|
|
|
|
|
/* Get TCP header */
|
2007-10-15 09:53:15 +02:00
|
|
|
th = skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (th == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Get TCP data offset */
|
|
|
|
tcpdataoff = protoff + th->doff * 4;
|
|
|
|
|
|
|
|
/* Get TCP data length */
|
2007-10-15 09:53:15 +02:00
|
|
|
tcpdatalen = skb->len - tcpdataoff;
|
2006-12-03 07:08:46 +01:00
|
|
|
if (tcpdatalen <= 0) /* No TCP data */
|
|
|
|
goto clear_out;
|
|
|
|
|
|
|
|
if (*data == NULL) { /* first TPKT */
|
|
|
|
/* Get first TPKT pointer */
|
2007-10-15 09:53:15 +02:00
|
|
|
tpkt = skb_header_pointer(skb, tcpdataoff, tcpdatalen,
|
2006-12-03 07:08:46 +01:00
|
|
|
h323_buffer);
|
|
|
|
BUG_ON(tpkt == NULL);
|
|
|
|
|
|
|
|
/* Validate TPKT identifier */
|
|
|
|
if (tcpdatalen < 4 || tpkt[0] != 0x03 || tpkt[1] != 0) {
|
|
|
|
/* Netmeeting sends TPKT header and data separately */
|
|
|
|
if (info->tpkt_len[dir] > 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: previous packet "
|
|
|
|
"indicated separate TPKT data of %hu "
|
|
|
|
"bytes\n", info->tpkt_len[dir]);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (info->tpkt_len[dir] <= tcpdatalen) {
|
|
|
|
/* Yes, there was a TPKT header
|
|
|
|
* received */
|
|
|
|
*data = tpkt;
|
|
|
|
*datalen = info->tpkt_len[dir];
|
|
|
|
*dataoff = 0;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fragmented TPKT */
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: fragmented TPKT\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
goto clear_out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* It is not even a TPKT */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
tpktoff = 0;
|
|
|
|
} else { /* Next TPKT */
|
|
|
|
tpktoff = *dataoff + *datalen;
|
|
|
|
tcpdatalen -= tpktoff;
|
|
|
|
if (tcpdatalen <= 4) /* No more TPKT */
|
|
|
|
goto clear_out;
|
|
|
|
tpkt = *data + *datalen;
|
|
|
|
|
|
|
|
/* Validate TPKT identifier */
|
|
|
|
if (tpkt[0] != 0x03 || tpkt[1] != 0)
|
|
|
|
goto clear_out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Validate TPKT length */
|
|
|
|
tpktlen = tpkt[2] * 256 + tpkt[3];
|
|
|
|
if (tpktlen < 4)
|
|
|
|
goto clear_out;
|
|
|
|
if (tpktlen > tcpdatalen) {
|
|
|
|
if (tcpdatalen == 4) { /* Separate TPKT header */
|
|
|
|
/* Netmeeting sends TPKT header and data separately */
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: separate TPKT header indicates "
|
|
|
|
"there will be TPKT data of %hu bytes\n",
|
|
|
|
tpktlen - 4);
|
2006-12-03 07:08:46 +01:00
|
|
|
info->tpkt_len[dir] = tpktlen - 4;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-01 18:29:43 +02:00
|
|
|
pr_debug("nf_ct_h323: incomplete TPKT (fragmented?)\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
goto clear_out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is the encapsulated data */
|
|
|
|
*data = tpkt + 4;
|
|
|
|
*datalen = tpktlen - 4;
|
|
|
|
*dataoff = tpktoff + 4;
|
|
|
|
|
|
|
|
out:
|
|
|
|
/* Clear TPKT length */
|
|
|
|
info->tpkt_len[dir] = 0;
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
clear_out:
|
|
|
|
info->tpkt_len[dir] = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2008-01-31 13:50:05 +01:00
|
|
|
static int get_h245_addr(struct nf_conn *ct, const unsigned char *data,
|
2006-12-03 07:08:46 +01:00
|
|
|
H245_TransportAddress *taddr,
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr *addr, __be16 *port)
|
2006-12-03 07:08:46 +01:00
|
|
|
{
|
2008-01-31 13:50:05 +01:00
|
|
|
const unsigned char *p;
|
2006-12-03 07:08:46 +01:00
|
|
|
int len;
|
|
|
|
|
|
|
|
if (taddr->choice != eH245_TransportAddress_unicastAddress)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (taddr->unicastAddress.choice) {
|
|
|
|
case eUnicastAddress_iPAddress:
|
2008-04-14 11:15:52 +02:00
|
|
|
if (nf_ct_l3num(ct) != AF_INET)
|
2006-12-03 07:08:46 +01:00
|
|
|
return 0;
|
|
|
|
p = data + taddr->unicastAddress.iPAddress.network;
|
|
|
|
len = 4;
|
|
|
|
break;
|
|
|
|
case eUnicastAddress_iP6Address:
|
2008-04-14 11:15:52 +02:00
|
|
|
if (nf_ct_l3num(ct) != AF_INET6)
|
2006-12-03 07:08:46 +01:00
|
|
|
return 0;
|
|
|
|
p = data + taddr->unicastAddress.iP6Address.network;
|
|
|
|
len = 16;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(addr, p, len);
|
|
|
|
memset((void *)addr + len, 0, sizeof(*addr) - len);
|
|
|
|
memcpy(port, p + len, sizeof(__be16));
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int expect_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
H245_TransportAddress *taddr)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
__be16 port;
|
|
|
|
__be16 rtp_port, rtcp_port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *rtp_exp;
|
|
|
|
struct nf_conntrack_expect *rtcp_exp;
|
|
|
|
typeof(nat_rtp_rtcp_hook) nat_rtp_rtcp;
|
|
|
|
|
|
|
|
/* Read RTP or RTCP address */
|
|
|
|
if (!get_h245_addr(ct, *data, taddr, &addr, &port) ||
|
|
|
|
memcmp(&addr, &ct->tuplehash[dir].tuple.src.u3, sizeof(addr)) ||
|
|
|
|
port == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* RTP port is even */
|
|
|
|
port &= htons(~1);
|
|
|
|
rtp_port = port;
|
|
|
|
rtcp_port = htons(ntohs(port) + 1);
|
|
|
|
|
|
|
|
/* Create expect for RTP */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((rtp_exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(rtp_exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
IPPROTO_UDP, NULL, &rtp_port);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
/* Create expect for RTCP */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((rtcp_exp = nf_ct_expect_alloc(ct)) == NULL) {
|
|
|
|
nf_ct_expect_put(rtp_exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
|
|
|
}
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(rtcp_exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
IPPROTO_UDP, NULL, &rtcp_port);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (memcmp(&ct->tuplehash[dir].tuple.src.u3,
|
2007-02-12 20:15:49 +01:00
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
2006-12-03 07:08:46 +01:00
|
|
|
sizeof(ct->tuplehash[dir].tuple.src.u3)) &&
|
|
|
|
(nat_rtp_rtcp = rcu_dereference(nat_rtp_rtcp_hook)) &&
|
|
|
|
ct->status & IPS_NAT_MASK) {
|
|
|
|
/* NAT needed */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = nat_rtp_rtcp(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
taddr, port, rtp_port, rtp_exp, rtcp_exp);
|
|
|
|
} else { /* Conntrack only */
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(rtp_exp) == 0) {
|
|
|
|
if (nf_ct_expect_related(rtcp_exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: expect RTP ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&rtp_exp->tuple);
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: expect RTCP ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&rtcp_exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else {
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_unexpect_related(rtp_exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(rtp_exp);
|
|
|
|
nf_ct_expect_put(rtcp_exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int expect_t120(struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
H245_TransportAddress *taddr)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
typeof(nat_t120_hook) nat_t120;
|
|
|
|
|
|
|
|
/* Read T.120 address */
|
|
|
|
if (!get_h245_addr(ct, *data, taddr, &addr, &port) ||
|
|
|
|
memcmp(&addr, &ct->tuplehash[dir].tuple.src.u3, sizeof(addr)) ||
|
|
|
|
port == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Create expect for T.120 connections */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
IPPROTO_TCP, NULL, &port);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp->flags = NF_CT_EXPECT_PERMANENT; /* Accept multiple channels */
|
|
|
|
|
|
|
|
if (memcmp(&ct->tuplehash[dir].tuple.src.u3,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
sizeof(ct->tuplehash[dir].tuple.src.u3)) &&
|
|
|
|
(nat_t120 = rcu_dereference(nat_t120_hook)) &&
|
|
|
|
ct->status & IPS_NAT_MASK) {
|
|
|
|
/* NAT needed */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = nat_t120(skb, ct, ctinfo, data, dataoff, taddr,
|
2006-12-03 07:08:46 +01:00
|
|
|
port, exp);
|
|
|
|
} else { /* Conntrack only */
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: expect T.120 ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_h245_channel(struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
H2250LogicalChannelParameters *channel)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (channel->options & eH2250LogicalChannelParameters_mediaChannel) {
|
|
|
|
/* RTP */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_rtp_rtcp(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&channel->mediaChannel);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channel->
|
|
|
|
options & eH2250LogicalChannelParameters_mediaControlChannel) {
|
|
|
|
/* RTCP */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_rtp_rtcp(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&channel->mediaControlChannel);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_olc(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
OpenLogicalChannel *olc)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: OpenLogicalChannel\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (olc->forwardLogicalChannelParameters.multiplexParameters.choice ==
|
|
|
|
eOpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters)
|
|
|
|
{
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_h245_channel(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&olc->
|
|
|
|
forwardLogicalChannelParameters.
|
|
|
|
multiplexParameters.
|
|
|
|
h2250LogicalChannelParameters);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((olc->options &
|
|
|
|
eOpenLogicalChannel_reverseLogicalChannelParameters) &&
|
|
|
|
(olc->reverseLogicalChannelParameters.options &
|
|
|
|
eOpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters)
|
|
|
|
&& (olc->reverseLogicalChannelParameters.multiplexParameters.
|
|
|
|
choice ==
|
|
|
|
eOpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters))
|
|
|
|
{
|
|
|
|
ret =
|
2007-10-15 09:53:15 +02:00
|
|
|
process_h245_channel(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&olc->
|
|
|
|
reverseLogicalChannelParameters.
|
|
|
|
multiplexParameters.
|
|
|
|
h2250LogicalChannelParameters);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((olc->options & eOpenLogicalChannel_separateStack) &&
|
|
|
|
olc->forwardLogicalChannelParameters.dataType.choice ==
|
|
|
|
eDataType_data &&
|
|
|
|
olc->forwardLogicalChannelParameters.dataType.data.application.
|
|
|
|
choice == eDataApplicationCapability_application_t120 &&
|
|
|
|
olc->forwardLogicalChannelParameters.dataType.data.application.
|
|
|
|
t120.choice == eDataProtocolCapability_separateLANStack &&
|
|
|
|
olc->separateStack.networkAddress.choice ==
|
|
|
|
eNetworkAccessParameters_networkAddress_localAreaAddress) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_t120(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&olc->separateStack.networkAddress.
|
|
|
|
localAreaAddress);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_olca(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
OpenLogicalChannelAck *olca)
|
|
|
|
{
|
|
|
|
H2250LogicalChannelAckParameters *ack;
|
|
|
|
int ret;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: OpenLogicalChannelAck\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if ((olca->options &
|
|
|
|
eOpenLogicalChannelAck_reverseLogicalChannelParameters) &&
|
|
|
|
(olca->reverseLogicalChannelParameters.options &
|
|
|
|
eOpenLogicalChannelAck_reverseLogicalChannelParameters_multiplexParameters)
|
|
|
|
&& (olca->reverseLogicalChannelParameters.multiplexParameters.
|
|
|
|
choice ==
|
|
|
|
eOpenLogicalChannelAck_reverseLogicalChannelParameters_multiplexParameters_h2250LogicalChannelParameters))
|
|
|
|
{
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_h245_channel(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&olca->
|
|
|
|
reverseLogicalChannelParameters.
|
|
|
|
multiplexParameters.
|
|
|
|
h2250LogicalChannelParameters);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((olca->options &
|
|
|
|
eOpenLogicalChannelAck_forwardMultiplexAckParameters) &&
|
|
|
|
(olca->forwardMultiplexAckParameters.choice ==
|
|
|
|
eOpenLogicalChannelAck_forwardMultiplexAckParameters_h2250LogicalChannelAckParameters))
|
|
|
|
{
|
|
|
|
ack = &olca->forwardMultiplexAckParameters.
|
|
|
|
h2250LogicalChannelAckParameters;
|
|
|
|
if (ack->options &
|
|
|
|
eH2250LogicalChannelAckParameters_mediaChannel) {
|
|
|
|
/* RTP */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_rtp_rtcp(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ack->mediaChannel);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ack->options &
|
|
|
|
eH2250LogicalChannelAckParameters_mediaControlChannel) {
|
|
|
|
/* RTCP */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_rtp_rtcp(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ack->mediaControlChannel);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-25 01:44:11 +02:00
|
|
|
if ((olca->options & eOpenLogicalChannelAck_separateStack) &&
|
|
|
|
olca->separateStack.networkAddress.choice ==
|
|
|
|
eNetworkAccessParameters_networkAddress_localAreaAddress) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_t120(skb, ct, ctinfo, data, dataoff,
|
2007-05-25 01:44:11 +02:00
|
|
|
&olca->separateStack.networkAddress.
|
|
|
|
localAreaAddress);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-12-03 07:08:46 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_h245(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
MultimediaSystemControlMessage *mscm)
|
|
|
|
{
|
|
|
|
switch (mscm->choice) {
|
|
|
|
case eMultimediaSystemControlMessage_request:
|
|
|
|
if (mscm->request.choice ==
|
|
|
|
eRequestMessage_openLogicalChannel) {
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_olc(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&mscm->request.openLogicalChannel);
|
|
|
|
}
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: H.245 Request %d\n",
|
|
|
|
mscm->request.choice);
|
2006-12-03 07:08:46 +01:00
|
|
|
break;
|
|
|
|
case eMultimediaSystemControlMessage_response:
|
|
|
|
if (mscm->response.choice ==
|
|
|
|
eResponseMessage_openLogicalChannelAck) {
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_olca(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&mscm->response.
|
|
|
|
openLogicalChannelAck);
|
|
|
|
}
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: H.245 Response %d\n",
|
|
|
|
mscm->response.choice);
|
2006-12-03 07:08:46 +01:00
|
|
|
break;
|
|
|
|
default:
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: H.245 signal %d\n", mscm->choice);
|
2006-12-03 07:08:46 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int h245_help(struct sk_buff *skb, unsigned int protoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct, enum ip_conntrack_info ctinfo)
|
|
|
|
{
|
|
|
|
static MultimediaSystemControlMessage mscm;
|
|
|
|
unsigned char *data = NULL;
|
|
|
|
int datalen;
|
|
|
|
int dataoff;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Until there's been traffic both ways, don't look in packets. */
|
|
|
|
if (ctinfo != IP_CT_ESTABLISHED &&
|
|
|
|
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
|
|
|
|
return NF_ACCEPT;
|
|
|
|
}
|
2007-10-15 09:53:15 +02:00
|
|
|
pr_debug("nf_ct_h245: skblen = %u\n", skb->len);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
spin_lock_bh(&nf_h323_lock);
|
|
|
|
|
|
|
|
/* Process each TPKT */
|
2007-10-15 09:53:15 +02:00
|
|
|
while (get_tpkt_data(skb, protoff, ct, ctinfo,
|
2006-12-03 07:08:46 +01:00
|
|
|
&data, &datalen, &dataoff)) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h245: TPKT len=%d ", datalen);
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
/* Decode H.245 signal */
|
|
|
|
ret = DecodeMultimediaSystemControlMessage(data, datalen,
|
|
|
|
&mscm);
|
|
|
|
if (ret < 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h245: decoding error: %s\n",
|
|
|
|
ret == H323_ERROR_BOUND ?
|
|
|
|
"out of bound" : "out of range");
|
2006-12-03 07:08:46 +01:00
|
|
|
/* We don't drop when decoding error */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Process H.245 signal */
|
2007-10-15 09:53:15 +02:00
|
|
|
if (process_h245(skb, ct, ctinfo, &data, dataoff, &mscm) < 0)
|
2006-12-03 07:08:46 +01:00
|
|
|
goto drop;
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock_bh(&nf_h323_lock);
|
|
|
|
return NF_ACCEPT;
|
|
|
|
|
|
|
|
drop:
|
|
|
|
spin_unlock_bh(&nf_h323_lock);
|
|
|
|
if (net_ratelimit())
|
2010-05-13 15:02:08 +02:00
|
|
|
pr_info("nf_ct_h245: packet dropped\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
return NF_DROP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2008-03-26 04:09:15 +01:00
|
|
|
static const struct nf_conntrack_expect_policy h245_exp_policy = {
|
|
|
|
.max_expected = H323_RTP_CHANNEL_MAX * 4 + 2 /* T.120 */,
|
|
|
|
.timeout = 240,
|
|
|
|
};
|
|
|
|
|
2006-12-03 07:08:46 +01:00
|
|
|
static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = {
|
|
|
|
.name = "H.245",
|
|
|
|
.me = THIS_MODULE,
|
2008-06-18 00:52:32 +02:00
|
|
|
.tuple.src.l3num = AF_UNSPEC,
|
2006-12-03 07:08:46 +01:00
|
|
|
.tuple.dst.protonum = IPPROTO_UDP,
|
2008-03-26 04:09:15 +01:00
|
|
|
.help = h245_help,
|
|
|
|
.expect_policy = &h245_exp_policy,
|
2006-12-03 07:08:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
int get_h225_addr(struct nf_conn *ct, unsigned char *data,
|
|
|
|
TransportAddress *taddr,
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr *addr, __be16 *port)
|
2006-12-03 07:08:46 +01:00
|
|
|
{
|
2008-01-31 13:50:05 +01:00
|
|
|
const unsigned char *p;
|
2006-12-03 07:08:46 +01:00
|
|
|
int len;
|
|
|
|
|
|
|
|
switch (taddr->choice) {
|
|
|
|
case eTransportAddress_ipAddress:
|
2008-04-14 11:15:52 +02:00
|
|
|
if (nf_ct_l3num(ct) != AF_INET)
|
2006-12-03 07:08:46 +01:00
|
|
|
return 0;
|
|
|
|
p = data + taddr->ipAddress.ip;
|
|
|
|
len = 4;
|
|
|
|
break;
|
|
|
|
case eTransportAddress_ip6Address:
|
2008-04-14 11:15:52 +02:00
|
|
|
if (nf_ct_l3num(ct) != AF_INET6)
|
2006-12-03 07:08:46 +01:00
|
|
|
return 0;
|
2007-05-25 01:43:07 +02:00
|
|
|
p = data + taddr->ip6Address.ip;
|
2006-12-03 07:08:46 +01:00
|
|
|
len = 16;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(addr, p, len);
|
|
|
|
memset((void *)addr + len, 0, sizeof(*addr) - len);
|
|
|
|
memcpy(port, p + len, sizeof(__be16));
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
TransportAddress *taddr)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
typeof(nat_h245_hook) nat_h245;
|
|
|
|
|
|
|
|
/* Read h245Address */
|
|
|
|
if (!get_h225_addr(ct, *data, taddr, &addr, &port) ||
|
|
|
|
memcmp(&addr, &ct->tuplehash[dir].tuple.src.u3, sizeof(addr)) ||
|
|
|
|
port == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Create expect for h245 connection */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
IPPROTO_TCP, NULL, &port);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp->helper = &nf_conntrack_helper_h245;
|
|
|
|
|
|
|
|
if (memcmp(&ct->tuplehash[dir].tuple.src.u3,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
sizeof(ct->tuplehash[dir].tuple.src.u3)) &&
|
|
|
|
(nat_h245 = rcu_dereference(nat_h245_hook)) &&
|
|
|
|
ct->status & IPS_NAT_MASK) {
|
|
|
|
/* NAT needed */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = nat_h245(skb, ct, ctinfo, data, dataoff, taddr,
|
2006-12-03 07:08:46 +01:00
|
|
|
port, exp);
|
|
|
|
} else { /* Conntrack only */
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: expect H.245 ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the calling party is on the same side of the forward-to party,
|
|
|
|
* we don't need to track the second call */
|
2008-01-31 13:50:05 +01:00
|
|
|
static int callforward_do_filter(const union nf_inet_addr *src,
|
2008-10-08 11:35:00 +02:00
|
|
|
const union nf_inet_addr *dst,
|
|
|
|
u_int8_t family)
|
2006-12-03 07:08:46 +01:00
|
|
|
{
|
2007-12-18 07:42:27 +01:00
|
|
|
const struct nf_afinfo *afinfo;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct flowi fl1, fl2;
|
|
|
|
int ret = 0;
|
|
|
|
|
2007-12-05 10:22:05 +01:00
|
|
|
/* rcu_read_lock()ed by nf_hook_slow() */
|
|
|
|
afinfo = nf_get_afinfo(family);
|
|
|
|
if (!afinfo)
|
|
|
|
return 0;
|
|
|
|
|
2006-12-03 07:08:46 +01:00
|
|
|
memset(&fl1, 0, sizeof(fl1));
|
|
|
|
memset(&fl2, 0, sizeof(fl2));
|
|
|
|
|
|
|
|
switch (family) {
|
|
|
|
case AF_INET: {
|
|
|
|
struct rtable *rt1, *rt2;
|
|
|
|
|
|
|
|
fl1.fl4_dst = src->ip;
|
|
|
|
fl2.fl4_dst = dst->ip;
|
2007-12-05 10:22:05 +01:00
|
|
|
if (!afinfo->route((struct dst_entry **)&rt1, &fl1)) {
|
|
|
|
if (!afinfo->route((struct dst_entry **)&rt2, &fl2)) {
|
2006-12-03 07:08:46 +01:00
|
|
|
if (rt1->rt_gateway == rt2->rt_gateway &&
|
|
|
|
rt1->u.dst.dev == rt2->u.dst.dev)
|
|
|
|
ret = 1;
|
|
|
|
dst_release(&rt2->u.dst);
|
|
|
|
}
|
|
|
|
dst_release(&rt1->u.dst);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2007-12-05 10:22:05 +01:00
|
|
|
#if defined(CONFIG_NF_CONNTRACK_IPV6) || \
|
|
|
|
defined(CONFIG_NF_CONNTRACK_IPV6_MODULE)
|
2006-12-03 07:08:46 +01:00
|
|
|
case AF_INET6: {
|
|
|
|
struct rt6_info *rt1, *rt2;
|
|
|
|
|
|
|
|
memcpy(&fl1.fl6_dst, src, sizeof(fl1.fl6_dst));
|
|
|
|
memcpy(&fl2.fl6_dst, dst, sizeof(fl2.fl6_dst));
|
2007-12-05 10:22:05 +01:00
|
|
|
if (!afinfo->route((struct dst_entry **)&rt1, &fl1)) {
|
|
|
|
if (!afinfo->route((struct dst_entry **)&rt2, &fl2)) {
|
2006-12-03 07:08:46 +01:00
|
|
|
if (!memcmp(&rt1->rt6i_gateway, &rt2->rt6i_gateway,
|
2007-02-12 20:15:49 +01:00
|
|
|
sizeof(rt1->rt6i_gateway)) &&
|
2006-12-03 07:08:46 +01:00
|
|
|
rt1->u.dst.dev == rt2->u.dst.dev)
|
|
|
|
ret = 1;
|
|
|
|
dst_release(&rt2->u.dst);
|
|
|
|
}
|
|
|
|
dst_release(&rt1->u.dst);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int expect_callforwarding(struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
TransportAddress *taddr)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
typeof(nat_callforwarding_hook) nat_callforwarding;
|
|
|
|
|
|
|
|
/* Read alternativeAddress */
|
|
|
|
if (!get_h225_addr(ct, *data, taddr, &addr, &port) || port == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* If the calling party is on the same side of the forward-to party,
|
|
|
|
* we don't need to track the second call */
|
|
|
|
if (callforward_filter &&
|
|
|
|
callforward_do_filter(&addr, &ct->tuplehash[!dir].tuple.src.u3,
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_l3num(ct))) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: Call Forwarding not tracked\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create expect for the second call leg */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3, &addr,
|
|
|
|
IPPROTO_TCP, NULL, &port);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp->helper = nf_conntrack_helper_q931;
|
|
|
|
|
|
|
|
if (memcmp(&ct->tuplehash[dir].tuple.src.u3,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
sizeof(ct->tuplehash[dir].tuple.src.u3)) &&
|
|
|
|
(nat_callforwarding = rcu_dereference(nat_callforwarding_hook)) &&
|
|
|
|
ct->status & IPS_NAT_MASK) {
|
|
|
|
/* Need NAT */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = nat_callforwarding(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
taddr, port, exp);
|
|
|
|
} else { /* Conntrack only */
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: expect Call Forwarding ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
Setup_UUIE *setup)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
typeof(set_h225_addr_hook) set_h225_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: Setup\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (setup->options & eSetup_UUIE_h245Address) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_h245(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&setup->h245Address);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_h225_addr = rcu_dereference(set_h225_addr_hook);
|
|
|
|
if ((setup->options & eSetup_UUIE_destCallSignalAddress) &&
|
2008-03-20 23:06:23 +01:00
|
|
|
(set_h225_addr) && ct->status & IPS_NAT_MASK &&
|
2006-12-03 07:08:46 +01:00
|
|
|
get_h225_addr(ct, *data, &setup->destCallSignalAddress,
|
2007-02-12 20:15:49 +01:00
|
|
|
&addr, &port) &&
|
2006-12-03 07:08:46 +01:00
|
|
|
memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) {
|
2008-10-29 20:52:50 +01:00
|
|
|
pr_debug("nf_ct_q931: set destCallSignalAddress %pI6:%hu->%pI6:%hu\n",
|
2008-10-29 00:08:13 +01:00
|
|
|
&addr, ntohs(port), &ct->tuplehash[!dir].tuple.src.u3,
|
2007-07-08 07:39:38 +02:00
|
|
|
ntohs(ct->tuplehash[!dir].tuple.src.u.tcp.port));
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = set_h225_addr(skb, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&setup->destCallSignalAddress,
|
|
|
|
&ct->tuplehash[!dir].tuple.src.u3,
|
|
|
|
ct->tuplehash[!dir].tuple.src.u.tcp.port);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((setup->options & eSetup_UUIE_sourceCallSignalAddress) &&
|
|
|
|
(set_h225_addr) && ct->status & IPS_NAT_MASK &&
|
|
|
|
get_h225_addr(ct, *data, &setup->sourceCallSignalAddress,
|
2007-02-12 20:15:49 +01:00
|
|
|
&addr, &port) &&
|
2006-12-03 07:08:46 +01:00
|
|
|
memcmp(&addr, &ct->tuplehash[!dir].tuple.dst.u3, sizeof(addr))) {
|
2008-10-29 20:52:50 +01:00
|
|
|
pr_debug("nf_ct_q931: set sourceCallSignalAddress %pI6:%hu->%pI6:%hu\n",
|
2008-10-29 00:08:13 +01:00
|
|
|
&addr, ntohs(port), &ct->tuplehash[!dir].tuple.dst.u3,
|
2007-07-08 07:39:38 +02:00
|
|
|
ntohs(ct->tuplehash[!dir].tuple.dst.u.tcp.port));
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = set_h225_addr(skb, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&setup->sourceCallSignalAddress,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
ct->tuplehash[!dir].tuple.dst.u.tcp.port);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (setup->options & eSetup_UUIE_fastStart) {
|
|
|
|
for (i = 0; i < setup->fastStart.count; i++) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_olc(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&setup->fastStart.item[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_callproceeding(struct sk_buff *skb,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
CallProceeding_UUIE *callproc)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: CallProceeding\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (callproc->options & eCallProceeding_UUIE_h245Address) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_h245(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&callproc->h245Address);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (callproc->options & eCallProceeding_UUIE_fastStart) {
|
|
|
|
for (i = 0; i < callproc->fastStart.count; i++) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_olc(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&callproc->fastStart.item[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_connect(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
Connect_UUIE *connect)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: Connect\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (connect->options & eConnect_UUIE_h245Address) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_h245(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&connect->h245Address);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (connect->options & eConnect_UUIE_fastStart) {
|
|
|
|
for (i = 0; i < connect->fastStart.count; i++) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_olc(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&connect->fastStart.item[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_alerting(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
Alerting_UUIE *alert)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: Alerting\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (alert->options & eAlerting_UUIE_h245Address) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_h245(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&alert->h245Address);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (alert->options & eAlerting_UUIE_fastStart) {
|
|
|
|
for (i = 0; i < alert->fastStart.count; i++) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_olc(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&alert->fastStart.item[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_facility(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
Facility_UUIE *facility)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: Facility\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (facility->reason.choice == eFacilityReason_callForwarded) {
|
|
|
|
if (facility->options & eFacility_UUIE_alternativeAddress)
|
2007-10-15 09:53:15 +02:00
|
|
|
return expect_callforwarding(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
dataoff,
|
|
|
|
&facility->
|
|
|
|
alternativeAddress);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (facility->options & eFacility_UUIE_h245Address) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_h245(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&facility->h245Address);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (facility->options & eFacility_UUIE_fastStart) {
|
|
|
|
for (i = 0; i < facility->fastStart.count; i++) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_olc(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&facility->fastStart.item[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_progress(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff,
|
|
|
|
Progress_UUIE *progress)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: Progress\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (progress->options & eProgress_UUIE_h245Address) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_h245(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&progress->h245Address);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (progress->options & eProgress_UUIE_fastStart) {
|
|
|
|
for (i = 0; i < progress->fastStart.count; i++) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_olc(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&progress->fastStart.item[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_q931(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, int dataoff, Q931 *q931)
|
|
|
|
{
|
|
|
|
H323_UU_PDU *pdu = &q931->UUIE.h323_uu_pdu;
|
|
|
|
int i;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
switch (pdu->h323_message_body.choice) {
|
|
|
|
case eH323_UU_PDU_h323_message_body_setup:
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_setup(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&pdu->h323_message_body.setup);
|
|
|
|
break;
|
|
|
|
case eH323_UU_PDU_h323_message_body_callProceeding:
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_callproceeding(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&pdu->h323_message_body.
|
|
|
|
callProceeding);
|
|
|
|
break;
|
|
|
|
case eH323_UU_PDU_h323_message_body_connect:
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_connect(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&pdu->h323_message_body.connect);
|
|
|
|
break;
|
|
|
|
case eH323_UU_PDU_h323_message_body_alerting:
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_alerting(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&pdu->h323_message_body.alerting);
|
|
|
|
break;
|
|
|
|
case eH323_UU_PDU_h323_message_body_facility:
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_facility(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&pdu->h323_message_body.facility);
|
|
|
|
break;
|
|
|
|
case eH323_UU_PDU_h323_message_body_progress:
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_progress(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&pdu->h323_message_body.progress);
|
|
|
|
break;
|
|
|
|
default:
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: Q.931 signal %d\n",
|
|
|
|
pdu->h323_message_body.choice);
|
2006-12-03 07:08:46 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (pdu->options & eH323_UU_PDU_h245Control) {
|
|
|
|
for (i = 0; i < pdu->h245Control.count; i++) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = process_h245(skb, ct, ctinfo, data, dataoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
&pdu->h245Control.item[i]);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int q931_help(struct sk_buff *skb, unsigned int protoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct, enum ip_conntrack_info ctinfo)
|
|
|
|
{
|
|
|
|
static Q931 q931;
|
|
|
|
unsigned char *data = NULL;
|
|
|
|
int datalen;
|
|
|
|
int dataoff;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Until there's been traffic both ways, don't look in packets. */
|
|
|
|
if (ctinfo != IP_CT_ESTABLISHED &&
|
|
|
|
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
|
|
|
|
return NF_ACCEPT;
|
|
|
|
}
|
2007-10-15 09:53:15 +02:00
|
|
|
pr_debug("nf_ct_q931: skblen = %u\n", skb->len);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
spin_lock_bh(&nf_h323_lock);
|
|
|
|
|
|
|
|
/* Process each TPKT */
|
2007-10-15 09:53:15 +02:00
|
|
|
while (get_tpkt_data(skb, protoff, ct, ctinfo,
|
2006-12-03 07:08:46 +01:00
|
|
|
&data, &datalen, &dataoff)) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: TPKT len=%d ", datalen);
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
/* Decode Q.931 signal */
|
|
|
|
ret = DecodeQ931(data, datalen, &q931);
|
|
|
|
if (ret < 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_q931: decoding error: %s\n",
|
|
|
|
ret == H323_ERROR_BOUND ?
|
|
|
|
"out of bound" : "out of range");
|
2006-12-03 07:08:46 +01:00
|
|
|
/* We don't drop when decoding error */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Process Q.931 signal */
|
2007-10-15 09:53:15 +02:00
|
|
|
if (process_q931(skb, ct, ctinfo, &data, dataoff, &q931) < 0)
|
2006-12-03 07:08:46 +01:00
|
|
|
goto drop;
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock_bh(&nf_h323_lock);
|
|
|
|
return NF_ACCEPT;
|
|
|
|
|
|
|
|
drop:
|
|
|
|
spin_unlock_bh(&nf_h323_lock);
|
|
|
|
if (net_ratelimit())
|
2010-05-13 15:02:08 +02:00
|
|
|
pr_info("nf_ct_q931: packet dropped\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
return NF_DROP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2008-03-26 04:09:15 +01:00
|
|
|
static const struct nf_conntrack_expect_policy q931_exp_policy = {
|
|
|
|
/* T.120 and H.245 */
|
|
|
|
.max_expected = H323_RTP_CHANNEL_MAX * 4 + 4,
|
|
|
|
.timeout = 240,
|
|
|
|
};
|
|
|
|
|
2006-12-03 07:08:46 +01:00
|
|
|
static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
|
|
|
|
{
|
|
|
|
.name = "Q.931",
|
|
|
|
.me = THIS_MODULE,
|
|
|
|
.tuple.src.l3num = AF_INET,
|
2009-02-01 09:45:17 +01:00
|
|
|
.tuple.src.u.tcp.port = cpu_to_be16(Q931_PORT),
|
2006-12-03 07:08:46 +01:00
|
|
|
.tuple.dst.protonum = IPPROTO_TCP,
|
2008-03-26 04:09:15 +01:00
|
|
|
.help = q931_help,
|
|
|
|
.expect_policy = &q931_exp_policy,
|
2006-12-03 07:08:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "Q.931",
|
|
|
|
.me = THIS_MODULE,
|
|
|
|
.tuple.src.l3num = AF_INET6,
|
2009-02-01 09:45:17 +01:00
|
|
|
.tuple.src.u.tcp.port = cpu_to_be16(Q931_PORT),
|
2006-12-03 07:08:46 +01:00
|
|
|
.tuple.dst.protonum = IPPROTO_TCP,
|
2008-03-26 04:09:15 +01:00
|
|
|
.help = q931_help,
|
|
|
|
.expect_policy = &q931_exp_policy,
|
2006-12-03 07:08:46 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static unsigned char *get_udp_data(struct sk_buff *skb, unsigned int protoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
int *datalen)
|
|
|
|
{
|
2008-01-31 13:50:05 +01:00
|
|
|
const struct udphdr *uh;
|
|
|
|
struct udphdr _uh;
|
2006-12-03 07:08:46 +01:00
|
|
|
int dataoff;
|
|
|
|
|
2007-10-15 09:53:15 +02:00
|
|
|
uh = skb_header_pointer(skb, protoff, sizeof(_uh), &_uh);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (uh == NULL)
|
|
|
|
return NULL;
|
|
|
|
dataoff = protoff + sizeof(_uh);
|
2007-10-15 09:53:15 +02:00
|
|
|
if (dataoff >= skb->len)
|
2006-12-03 07:08:46 +01:00
|
|
|
return NULL;
|
2007-10-15 09:53:15 +02:00
|
|
|
*datalen = skb->len - dataoff;
|
|
|
|
return skb_header_pointer(skb, dataoff, *datalen, h323_buffer);
|
2006-12-03 07:08:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
static struct nf_conntrack_expect *find_expect(struct nf_conn *ct,
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr *addr,
|
2006-12-03 07:08:46 +01:00
|
|
|
__be16 port)
|
|
|
|
{
|
2008-10-08 11:35:09 +02:00
|
|
|
struct net *net = nf_ct_net(ct);
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
struct nf_conntrack_tuple tuple;
|
|
|
|
|
|
|
|
memset(&tuple.src.u3, 0, sizeof(tuple.src.u3));
|
|
|
|
tuple.src.u.tcp.port = 0;
|
|
|
|
memcpy(&tuple.dst.u3, addr, sizeof(tuple.dst.u3));
|
|
|
|
tuple.dst.u.tcp.port = port;
|
|
|
|
tuple.dst.protonum = IPPROTO_TCP;
|
|
|
|
|
2010-02-15 18:13:33 +01:00
|
|
|
exp = __nf_ct_expect_find(net, nf_ct_zone(ct), &tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (exp && exp->master == ct)
|
|
|
|
return exp;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
static int set_expect_timeout(struct nf_conntrack_expect *exp,
|
|
|
|
unsigned timeout)
|
|
|
|
{
|
|
|
|
if (!exp || !del_timer(&exp->timeout))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
exp->timeout.expires = jiffies + timeout * HZ;
|
|
|
|
add_timer(&exp->timeout);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int expect_q931(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data,
|
|
|
|
TransportAddress *taddr, int count)
|
|
|
|
{
|
|
|
|
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
int i;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
typeof(nat_q931_hook) nat_q931;
|
|
|
|
|
|
|
|
/* Look for the first related address */
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
if (get_h225_addr(ct, *data, &taddr[i], &addr, &port) &&
|
|
|
|
memcmp(&addr, &ct->tuplehash[dir].tuple.src.u3,
|
2007-02-12 20:15:49 +01:00
|
|
|
sizeof(addr)) == 0 && port != 0)
|
2006-12-03 07:08:46 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i >= count) /* Not found */
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Create expect for Q.931 */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
gkrouted_only ? /* only accept calls from GK? */
|
|
|
|
&ct->tuplehash[!dir].tuple.src.u3 : NULL,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
IPPROTO_TCP, NULL, &port);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp->helper = nf_conntrack_helper_q931;
|
|
|
|
exp->flags = NF_CT_EXPECT_PERMANENT; /* Accept multiple calls */
|
|
|
|
|
|
|
|
nat_q931 = rcu_dereference(nat_q931_hook);
|
|
|
|
if (nat_q931 && ct->status & IPS_NAT_MASK) { /* Need NAT */
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = nat_q931(skb, ct, ctinfo, data, taddr, i, port, exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else { /* Conntrack only */
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: expect Q.931 ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
/* Save port for looking up expect in processing RCF */
|
|
|
|
info->sig_port[dir] = port;
|
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_grq(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, GatekeeperRequest *grq)
|
|
|
|
{
|
|
|
|
typeof(set_ras_addr_hook) set_ras_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: GRQ\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
set_ras_addr = rcu_dereference(set_ras_addr_hook);
|
|
|
|
if (set_ras_addr && ct->status & IPS_NAT_MASK) /* NATed */
|
2007-10-15 09:53:15 +02:00
|
|
|
return set_ras_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&grq->rasAddress, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_gcf(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, GatekeeperConfirm *gcf)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: GCF\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (!get_h225_addr(ct, *data, &gcf->rasAddress, &addr, &port))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Registration port is the same as discovery port */
|
|
|
|
if (!memcmp(&addr, &ct->tuplehash[dir].tuple.src.u3, sizeof(addr)) &&
|
|
|
|
port == ct->tuplehash[dir].tuple.src.u.udp.port)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Avoid RAS expectation loops. A GCF is never expected. */
|
|
|
|
if (test_bit(IPS_EXPECTED_BIT, &ct->status))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Need new expect */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3, &addr,
|
|
|
|
IPPROTO_UDP, NULL, &port);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp->helper = nf_conntrack_helper_ras;
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: expect RAS ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_rrq(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, RegistrationRequest *rrq)
|
|
|
|
{
|
|
|
|
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
|
|
|
int ret;
|
|
|
|
typeof(set_ras_addr_hook) set_ras_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: RRQ\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = expect_q931(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
rrq->callSignalAddress.item,
|
|
|
|
rrq->callSignalAddress.count);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
set_ras_addr = rcu_dereference(set_ras_addr_hook);
|
|
|
|
if (set_ras_addr && ct->status & IPS_NAT_MASK) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = set_ras_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
rrq->rasAddress.item,
|
|
|
|
rrq->rasAddress.count);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rrq->options & eRegistrationRequest_timeToLive) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: RRQ TTL = %u seconds\n", rrq->timeToLive);
|
2006-12-03 07:08:46 +01:00
|
|
|
info->timeout = rrq->timeToLive;
|
|
|
|
} else
|
|
|
|
info->timeout = default_rrq_ttl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, RegistrationConfirm *rcf)
|
|
|
|
{
|
|
|
|
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret;
|
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
typeof(set_sig_addr_hook) set_sig_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: RCF\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
set_sig_addr = rcu_dereference(set_sig_addr_hook);
|
|
|
|
if (set_sig_addr && ct->status & IPS_NAT_MASK) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = set_sig_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
rcf->callSignalAddress.item,
|
|
|
|
rcf->callSignalAddress.count);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rcf->options & eRegistrationConfirm_timeToLive) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: RCF TTL = %u seconds\n", rcf->timeToLive);
|
2006-12-03 07:08:46 +01:00
|
|
|
info->timeout = rcf->timeToLive;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->timeout > 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: set RAS connection timeout to "
|
|
|
|
"%u seconds\n", info->timeout);
|
2007-10-15 09:53:15 +02:00
|
|
|
nf_ct_refresh(ct, skb, info->timeout * HZ);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
/* Set expect timeout */
|
2008-01-31 13:38:58 +01:00
|
|
|
spin_lock_bh(&nf_conntrack_lock);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp = find_expect(ct, &ct->tuplehash[dir].tuple.dst.u3,
|
|
|
|
info->sig_port[!dir]);
|
|
|
|
if (exp) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: set Q.931 expect "
|
|
|
|
"timeout to %u seconds for",
|
|
|
|
info->timeout);
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
set_expect_timeout(exp, info->timeout);
|
|
|
|
}
|
2008-01-31 13:38:58 +01:00
|
|
|
spin_unlock_bh(&nf_conntrack_lock);
|
2006-12-03 07:08:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_urq(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, UnregistrationRequest *urq)
|
|
|
|
{
|
|
|
|
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret;
|
|
|
|
typeof(set_sig_addr_hook) set_sig_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: URQ\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
set_sig_addr = rcu_dereference(set_sig_addr_hook);
|
|
|
|
if (set_sig_addr && ct->status & IPS_NAT_MASK) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = set_sig_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
urq->callSignalAddress.item,
|
|
|
|
urq->callSignalAddress.count);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear old expect */
|
|
|
|
nf_ct_remove_expectations(ct);
|
|
|
|
info->sig_port[dir] = 0;
|
|
|
|
info->sig_port[!dir] = 0;
|
|
|
|
|
|
|
|
/* Give it 30 seconds for UCF or URJ */
|
2007-10-15 09:53:15 +02:00
|
|
|
nf_ct_refresh(ct, skb, 30 * HZ);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_arq(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, AdmissionRequest *arq)
|
|
|
|
{
|
2008-01-31 13:50:05 +01:00
|
|
|
const struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
2006-12-03 07:08:46 +01:00
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
typeof(set_h225_addr_hook) set_h225_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: ARQ\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
set_h225_addr = rcu_dereference(set_h225_addr_hook);
|
|
|
|
if ((arq->options & eAdmissionRequest_destCallSignalAddress) &&
|
|
|
|
get_h225_addr(ct, *data, &arq->destCallSignalAddress,
|
2007-02-12 20:15:49 +01:00
|
|
|
&addr, &port) &&
|
2006-12-03 07:08:46 +01:00
|
|
|
!memcmp(&addr, &ct->tuplehash[dir].tuple.src.u3, sizeof(addr)) &&
|
|
|
|
port == info->sig_port[dir] &&
|
|
|
|
set_h225_addr && ct->status & IPS_NAT_MASK) {
|
|
|
|
/* Answering ARQ */
|
2007-10-15 09:53:15 +02:00
|
|
|
return set_h225_addr(skb, data, 0,
|
2006-12-03 07:08:46 +01:00
|
|
|
&arq->destCallSignalAddress,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
info->sig_port[!dir]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((arq->options & eAdmissionRequest_srcCallSignalAddress) &&
|
|
|
|
get_h225_addr(ct, *data, &arq->srcCallSignalAddress,
|
2007-02-12 20:15:49 +01:00
|
|
|
&addr, &port) &&
|
2006-12-03 07:08:46 +01:00
|
|
|
!memcmp(&addr, &ct->tuplehash[dir].tuple.src.u3, sizeof(addr)) &&
|
|
|
|
set_h225_addr && ct->status & IPS_NAT_MASK) {
|
|
|
|
/* Calling ARQ */
|
2007-10-15 09:53:15 +02:00
|
|
|
return set_h225_addr(skb, data, 0,
|
2006-12-03 07:08:46 +01:00
|
|
|
&arq->srcCallSignalAddress,
|
|
|
|
&ct->tuplehash[!dir].tuple.dst.u3,
|
|
|
|
port);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_acf(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, AdmissionConfirm *acf)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
typeof(set_sig_addr_hook) set_sig_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: ACF\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (!get_h225_addr(ct, *data, &acf->destCallSignalAddress,
|
|
|
|
&addr, &port))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (!memcmp(&addr, &ct->tuplehash[dir].tuple.dst.u3, sizeof(addr))) {
|
|
|
|
/* Answering ACF */
|
|
|
|
set_sig_addr = rcu_dereference(set_sig_addr_hook);
|
|
|
|
if (set_sig_addr && ct->status & IPS_NAT_MASK)
|
2007-10-15 09:53:15 +02:00
|
|
|
return set_sig_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&acf->destCallSignalAddress, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Need new expect */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3, &addr,
|
|
|
|
IPPROTO_TCP, NULL, &port);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp->flags = NF_CT_EXPECT_PERMANENT;
|
|
|
|
exp->helper = nf_conntrack_helper_q931;
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: expect Q.931 ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_lrq(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, LocationRequest *lrq)
|
|
|
|
{
|
|
|
|
typeof(set_ras_addr_hook) set_ras_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: LRQ\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
set_ras_addr = rcu_dereference(set_ras_addr_hook);
|
|
|
|
if (set_ras_addr && ct->status & IPS_NAT_MASK)
|
2007-10-15 09:53:15 +02:00
|
|
|
return set_ras_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&lrq->replyAddress, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_lcf(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, LocationConfirm *lcf)
|
|
|
|
{
|
|
|
|
int dir = CTINFO2DIR(ctinfo);
|
|
|
|
int ret = 0;
|
|
|
|
__be16 port;
|
2007-12-18 07:43:50 +01:00
|
|
|
union nf_inet_addr addr;
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conntrack_expect *exp;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: LCF\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
if (!get_h225_addr(ct, *data, &lcf->callSignalAddress,
|
|
|
|
&addr, &port))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Need new expect for call signal */
|
2007-07-08 07:30:49 +02:00
|
|
|
if ((exp = nf_ct_expect_alloc(ct)) == NULL)
|
2006-12-03 07:08:46 +01:00
|
|
|
return -1;
|
2008-04-14 11:15:52 +02:00
|
|
|
nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),
|
2007-07-08 07:30:49 +02:00
|
|
|
&ct->tuplehash[!dir].tuple.src.u3, &addr,
|
|
|
|
IPPROTO_TCP, NULL, &port);
|
2006-12-03 07:08:46 +01:00
|
|
|
exp->flags = NF_CT_EXPECT_PERMANENT;
|
|
|
|
exp->helper = nf_conntrack_helper_q931;
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
if (nf_ct_expect_related(exp) == 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: expect Q.931 ");
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&exp->tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
} else
|
|
|
|
ret = -1;
|
|
|
|
|
2007-07-08 07:30:49 +02:00
|
|
|
nf_ct_expect_put(exp);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
/* Ignore rasAddress */
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_irr(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, InfoRequestResponse *irr)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
typeof(set_ras_addr_hook) set_ras_addr;
|
|
|
|
typeof(set_sig_addr_hook) set_sig_addr;
|
|
|
|
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: IRR\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
set_ras_addr = rcu_dereference(set_ras_addr_hook);
|
|
|
|
if (set_ras_addr && ct->status & IPS_NAT_MASK) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = set_ras_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&irr->rasAddress, 1);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_sig_addr = rcu_dereference(set_sig_addr_hook);
|
|
|
|
if (set_sig_addr && ct->status & IPS_NAT_MASK) {
|
2007-10-15 09:53:15 +02:00
|
|
|
ret = set_sig_addr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
irr->callSignalAddress.item,
|
|
|
|
irr->callSignalAddress.count);
|
|
|
|
if (ret < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int process_ras(struct sk_buff *skb, struct nf_conn *ct,
|
2006-12-03 07:08:46 +01:00
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
unsigned char **data, RasMessage *ras)
|
|
|
|
{
|
|
|
|
switch (ras->choice) {
|
|
|
|
case eRasMessage_gatekeeperRequest:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_grq(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->gatekeeperRequest);
|
|
|
|
case eRasMessage_gatekeeperConfirm:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_gcf(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->gatekeeperConfirm);
|
|
|
|
case eRasMessage_registrationRequest:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_rrq(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->registrationRequest);
|
|
|
|
case eRasMessage_registrationConfirm:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_rcf(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->registrationConfirm);
|
|
|
|
case eRasMessage_unregistrationRequest:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_urq(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->unregistrationRequest);
|
|
|
|
case eRasMessage_admissionRequest:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_arq(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->admissionRequest);
|
|
|
|
case eRasMessage_admissionConfirm:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_acf(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->admissionConfirm);
|
|
|
|
case eRasMessage_locationRequest:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_lrq(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->locationRequest);
|
|
|
|
case eRasMessage_locationConfirm:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_lcf(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->locationConfirm);
|
|
|
|
case eRasMessage_infoRequestResponse:
|
2007-10-15 09:53:15 +02:00
|
|
|
return process_irr(skb, ct, ctinfo, data,
|
2006-12-03 07:08:46 +01:00
|
|
|
&ras->infoRequestResponse);
|
|
|
|
default:
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: RAS message %d\n", ras->choice);
|
2006-12-03 07:08:46 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-10-15 09:53:15 +02:00
|
|
|
static int ras_help(struct sk_buff *skb, unsigned int protoff,
|
2006-12-03 07:08:46 +01:00
|
|
|
struct nf_conn *ct, enum ip_conntrack_info ctinfo)
|
|
|
|
{
|
|
|
|
static RasMessage ras;
|
|
|
|
unsigned char *data;
|
|
|
|
int datalen = 0;
|
|
|
|
int ret;
|
|
|
|
|
2007-10-15 09:53:15 +02:00
|
|
|
pr_debug("nf_ct_ras: skblen = %u\n", skb->len);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
spin_lock_bh(&nf_h323_lock);
|
|
|
|
|
|
|
|
/* Get UDP data */
|
2007-10-15 09:53:15 +02:00
|
|
|
data = get_udp_data(skb, protoff, &datalen);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (data == NULL)
|
|
|
|
goto accept;
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: RAS message len=%d ", datalen);
|
2008-04-14 11:15:54 +02:00
|
|
|
nf_ct_dump_tuple(&ct->tuplehash[CTINFO2DIR(ctinfo)].tuple);
|
2006-12-03 07:08:46 +01:00
|
|
|
|
|
|
|
/* Decode RAS message */
|
|
|
|
ret = DecodeRasMessage(data, datalen, &ras);
|
|
|
|
if (ret < 0) {
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_ras: decoding error: %s\n",
|
|
|
|
ret == H323_ERROR_BOUND ?
|
|
|
|
"out of bound" : "out of range");
|
2006-12-03 07:08:46 +01:00
|
|
|
goto accept;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Process RAS message */
|
2007-10-15 09:53:15 +02:00
|
|
|
if (process_ras(skb, ct, ctinfo, &data, &ras) < 0)
|
2006-12-03 07:08:46 +01:00
|
|
|
goto drop;
|
|
|
|
|
|
|
|
accept:
|
|
|
|
spin_unlock_bh(&nf_h323_lock);
|
|
|
|
return NF_ACCEPT;
|
|
|
|
|
|
|
|
drop:
|
|
|
|
spin_unlock_bh(&nf_h323_lock);
|
|
|
|
if (net_ratelimit())
|
2010-05-13 15:02:08 +02:00
|
|
|
pr_info("nf_ct_ras: packet dropped\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
return NF_DROP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2008-03-26 04:09:15 +01:00
|
|
|
static const struct nf_conntrack_expect_policy ras_exp_policy = {
|
|
|
|
.max_expected = 32,
|
|
|
|
.timeout = 240,
|
|
|
|
};
|
|
|
|
|
2006-12-03 07:08:46 +01:00
|
|
|
static struct nf_conntrack_helper nf_conntrack_helper_ras[] __read_mostly = {
|
|
|
|
{
|
|
|
|
.name = "RAS",
|
|
|
|
.me = THIS_MODULE,
|
|
|
|
.tuple.src.l3num = AF_INET,
|
2009-02-01 09:45:17 +01:00
|
|
|
.tuple.src.u.udp.port = cpu_to_be16(RAS_PORT),
|
2006-12-03 07:08:46 +01:00
|
|
|
.tuple.dst.protonum = IPPROTO_UDP,
|
|
|
|
.help = ras_help,
|
2008-03-26 04:09:15 +01:00
|
|
|
.expect_policy = &ras_exp_policy,
|
2006-12-03 07:08:46 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "RAS",
|
|
|
|
.me = THIS_MODULE,
|
|
|
|
.tuple.src.l3num = AF_INET6,
|
2009-02-01 09:45:17 +01:00
|
|
|
.tuple.src.u.udp.port = cpu_to_be16(RAS_PORT),
|
2006-12-03 07:08:46 +01:00
|
|
|
.tuple.dst.protonum = IPPROTO_UDP,
|
|
|
|
.help = ras_help,
|
2008-03-26 04:09:15 +01:00
|
|
|
.expect_policy = &ras_exp_policy,
|
2006-12-03 07:08:46 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
static void __exit nf_conntrack_h323_fini(void)
|
|
|
|
{
|
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[1]);
|
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]);
|
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]);
|
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]);
|
2008-06-18 00:52:32 +02:00
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_h245);
|
2006-12-03 07:08:46 +01:00
|
|
|
kfree(h323_buffer);
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: fini\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
static int __init nf_conntrack_h323_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
h323_buffer = kmalloc(65536, GFP_KERNEL);
|
|
|
|
if (!h323_buffer)
|
|
|
|
return -ENOMEM;
|
2008-06-18 00:52:32 +02:00
|
|
|
ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (ret < 0)
|
|
|
|
goto err1;
|
2008-06-18 00:52:32 +02:00
|
|
|
ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (ret < 0)
|
|
|
|
goto err2;
|
2008-06-18 00:52:32 +02:00
|
|
|
ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (ret < 0)
|
|
|
|
goto err3;
|
2008-06-18 00:52:32 +02:00
|
|
|
ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]);
|
2006-12-03 07:08:46 +01:00
|
|
|
if (ret < 0)
|
|
|
|
goto err4;
|
2008-06-18 00:52:32 +02:00
|
|
|
ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]);
|
|
|
|
if (ret < 0)
|
|
|
|
goto err5;
|
2007-07-08 07:39:38 +02:00
|
|
|
pr_debug("nf_ct_h323: init success\n");
|
2006-12-03 07:08:46 +01:00
|
|
|
return 0;
|
|
|
|
|
2008-06-18 00:52:32 +02:00
|
|
|
err5:
|
2006-12-03 07:08:46 +01:00
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]);
|
2008-06-18 00:52:32 +02:00
|
|
|
err4:
|
2006-12-03 07:08:46 +01:00
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]);
|
2008-06-18 00:52:32 +02:00
|
|
|
err3:
|
2006-12-03 07:08:46 +01:00
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]);
|
2008-06-18 00:52:32 +02:00
|
|
|
err2:
|
|
|
|
nf_conntrack_helper_unregister(&nf_conntrack_helper_h245);
|
2006-12-03 07:08:46 +01:00
|
|
|
err1:
|
2008-06-18 00:52:07 +02:00
|
|
|
kfree(h323_buffer);
|
2006-12-03 07:08:46 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
module_init(nf_conntrack_h323_init);
|
|
|
|
module_exit(nf_conntrack_h323_fini);
|
|
|
|
|
|
|
|
EXPORT_SYMBOL_GPL(get_h225_addr);
|
|
|
|
EXPORT_SYMBOL_GPL(set_h245_addr_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(set_h225_addr_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(set_sig_addr_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(set_ras_addr_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(nat_rtp_rtcp_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(nat_t120_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(nat_h245_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(nat_callforwarding_hook);
|
|
|
|
EXPORT_SYMBOL_GPL(nat_q931_hook);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Jing Min Zhao <zhaojingmin@users.sourceforge.net>");
|
|
|
|
MODULE_DESCRIPTION("H.323 connection tracking helper");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_ALIAS("ip_conntrack_h323");
|
2008-11-17 16:01:42 +01:00
|
|
|
MODULE_ALIAS_NFCT_HELPER("h323");
|