License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 08:07:57 -06:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2006-11-28 18:34:58 -07:00
|
|
|
/*
|
|
|
|
* connection tracking expectations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NF_CONNTRACK_EXPECT_H
|
|
|
|
#define _NF_CONNTRACK_EXPECT_H
|
2015-08-08 13:40:01 -06:00
|
|
|
|
2017-03-16 02:03:34 -06:00
|
|
|
#include <linux/refcount.h>
|
|
|
|
|
2006-11-28 18:34:58 -07:00
|
|
|
#include <net/netfilter/nf_conntrack.h>
|
2015-08-08 13:40:01 -06:00
|
|
|
#include <net/netfilter/nf_conntrack_zones.h>
|
2006-11-28 18:34:58 -07:00
|
|
|
|
2007-07-07 23:33:47 -06:00
|
|
|
extern unsigned int nf_ct_expect_hsize;
|
2007-07-07 23:36:24 -06:00
|
|
|
extern unsigned int nf_ct_expect_max;
|
2016-05-05 16:51:49 -06:00
|
|
|
extern struct hlist_head *nf_ct_expect_hash;
|
2006-11-28 18:34:58 -07:00
|
|
|
|
2009-11-02 20:26:03 -07:00
|
|
|
struct nf_conntrack_expect {
|
2007-07-07 23:35:56 -06:00
|
|
|
/* Conntrack expectation list member */
|
|
|
|
struct hlist_node lnode;
|
2006-11-28 18:34:58 -07:00
|
|
|
|
2007-07-07 23:33:47 -06:00
|
|
|
/* Hash member */
|
|
|
|
struct hlist_node hnode;
|
|
|
|
|
2006-11-28 18:34:58 -07:00
|
|
|
/* We expect this tuple, with the following mask */
|
2007-07-07 23:31:32 -06:00
|
|
|
struct nf_conntrack_tuple tuple;
|
|
|
|
struct nf_conntrack_tuple_mask mask;
|
2006-11-28 18:34:58 -07:00
|
|
|
|
|
|
|
/* Function to call after setup and insertion */
|
|
|
|
void (*expectfn)(struct nf_conn *new,
|
|
|
|
struct nf_conntrack_expect *this);
|
|
|
|
|
2006-12-02 23:05:25 -07:00
|
|
|
/* Helper to assign to new connection */
|
|
|
|
struct nf_conntrack_helper *helper;
|
|
|
|
|
2006-11-28 18:34:58 -07:00
|
|
|
/* The conntrack of the master connection */
|
|
|
|
struct nf_conn *master;
|
|
|
|
|
|
|
|
/* Timer function; deletes the expectation. */
|
|
|
|
struct timer_list timeout;
|
|
|
|
|
|
|
|
/* Usage count. */
|
2017-03-16 02:03:34 -06:00
|
|
|
refcount_t use;
|
2006-11-28 18:34:58 -07:00
|
|
|
|
|
|
|
/* Flags */
|
|
|
|
unsigned int flags;
|
|
|
|
|
2008-03-25 21:09:15 -06:00
|
|
|
/* Expectation class */
|
|
|
|
unsigned int class;
|
|
|
|
|
2019-03-27 02:22:26 -06:00
|
|
|
#if IS_ENABLED(CONFIG_NF_NAT)
|
2012-08-26 11:14:06 -06:00
|
|
|
union nf_inet_addr saved_addr;
|
2006-11-28 18:34:58 -07:00
|
|
|
/* This is the original per-proto part, used to map the
|
|
|
|
* expected connection the way the recipient expects. */
|
2006-12-02 23:07:13 -07:00
|
|
|
union nf_conntrack_man_proto saved_proto;
|
2006-11-28 18:34:58 -07:00
|
|
|
/* Direction relative to the master connection. */
|
|
|
|
enum ip_conntrack_dir dir;
|
|
|
|
#endif
|
2008-01-31 05:38:19 -07:00
|
|
|
|
|
|
|
struct rcu_head rcu;
|
2006-11-28 18:34:58 -07:00
|
|
|
};
|
|
|
|
|
2008-10-08 03:35:03 -06:00
|
|
|
static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
|
|
|
|
{
|
2010-02-11 22:24:46 -07:00
|
|
|
return nf_ct_net(exp->master);
|
2008-10-08 03:35:03 -06:00
|
|
|
}
|
|
|
|
|
2012-01-15 08:34:08 -07:00
|
|
|
#define NF_CT_EXP_POLICY_NAME_LEN 16
|
|
|
|
|
2009-11-02 20:26:03 -07:00
|
|
|
struct nf_conntrack_expect_policy {
|
2008-03-25 21:09:15 -06:00
|
|
|
unsigned int max_expected;
|
|
|
|
unsigned int timeout;
|
2012-01-15 08:34:08 -07:00
|
|
|
char name[NF_CT_EXP_POLICY_NAME_LEN];
|
2008-03-25 21:09:15 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NF_CT_EXPECT_CLASS_DEFAULT 0
|
2017-03-24 07:32:19 -06:00
|
|
|
#define NF_CT_EXPECT_MAX_CNT 255
|
2008-03-25 21:09:15 -06:00
|
|
|
|
netfilter: nf_conntrack_sip: fix expectation clash
When conntracks change during a dialog, SDP messages may be sent from
different conntracks to establish expects with identical tuples. In this
case expects conflict may be detected for the 2nd SDP message and end up
with a process failure.
The fixing here is to reuse an existing expect who has the same tuple for a
different conntrack if any.
Here are two scenarios for the case.
1)
SERVER CPE
| INVITE SDP |
5060 |<----------------------|5060
| 100 Trying |
5060 |---------------------->|5060
| 183 SDP |
5060 |---------------------->|5060 ===> Conntrack 1
| PRACK |
50601 |<----------------------|5060
| 200 OK (PRACK) |
50601 |---------------------->|5060
| 200 OK (INVITE) |
5060 |---------------------->|5060
| ACK |
50601 |<----------------------|5060
| |
|<--- RTP stream ------>|
| |
| INVITE SDP (t38) |
50601 |---------------------->|5060 ===> Conntrack 2
With a certain configuration in the CPE, SIP messages "183 with SDP" and
"re-INVITE with SDP t38" will go through the sip helper to create
expects for RTP and RTCP.
It is okay to create RTP and RTCP expects for "183", whose master
connection source port is 5060, and destination port is 5060.
In the "183" message, port in Contact header changes to 50601 (from the
original 5060). So the following requests e.g. PRACK and ACK are sent to
port 50601. It is a different conntrack (let call Conntrack 2) from the
original INVITE (let call Conntrack 1) due to the port difference.
In this example, after the call is established, there is RTP stream but no
RTCP stream for Conntrack 1, so the RTP expect created upon "183" is
cleared, and RTCP expect created for Conntrack 1 retains.
When "re-INVITE with SDP t38" arrives to create RTP&RTCP expects, current
ALG implementation will call nf_ct_expect_related() for RTP and RTCP. The
expects tuples are identical to those for Conntrack 1. RTP expect for
Conntrack 2 succeeds in creation as the one for Conntrack 1 has been
removed. RTCP expect for Conntrack 2 fails in creation because it has
idential tuples and 'conflict' with the one retained for Conntrack 1. And
then result in a failure in processing of the re-INVITE.
2)
SERVER A CPE
| REGISTER |
5060 |<------------------| 5060 ==> CT1
| 200 |
5060 |------------------>| 5060
| |
| INVITE SDP(1) |
5060 |<------------------| 5060
| 300(multi choice) |
5060 |------------------>| 5060 SERVER B
| ACK |
5060 |<------------------| 5060
| INVITE SDP(2) |
5060 |-------------------->| 5060 ==> CT2
| 100 |
5060 |<--------------------| 5060
| 200(contact changes)|
5060 |<--------------------| 5060
| ACK |
5060 |-------------------->| 50601 ==> CT3
| |
|<--- RTP stream ---->|
| |
| BYE |
5060 |<--------------------| 50601
| 200 |
5060 |-------------------->| 50601
| INVITE SDP(3) |
5060 |<------------------| 5060 ==> CT1
CPE sends an INVITE request(1) to Server A, and creates a RTP&RTCP expect
pair for this Conntrack 1 (CT1). Server A responds 300 to redirect to
Server B. The RTP&RTCP expect pairs created on CT1 are removed upon 300
response.
CPE sends the INVITE request(2) to Server B, and creates an expect pair
for the new conntrack (due to destination address difference), let call
CT2. Server B changes the port to 50601 in 200 OK response, and the
following requests ACK and BYE from CPE are sent to 50601. The call is
established. There is RTP stream and no RTCP stream. So RTP expect is
removed and RTCP expect for CT2 retains.
As BYE request is sent from port 50601, it is another conntrack, let call
CT3, different from CT2 due to the port difference. So the BYE request will
not remove the RTCP expect for CT2.
Then another outgoing call is made, with the same RTP port being used (not
definitely but possibly). CPE firstly sends the INVITE request(3) to Server
A, and tries to create a RTP&RTCP expect pairs for this CT1. In current ALG
implementation, the RTCP expect for CT1 fails in creation because it
'conflicts' with the residual one for CT2. As a result the INVITE request
fails to send.
Signed-off-by: xiao ruizhu <katrina.xiaorz@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2019-07-03 21:31:13 -06:00
|
|
|
/* Allow to reuse expectations with the same tuples from different master
|
|
|
|
* conntracks.
|
|
|
|
*/
|
|
|
|
#define NF_CT_EXP_F_SKIP_MASTER 0x1
|
|
|
|
|
2013-01-21 15:10:25 -07:00
|
|
|
int nf_conntrack_expect_pernet_init(struct net *net);
|
|
|
|
void nf_conntrack_expect_pernet_fini(struct net *net);
|
|
|
|
|
|
|
|
int nf_conntrack_expect_init(void);
|
|
|
|
void nf_conntrack_expect_fini(void);
|
2006-11-28 18:34:58 -07:00
|
|
|
|
|
|
|
struct nf_conntrack_expect *
|
2015-08-08 13:40:01 -06:00
|
|
|
__nf_ct_expect_find(struct net *net,
|
|
|
|
const struct nf_conntrack_zone *zone,
|
2010-02-15 10:13:33 -07:00
|
|
|
const struct nf_conntrack_tuple *tuple);
|
2006-11-28 18:34:58 -07:00
|
|
|
|
|
|
|
struct nf_conntrack_expect *
|
2015-08-08 13:40:01 -06:00
|
|
|
nf_ct_expect_find_get(struct net *net,
|
|
|
|
const struct nf_conntrack_zone *zone,
|
2010-02-15 10:13:33 -07:00
|
|
|
const struct nf_conntrack_tuple *tuple);
|
2006-11-28 18:34:58 -07:00
|
|
|
|
|
|
|
struct nf_conntrack_expect *
|
2015-08-08 13:40:01 -06:00
|
|
|
nf_ct_find_expectation(struct net *net,
|
|
|
|
const struct nf_conntrack_zone *zone,
|
2010-02-15 10:13:33 -07:00
|
|
|
const struct nf_conntrack_tuple *tuple);
|
2006-11-28 18:34:58 -07:00
|
|
|
|
2010-10-19 02:19:06 -06:00
|
|
|
void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp,
|
2013-04-17 00:47:08 -06:00
|
|
|
u32 portid, int report);
|
2010-10-19 02:19:06 -06:00
|
|
|
static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
|
|
|
|
{
|
|
|
|
nf_ct_unlink_expect_report(exp, 0, 0);
|
|
|
|
}
|
|
|
|
|
2006-11-28 18:34:58 -07:00
|
|
|
void nf_ct_remove_expectations(struct nf_conn *ct);
|
2007-07-07 23:30:49 -06:00
|
|
|
void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
|
2017-03-26 20:31:26 -06:00
|
|
|
bool nf_ct_remove_expect(struct nf_conntrack_expect *exp);
|
2006-11-28 18:34:58 -07:00
|
|
|
|
2017-07-25 16:02:31 -06:00
|
|
|
void nf_ct_expect_iterate_destroy(bool (*iter)(struct nf_conntrack_expect *e, void *data), void *data);
|
|
|
|
void nf_ct_expect_iterate_net(struct net *net,
|
|
|
|
bool (*iter)(struct nf_conntrack_expect *e, void *data),
|
|
|
|
void *data, u32 portid, int report);
|
|
|
|
|
2006-11-28 18:34:58 -07:00
|
|
|
/* Allocate space for an expectation: this is mandatory before calling
|
2007-07-07 23:30:49 -06:00
|
|
|
nf_ct_expect_related. You will have to call put afterwards. */
|
|
|
|
struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
|
2008-10-08 03:35:00 -06:00
|
|
|
void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
|
2008-03-25 21:07:58 -06:00
|
|
|
const union nf_inet_addr *,
|
|
|
|
const union nf_inet_addr *,
|
|
|
|
u_int8_t, const __be16 *, const __be16 *);
|
2007-07-07 23:30:49 -06:00
|
|
|
void nf_ct_expect_put(struct nf_conntrack_expect *exp);
|
2008-11-18 03:56:20 -07:00
|
|
|
int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
|
netfilter: nf_conntrack_sip: fix expectation clash
When conntracks change during a dialog, SDP messages may be sent from
different conntracks to establish expects with identical tuples. In this
case expects conflict may be detected for the 2nd SDP message and end up
with a process failure.
The fixing here is to reuse an existing expect who has the same tuple for a
different conntrack if any.
Here are two scenarios for the case.
1)
SERVER CPE
| INVITE SDP |
5060 |<----------------------|5060
| 100 Trying |
5060 |---------------------->|5060
| 183 SDP |
5060 |---------------------->|5060 ===> Conntrack 1
| PRACK |
50601 |<----------------------|5060
| 200 OK (PRACK) |
50601 |---------------------->|5060
| 200 OK (INVITE) |
5060 |---------------------->|5060
| ACK |
50601 |<----------------------|5060
| |
|<--- RTP stream ------>|
| |
| INVITE SDP (t38) |
50601 |---------------------->|5060 ===> Conntrack 2
With a certain configuration in the CPE, SIP messages "183 with SDP" and
"re-INVITE with SDP t38" will go through the sip helper to create
expects for RTP and RTCP.
It is okay to create RTP and RTCP expects for "183", whose master
connection source port is 5060, and destination port is 5060.
In the "183" message, port in Contact header changes to 50601 (from the
original 5060). So the following requests e.g. PRACK and ACK are sent to
port 50601. It is a different conntrack (let call Conntrack 2) from the
original INVITE (let call Conntrack 1) due to the port difference.
In this example, after the call is established, there is RTP stream but no
RTCP stream for Conntrack 1, so the RTP expect created upon "183" is
cleared, and RTCP expect created for Conntrack 1 retains.
When "re-INVITE with SDP t38" arrives to create RTP&RTCP expects, current
ALG implementation will call nf_ct_expect_related() for RTP and RTCP. The
expects tuples are identical to those for Conntrack 1. RTP expect for
Conntrack 2 succeeds in creation as the one for Conntrack 1 has been
removed. RTCP expect for Conntrack 2 fails in creation because it has
idential tuples and 'conflict' with the one retained for Conntrack 1. And
then result in a failure in processing of the re-INVITE.
2)
SERVER A CPE
| REGISTER |
5060 |<------------------| 5060 ==> CT1
| 200 |
5060 |------------------>| 5060
| |
| INVITE SDP(1) |
5060 |<------------------| 5060
| 300(multi choice) |
5060 |------------------>| 5060 SERVER B
| ACK |
5060 |<------------------| 5060
| INVITE SDP(2) |
5060 |-------------------->| 5060 ==> CT2
| 100 |
5060 |<--------------------| 5060
| 200(contact changes)|
5060 |<--------------------| 5060
| ACK |
5060 |-------------------->| 50601 ==> CT3
| |
|<--- RTP stream ---->|
| |
| BYE |
5060 |<--------------------| 50601
| 200 |
5060 |-------------------->| 50601
| INVITE SDP(3) |
5060 |<------------------| 5060 ==> CT1
CPE sends an INVITE request(1) to Server A, and creates a RTP&RTCP expect
pair for this Conntrack 1 (CT1). Server A responds 300 to redirect to
Server B. The RTP&RTCP expect pairs created on CT1 are removed upon 300
response.
CPE sends the INVITE request(2) to Server B, and creates an expect pair
for the new conntrack (due to destination address difference), let call
CT2. Server B changes the port to 50601 in 200 OK response, and the
following requests ACK and BYE from CPE are sent to 50601. The call is
established. There is RTP stream and no RTCP stream. So RTP expect is
removed and RTCP expect for CT2 retains.
As BYE request is sent from port 50601, it is another conntrack, let call
CT3, different from CT2 due to the port difference. So the BYE request will
not remove the RTCP expect for CT2.
Then another outgoing call is made, with the same RTP port being used (not
definitely but possibly). CPE firstly sends the INVITE request(3) to Server
A, and tries to create a RTP&RTCP expect pairs for this CT1. In current ALG
implementation, the RTCP expect for CT1 fails in creation because it
'conflicts' with the residual one for CT2. As a result the INVITE request
fails to send.
Signed-off-by: xiao ruizhu <katrina.xiaorz@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2019-07-03 21:31:13 -06:00
|
|
|
u32 portid, int report, unsigned int flags);
|
|
|
|
static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect,
|
|
|
|
unsigned int flags)
|
2009-04-06 09:47:20 -06:00
|
|
|
{
|
netfilter: nf_conntrack_sip: fix expectation clash
When conntracks change during a dialog, SDP messages may be sent from
different conntracks to establish expects with identical tuples. In this
case expects conflict may be detected for the 2nd SDP message and end up
with a process failure.
The fixing here is to reuse an existing expect who has the same tuple for a
different conntrack if any.
Here are two scenarios for the case.
1)
SERVER CPE
| INVITE SDP |
5060 |<----------------------|5060
| 100 Trying |
5060 |---------------------->|5060
| 183 SDP |
5060 |---------------------->|5060 ===> Conntrack 1
| PRACK |
50601 |<----------------------|5060
| 200 OK (PRACK) |
50601 |---------------------->|5060
| 200 OK (INVITE) |
5060 |---------------------->|5060
| ACK |
50601 |<----------------------|5060
| |
|<--- RTP stream ------>|
| |
| INVITE SDP (t38) |
50601 |---------------------->|5060 ===> Conntrack 2
With a certain configuration in the CPE, SIP messages "183 with SDP" and
"re-INVITE with SDP t38" will go through the sip helper to create
expects for RTP and RTCP.
It is okay to create RTP and RTCP expects for "183", whose master
connection source port is 5060, and destination port is 5060.
In the "183" message, port in Contact header changes to 50601 (from the
original 5060). So the following requests e.g. PRACK and ACK are sent to
port 50601. It is a different conntrack (let call Conntrack 2) from the
original INVITE (let call Conntrack 1) due to the port difference.
In this example, after the call is established, there is RTP stream but no
RTCP stream for Conntrack 1, so the RTP expect created upon "183" is
cleared, and RTCP expect created for Conntrack 1 retains.
When "re-INVITE with SDP t38" arrives to create RTP&RTCP expects, current
ALG implementation will call nf_ct_expect_related() for RTP and RTCP. The
expects tuples are identical to those for Conntrack 1. RTP expect for
Conntrack 2 succeeds in creation as the one for Conntrack 1 has been
removed. RTCP expect for Conntrack 2 fails in creation because it has
idential tuples and 'conflict' with the one retained for Conntrack 1. And
then result in a failure in processing of the re-INVITE.
2)
SERVER A CPE
| REGISTER |
5060 |<------------------| 5060 ==> CT1
| 200 |
5060 |------------------>| 5060
| |
| INVITE SDP(1) |
5060 |<------------------| 5060
| 300(multi choice) |
5060 |------------------>| 5060 SERVER B
| ACK |
5060 |<------------------| 5060
| INVITE SDP(2) |
5060 |-------------------->| 5060 ==> CT2
| 100 |
5060 |<--------------------| 5060
| 200(contact changes)|
5060 |<--------------------| 5060
| ACK |
5060 |-------------------->| 50601 ==> CT3
| |
|<--- RTP stream ---->|
| |
| BYE |
5060 |<--------------------| 50601
| 200 |
5060 |-------------------->| 50601
| INVITE SDP(3) |
5060 |<------------------| 5060 ==> CT1
CPE sends an INVITE request(1) to Server A, and creates a RTP&RTCP expect
pair for this Conntrack 1 (CT1). Server A responds 300 to redirect to
Server B. The RTP&RTCP expect pairs created on CT1 are removed upon 300
response.
CPE sends the INVITE request(2) to Server B, and creates an expect pair
for the new conntrack (due to destination address difference), let call
CT2. Server B changes the port to 50601 in 200 OK response, and the
following requests ACK and BYE from CPE are sent to 50601. The call is
established. There is RTP stream and no RTCP stream. So RTP expect is
removed and RTCP expect for CT2 retains.
As BYE request is sent from port 50601, it is another conntrack, let call
CT3, different from CT2 due to the port difference. So the BYE request will
not remove the RTCP expect for CT2.
Then another outgoing call is made, with the same RTP port being used (not
definitely but possibly). CPE firstly sends the INVITE request(3) to Server
A, and tries to create a RTP&RTCP expect pairs for this CT1. In current ALG
implementation, the RTCP expect for CT1 fails in creation because it
'conflicts' with the residual one for CT2. As a result the INVITE request
fails to send.
Signed-off-by: xiao ruizhu <katrina.xiaorz@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2019-07-03 21:31:13 -06:00
|
|
|
return nf_ct_expect_related_report(expect, 0, 0, flags);
|
2009-04-06 09:47:20 -06:00
|
|
|
}
|
2006-11-28 18:34:58 -07:00
|
|
|
|
|
|
|
#endif /*_NF_CONNTRACK_EXPECT_H*/
|
|
|
|
|