[NETFILTER]: sip conntrack: make header shortcuts optional
authorPatrick McHardy <kaber@trash.net>
Wed, 29 Nov 2006 01:35:28 +0000 (02:35 +0100)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:31:25 +0000 (21:31 -0800)
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>
net/ipv4/netfilter/ip_conntrack_sip.c

index a9c0d1d3e56f0fd745ed6d170d664f31047634bb..0a6a13c45b07ddf0ed790dfbaae0c1eb23f9625a 100644 (file)
@@ -72,8 +72,6 @@ static struct sip_header_nfo ct_sip_hdrs[] = {
        [POS_REQ_HEADER] = {    /* SIP Requests headers */
                .lname          = "sip:",
                .lnlen          = sizeof("sip:") - 1,
-               .sname          = "sip:",
-               .snlen          = sizeof("sip:") - 1, /* yes, i know.. ;) */
                .ln_str         = "@",
                .ln_strlen      = sizeof("@") - 1,
                .match_len      = epaddr_len
@@ -286,7 +284,8 @@ int ct_sip_get_info(const char *dptr, size_t dlen,
 
        while (dptr <= limit) {
                if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) &&
-                   (strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
+                   (hinfo->sname == NULL ||
+                    strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
                        dptr++;
                        continue;
                }