Skip to content

Commit 1bcabc8

Browse files
marangarummakynes
authored andcommitted
netfilter: nf_ct_sip: allow tab character in SIP headers
Current parsing methods for SIP headers do not allow the presence of tab characters between header name and header value. As a result Call-ID SIP headers like the following are discarded by IPVS SIP persistence engine: "Call-ID\t: mycallid@abcde" "Call-ID:\tmycallid@abcde" In above examples Call-IDs are represented as strings in C language. Obviously in real message we have byte "09" before/after colon (":"). Proposed fix is in nf_conntrack_sip module. Function sip_skip_whitespace() should skip tabs in addition to spaces, since in SIP grammar whitespace (WSP) corresponds to space or tab. 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 <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 22609b4 commit 1bcabc8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nf_conntrack_sip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static const char *sip_follow_continuation(const char *dptr, const char *limit)
330330
static const char *sip_skip_whitespace(const char *dptr, const char *limit)
331331
{
332332
for (; dptr < limit; dptr++) {
333-
if (*dptr == ' ')
333+
if (*dptr == ' ' || *dptr == '\t')
334334
continue;
335335
if (*dptr != '\r' && *dptr != '\n')
336336
break;

0 commit comments

Comments
 (0)