Skip to contentSkip to conversation

: Netfilter fixes

PATCH In review Patrick McHardy 3 participants 7 messages Aug 14, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover : Netfilter fixes

Hi Dave,

these patches fix an extraneous ";" in the new u32 match and three minor bugs in the SIP conntrack helper. Please apply, thanks.

 net/ipv4/netfilter/nf_nat_sip.c  |    2 +-
 net/netfilter/nf_conntrack_sip.c |    8 ++++++--
 net/netfilter/xt_u32.c           |    2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

Eric Dumazet (1):
[NETFILTER]: netfilter: xt_u32 bug correction

Patrick McHardy (3):
[NETFILTER]: nf_conntrack_sip: check sname != NULL before calling strncmp [NETFILTER]: nf_conntrack_sip: fix SIP-URI parsing [NETFILTER]: nf_nat_sip: don't drop short packets

#1 lore raw

PATCH 1/4 : netfilter: xt_u32 bug correction

[NETFILTER]: netfilter: xt_u32 bug correction

An extraneous ";" makes xt_u32 match useless

---
commit 4cbeda3b69e71c535ea820f5a94f4232598e3eea
tree e104d542dfa81fbec1656bce46a32bd0d3cdf10c
parent 39d3520c92cf7a28c07229ca00cc35a1e8026c77
author Eric Dumazet <[email protected]> Tue, 14 Aug 2007 18:35:02 +0200 committer Patrick McHardy <[email protected]> Tue, 14 Aug 2007 18:35:02 +0200

 net/netfilter/xt_u32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/xt_u32.c +1 -1
index 74f9b14..bec4279 100644
@@ -36,7 +36,7 @@ static bool u32_match_it(const struct xt_u32 *data,
 		at  = 0;
 		pos = ct->location[0].number;
 
-		if (skb->len < 4 || pos > skb->len - 4);
+		if (skb->len < 4 || pos > skb->len - 4)
 			return false;
 
 		ret   = skb_copy_bits(skb, pos, &n, sizeof(n));
#3 lore raw

PATCH 2/4 : nf_conntrack_sip: check sname != NULL before calling strncmp

In reply to Patrick McHardy

[NETFILTER]: nf_conntrack_sip: check sname != NULL before calling strncmp

The check got lost during the conversion to nf_conntrack.

---
commit c58af8c25d20e59644356f78e055eeba9edb8aae
tree c7c95d0ba93d86f6ec33dc2ae12e532dc1ce77ab
parent 4cbeda3b69e71c535ea820f5a94f4232598e3eea
author Patrick McHardy <[email protected]> Tue, 14 Aug 2007 18:37:01 +0200 committer Patrick McHardy <[email protected]> Tue, 14 Aug 2007 18:37:01 +0200

 net/netfilter/nf_conntrack_sip.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
net/netfilter/nf_conntrack_sip.c +2 -1
index 1276a44..5cc9636 100644
@@ -330,7 +330,8 @@ int ct_sip_get_info(struct nf_conn *ct,
 
 	while (dptr <= limit) {
 		if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) &&
-		    (strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
+		    (hnfo->sname == NULL ||
+		     strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
 			dptr++;
 			continue;
 		}
#4 lore raw

PATCH 3/4 : nf_conntrack_sip: fix SIP-URI parsing

In reply to Patrick McHardy

[NETFILTER]: nf_conntrack_sip: fix SIP-URI parsing

The userinfo component of a SIP-URI is optional, continue parsing at the beginning of the SIP-URI in case its not found.

---
commit 492d0e43049e7f420c1c64044ab57abf278fbead
tree d5b5da1b2109b78f28fa8748bcb33e573be85e5a
parent c58af8c25d20e59644356f78e055eeba9edb8aae
author Patrick McHardy <[email protected]> Tue, 14 Aug 2007 18:37:25 +0200 committer Patrick McHardy <[email protected]> Tue, 14 Aug 2007 18:37:25 +0200

 net/netfilter/nf_conntrack_sip.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
net/netfilter/nf_conntrack_sip.c +4 -1
index 5cc9636..d449fa4 100644
@@ -295,6 +295,7 @@ static int epaddr_len(struct nf_conn *ct, const char *dptr,
 static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
 			  const char *limit, int *shift)
 {
+	const char *start = dptr;
 	int s = *shift;
 
 	/* Search for @, but stop at the end of the line.
@@ -309,8 +310,10 @@ static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
 	if (dptr <= limit && *dptr == '@') {
 		dptr++;
 		(*shift)++;
-	} else
+	} else {
+		dptr = start;
 		*shift = s;
+	}
 
 	return epaddr_len(ct, dptr, limit, shift);
 }
#5 lore raw

PATCH 4/4 : nf_nat_sip: don't drop short packets

In reply to Patrick McHardy

[NETFILTER]: nf_nat_sip: don't drop short packets

Don't drop packets shorter than "SIP/2.0", just ignore them. Keep-alives can validly be shorter for example.

---
commit 12ad6c49be7b0cb1e9f32750e34cde5d29d40a48
tree 6dc3ff60e52adc58a3a02d725f819cc6811b1664
parent 492d0e43049e7f420c1c64044ab57abf278fbead
author Patrick McHardy <[email protected]> Tue, 14 Aug 2007 18:37:58 +0200 committer Patrick McHardy <[email protected]> Tue, 14 Aug 2007 18:37:58 +0200

 net/ipv4/netfilter/nf_nat_sip.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv4/netfilter/nf_nat_sip.c +1 -1
index a889ec3..e14d419 100644
@@ -104,7 +104,7 @@ static unsigned int ip_nat_sip(struct sk_buff **pskb,
 	dataoff = ip_hdrlen(*pskb) + sizeof(struct udphdr);
 	datalen = (*pskb)->len - dataoff;
 	if (datalen < sizeof("SIP/2.0") - 1)
-		return NF_DROP;
+		return NF_ACCEPT;
 
 	addr_map_init(ct, &map);
 
maintainer
#6 lore raw
In reply to Patrick McHardy

From: Patrick McHardy <[email protected]>
Date: Tue, 14 Aug 2007 18:40:12 +0200 (MEST)

Quoted 4 lines

Hi Dave,

these patches fix an extraneous ";" in the new u32 match and three minor bugs in the SIP conntrack helper. Please apply, thanks.

All applied, thanks Patrick.