Skip to content

Commit 77a78de

Browse files
kaberDavid S. Miller
authored andcommitted
[NETFILTER]: sip conntrack: make header shortcuts optional
Not every header has a shortcut, so make them optional instead of searching for the same string twice. Signed-off-by: Patrick McHardy <kaber@trash.net>
1 parent 40883e8 commit 77a78de

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

net/ipv4/netfilter/ip_conntrack_sip.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ static struct sip_header_nfo ct_sip_hdrs[] = {
7272
[POS_REQ_HEADER] = { /* SIP Requests headers */
7373
.lname = "sip:",
7474
.lnlen = sizeof("sip:") - 1,
75-
.sname = "sip:",
76-
.snlen = sizeof("sip:") - 1, /* yes, i know.. ;) */
7775
.ln_str = "@",
7876
.ln_strlen = sizeof("@") - 1,
7977
.match_len = epaddr_len
@@ -286,7 +284,8 @@ int ct_sip_get_info(const char *dptr, size_t dlen,
286284

287285
while (dptr <= limit) {
288286
if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) &&
289-
(strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
287+
(hinfo->sname == NULL ||
288+
strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
290289
dptr++;
291290
continue;
292291
}

0 commit comments

Comments
 (0)