aboutsummaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-03-25 20:18:57 -0700
committerDavid S. Miller <davem@davemloft.net>2008-03-25 20:18:57 -0700
commitea45f12a2766dae54e5426a23e8f4bafdbe2782e (patch)
treeeb3096bee1e0053c545424f9cea5d0c91b114fe4 /net/ipv4
parentac3677406d4e36e86b1eb5a453997a3b3e0c089a (diff)
[NETFILTER]: nf_conntrack_sip: parse SIP headers properly
Introduce new function for SIP header parsing that properly deals with continuation lines and whitespace in headers and use it. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index 60151b5901a..c13e4386236 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -108,14 +108,14 @@ static int map_addr(struct sk_buff *skb,
static int map_sip_addr(struct sk_buff *skb,
const char **dptr, unsigned int *datalen,
- enum sip_header_pos pos, struct addr_map *map)
+ enum sip_header_types type, struct addr_map *map)
{
enum ip_conntrack_info ctinfo;
struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
unsigned int matchlen, matchoff;
- if (ct_sip_get_info(ct, *dptr, *datalen, &matchoff, &matchlen,
- pos) <= 0)
+ if (ct_sip_get_header(ct, *dptr, 0, *datalen, type,
+ &matchoff, &matchlen) <= 0)
return 1;
return map_addr(skb, dptr, datalen, matchoff, matchlen, map);
}
@@ -141,10 +141,10 @@ static unsigned int ip_nat_sip(struct sk_buff *skb,
return NF_DROP;
}
- if (!map_sip_addr(skb, dptr, datalen, POS_FROM, &map) ||
- !map_sip_addr(skb, dptr, datalen, POS_TO, &map) ||
- !map_sip_addr(skb, dptr, datalen, POS_VIA, &map) ||
- !map_sip_addr(skb, dptr, datalen, POS_CONTACT, &map))
+ if (!map_sip_addr(skb, dptr, datalen, SIP_HDR_FROM, &map) ||
+ !map_sip_addr(skb, dptr, datalen, SIP_HDR_TO, &map) ||
+ !map_sip_addr(skb, dptr, datalen, SIP_HDR_VIA, &map) ||
+ !map_sip_addr(skb, dptr, datalen, SIP_HDR_CONTACT, &map))
return NF_DROP;
return NF_ACCEPT;
}
@@ -166,8 +166,8 @@ static int mangle_content_len(struct sk_buff *skb,
c_len = *datalen - matchoff + strlen("v=");
/* Now, update SDP length */
- if (ct_sip_get_info(ct, *dptr, *datalen, &matchoff, &matchlen,
- POS_CONTENT) <= 0)
+ if (ct_sip_get_header(ct, *dptr, 0, *datalen, SIP_HDR_CONTENT_LENGTH,
+ &matchoff, &matchlen) <= 0)
return 0;
buflen = sprintf(buffer, "%u", c_len);