From ea45f12a2766dae54e5426a23e8f4bafdbe2782e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:18:57 -0700 Subject: [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 Signed-off-by: David S. Miller --- net/ipv4/netfilter/nf_nat_sip.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'net/ipv4/netfilter/nf_nat_sip.c') 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); -- cgit v1.2.3