Skip to contentSkip to conversation

NETFILTER: fix ctnetlink endian problem

PATCH Applied Harald Welte 2 participants 2 messages Oct 9, 2005 – Oct 10, 2005

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

PATCH 5/5 NETFILTER: fix ctnetlink endian problem

Hi Dave,

please apply this fix to you 2.6.14 tree.

[NETFILTER] conntrack_netlink: Fix endian issue with status from userspace

When we send "status" from userspace, we forget to convert the endianness. This patch adds the reqired conversion. Thanks to Pablo Neira for discovering this.

---
commit b5564cb94ad4e209fdf12c60485cec467104105c
tree e65164509692d9caa87bf248c10f6d730141bd18
parent 5382af42cb3fed0aa6658b8de20a966f8498ac28
author Harald Welte <[email protected]> Sun, 09 Oct 2005 23:30:59 +0200 committer Harald Welte <[email protected]> Sun, 09 Oct 2005 23:30:59 +0200

 net/ipv4/netfilter/ip_conntrack_netlink.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
net/ipv4/netfilter/ip_conntrack_netlink.c +2 -1
@@ -833,7 +833,8 @@ out:
 static inline int
 ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[])
 {
-	unsigned long d, status = *(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1]);
+	unsigned long d;
+	unsigned status = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_STATUS-1]));
 	d = ct->status ^ status;
 
 	if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING))
Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
maintainer Applied
#1 lore raw

From: Harald Welte <[email protected]>
Date: Mon, 10 Oct 2005 00:16:48 +0200

Quoted 7 lines

[NETFILTER] conntrack_netlink: Fix endian issue with status from userspace

When we send "status" from userspace, we forget to convert the endianness. This patch adds the reqired conversion. Thanks to Pablo Neira for discovering this.

Applied, thanks.