Skip to contentSkip to conversation

netfilter 00/02: netfilter fixes

DISCUSSION Patrick McHardy 2 participants 4 messages Feb 2, 2010

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

Hi Dave,

the following two patches fix two bugs in netfilter:

- an off-by-one in SIP conntrack short header parsing, causing mismatches with UAs not inserting a space after the colon

- a missing initialization in ctnetlink when dumping an expectation mask, causing an invalid layer 4 protocol number to be used

Please apply or pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Thanks!

 net/netfilter/nf_conntrack_netlink.c |    3 ++-
 net/netfilter/nf_conntrack_sip.c     |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Patrick McHardy (2):
netfilter: nf_conntrack_sip: fix off-by-one in compact header parsing
netfilter: ctnetlink: fix expectation mask dump

#1 lore raw

netfilter 01/02: nf_conntrack_sip: fix off-by-one in compact header parsing

commit 135d01899b1fba17045961febff7e5141db6048f

Author: Patrick McHardy <[email protected]>
Date:   Tue Jan 19 19:06:59 2010 +0100

netfilter: nf_conntrack_sip: fix off-by-one in compact header parsing

In a string like "v:SIP/2.0..." it was checking for !isalpha('S') when it meant to be inspecting the ':'.

Patch by Greg Alexander <[email protected]>

net/netfilter/nf_conntrack_sip.c +1 -1
index 4b57216..023966b 100644
@@ -376,7 +376,7 @@ int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
 			dptr += hdr->len;
 		else if (hdr->cname && limit - dptr >= hdr->clen + 1 &&
 			 strnicmp(dptr, hdr->cname, hdr->clen) == 0 &&
-			 !isalpha(*(dptr + hdr->clen + 1)))
+			 !isalpha(*(dptr + hdr->clen)))
 			dptr += hdr->clen;
 		else
 			continue;
#2 lore raw

netfilter 02/02: ctnetlink: fix expectation mask dump

In reply to Patrick McHardy

commit e578756c35859a459d78d8416195bc5f5ff897d0

Author: Patrick McHardy <[email protected]>
Date:   Tue Jan 26 17:04:02 2010 +0100

netfilter: ctnetlink: fix expectation mask dump

The protocol number is not initialized, so userspace can't interpret the layer 4 data properly.

net/netfilter/nf_conntrack_netlink.c +2 -1
index 59d8064..42f21c0 100644
@@ -1437,8 +1437,9 @@ ctnetlink_exp_dump_mask(struct sk_buff *skb,
 	struct nlattr *nest_parms;
 
 	memset(&m, 0xFF, sizeof(m));
-	m.src.u.all = mask->src.u.all;
 	memcpy(&m.src.u3, &mask->src.u3, sizeof(m.src.u3));
+	m.src.u.all = mask->src.u.all;
+	m.dst.protonum = tuple->dst.protonum;
 
 	nest_parms = nla_nest_start(skb, CTA_EXPECT_MASK | NLA_F_NESTED);
 	if (!nest_parms)
maintainer
#3 lore raw
In reply to Patrick McHardy

From: Patrick McHardy <[email protected]>
Date: Tue, 2 Feb 2010 17:27:37 +0100 (MET)

Quoted 11 lines

the following two patches fix two bugs in netfilter:

- an off-by-one in SIP conntrack short header parsing, causing mismatches with UAs not inserting a space after the colon

- a missing initialization in ctnetlink when dumping an expectation mask, causing an invalid layer 4 protocol number to be used

Please apply or pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git master

Pulled, thanks Patrick.