* [PATCH 2/2] netfilter: correct allowed characters in Call-ID SIP header
@ 2016-08-30 16:48 Marco Angaroni
2016-09-07 8:31 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Marco Angaroni @ 2016-08-30 16:48 UTC (permalink / raw)
To: lvs-devel, netfilter-devel
Current parsing methods for SIP header Call-ID do not check correctly all
characters allowed by RFC 3261. In particular "," character is allowed
instead of "'" character. As a result Call-ID headers like the following
are discarded by IPVS SIP persistence engine.
Call-ID: -.!%*_+`'~()<>:\"/[]?{}
Above example is composed using all non-alphanumeric characters listed
in RFC 3261 for Call-ID header syntax.
Proposed fix is in nf_conntrack_sip module; function iswordc() checks this
range: (c >= '(' && c <= '/') which includes these characters: ()*+,-./
They are all allowed except ",". Instead "'" is not included in the list.
Below is an extract of relevant SIP ABNF syntax.
Call-ID = ( "Call-ID" / "i" ) HCOLON callid
callid = word [ "@" word ]
HCOLON = *( SP / HTAB ) ":" SWS
SWS = [LWS] ; sep whitespace
LWS = [*WSP CRLF] 1*WSP ; linear whitespace
WSP = SP / HTAB
word = 1*(alphanum / "-" / "." / "!" / "%" / "*" /
"_" / "+" / "`" / "'" / "~" /
"(" / ")" / "<" / ">" /
":" / "\" / DQUOTE /
"/" / "[" / "]" / "?" /
"{" / "}" )
Signed-off-by: Marco Angaroni <marcoangaroni@gmail.com>
---
net/netfilter/nf_conntrack_sip.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 4acd60e..8971109 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -83,9 +83,10 @@ static int digits_len(const struct nf_conn *ct, const char *dptr,
static int iswordc(const char c)
{
if (isalnum(c) || c == '!' || c == '"' || c == '%' ||
- (c >= '(' && c <= '/') || c == ':' || c == '<' || c == '>' ||
+ (c >= '(' && c <= '+') || c == ':' || c == '<' || c == '>' ||
c == '?' || (c >= '[' && c <= ']') || c == '_' || c == '`' ||
- c == '{' || c == '}' || c == '~')
+ c == '{' || c == '}' || c == '~' || (c >= '-' && c <= '/') ||
+ c == '\'')
return 1;
return 0;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] netfilter: correct allowed characters in Call-ID SIP header
2016-08-30 16:48 [PATCH 2/2] netfilter: correct allowed characters in Call-ID SIP header Marco Angaroni
@ 2016-09-07 8:31 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-09-07 8:31 UTC (permalink / raw)
To: Marco Angaroni; +Cc: lvs-devel, netfilter-devel
On Tue, Aug 30, 2016 at 06:48:24PM +0200, Marco Angaroni wrote:
> Current parsing methods for SIP header Call-ID do not check correctly all
> characters allowed by RFC 3261. In particular "," character is allowed
> instead of "'" character. As a result Call-ID headers like the following
> are discarded by IPVS SIP persistence engine.
>
> Call-ID: -.!%*_+`'~()<>:\"/[]?{}
>
> Above example is composed using all non-alphanumeric characters listed
> in RFC 3261 for Call-ID header syntax.
>
> Proposed fix is in nf_conntrack_sip module; function iswordc() checks this
> range: (c >= '(' && c <= '/') which includes these characters: ()*+,-./
> They are all allowed except ",". Instead "'" is not included in the list.
>
> Below is an extract of relevant SIP ABNF syntax.
>
> Call-ID = ( "Call-ID" / "i" ) HCOLON callid
> callid = word [ "@" word ]
>
> HCOLON = *( SP / HTAB ) ":" SWS
> SWS = [LWS] ; sep whitespace
> LWS = [*WSP CRLF] 1*WSP ; linear whitespace
> WSP = SP / HTAB
> word = 1*(alphanum / "-" / "." / "!" / "%" / "*" /
> "_" / "+" / "`" / "'" / "~" /
> "(" / ")" / "<" / ">" /
> ":" / "\" / DQUOTE /
> "/" / "[" / "]" / "?" /
> "{" / "}" )
Also applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-07 8:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-30 16:48 [PATCH 2/2] netfilter: correct allowed characters in Call-ID SIP header Marco Angaroni
2016-09-07 8:31 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).