Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e31fcf8 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "netfilter: nf_conntrack_sip: Dynamically enable/disable SIP ALG."

parents 7941fc73 d2aeec08
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -56,6 +56,28 @@ MODULE_PARM_DESC(sip_direct_media, "Expect Media streams between signalling "

const struct nf_nat_sip_hooks *nf_nat_sip_hooks;
EXPORT_SYMBOL_GPL(nf_nat_sip_hooks);
static struct ctl_table_header *sip_sysctl_header;
static unsigned int nf_ct_disable_sip_alg;
static struct ctl_table sip_sysctl_tbl[] = {
	{
		.procname     = "nf_conntrack_disable_sip_alg",
		.data         = &nf_ct_disable_sip_alg,
		.maxlen       = sizeof(unsigned int),
		.mode         = 0644,
		.proc_handler = proc_dointvec,
	},
	{}
};

static struct ctl_path sip_sysctls_path[] = {
	{
		.procname  = "net",
	},
	{
		.procname  = "netfilter",
	},
	{}
};

static int string_len(const struct nf_conn *ct, const char *dptr,
		      const char *limit, int *shift)
@@ -1467,6 +1489,8 @@ static int process_sip_msg(struct sk_buff *skb, struct nf_conn *ct,
	const struct nf_nat_sip_hooks *hooks;
	int ret;

	if (nf_ct_disable_sip_alg)
		return NF_ACCEPT;
	if (strncasecmp(*dptr, "SIP/2.0 ", strlen("SIP/2.0 ")) != 0)
		ret = process_sip_request(skb, protoff, dataoff, dptr, datalen);
	else
@@ -1626,6 +1650,16 @@ static int __init nf_conntrack_sip_init(void)
{
	int i, ret;

	sip_sysctl_header = register_sysctl_paths(sip_sysctls_path,
						  sip_sysctl_tbl);
	if (!sip_sysctl_header)
		pr_debug("nf_ct_sip:Unable to register SIP systbl\n");

	if (nf_ct_disable_sip_alg)
		pr_debug("nf_ct_sip: SIP ALG disabled\n");
	else
		pr_debug("nf_ct_sip: SIP ALG enabled\n");

	if (ports_c == 0)
		ports[ports_c++] = SIP_PORT;