: Netfilter 2.6.24 -stable fixes
Subsystems (2)
cover : Netfilter 2.6.24 -stable fixes
These patches fix a problem in the time match, causing it to never match on Sunday, and undersized skb allocation in nfnetlink_log and nfnetlink_queue, causing lost messages.
Please apply, thanks.
net/netfilter/nfnetlink_log.c | 2 +- net/netfilter/nfnetlink_queue.c | 2 +- net/netfilter/xt_time.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-)
Eric Leblond (2):
[NETFILTER]: nfnetlink_queue: fix computation of allocated size for netlink skb [NETFILTER]: nfnetlink_log: fix computation of netlink skb size
Jan Engelhardt (1):
[NETFILTER]: xt_time: fix failure to match on Sundays
PATCH 1/3 : xt_time: fix failure to match on Sundays
[NETFILTER]: xt_time: fix failure to match on Sundays
Upstream commit 4f4c9430:
From: Andrew Schulman <[email protected]>
xt_time_match() in net/netfilter/xt_time.c in kernel 2.6.24 never matches on Sundays. On my host I have a rule like
iptables -A OUTPUT -m time --weekdays Sun -j REJECT
and it never matches. The problem is in localtime_2(), which uses
r->weekday = (4 + r->dse) % 7;
to map the epoch day onto a weekday in {0,...,6}. In particular this gives 0 for Sundays. But 0 has to be wrong; a weekday of 0 can never match. xt_time_match() has
if (!(info->weekdays_match & (1 << current_time.weekday)))
return false;and when current_time.weekday = 0, the result of the & is always zero, even when info->weekdays_match = XT_TIME_ALL_WEEKDAYS = 0xFE.
---
commit 2cfc500a853497da88ca6b097873bcb0de65e764
tree 65082cc5f1544db80e472f779e7a57c92663c09c
parent 927684b414dae48568ab82939ea2f55a10188e94
author Jan Engelhardt <[email protected]> Mon, 17 Mar 2008 15:30:12 +0100 committer Patrick McHardy <[email protected]> Mon, 17 Mar 2008 15:30:12 +0100
net/netfilter/xt_time.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
net/netfilter/xt_time.c +5 -2
@@ -95,8 +95,11 @@ static inline void localtime_2(struct xtm *r, time_t time)*/ r->dse = time /86400 ; -/* 1970-01-01 (w=0) was a Thursday (4). */ - r->weekday = (4 + r->dse) %7 ; +/* +* 1970-01-01 (w=0) was a Thursday (4). +* -1 and +1 map Sunday properly onto 7. +*/ + r->weekday = (4 + r->dse -1 ) %7 +1 ; }static void localtime_3 (struct xtm *r,time_t time)
PATCH 2/3 : nfnetlink_queue: fix computation of allocated size for netlink skb
In reply to Patrick McHardy[NETFILTER]: nfnetlink_queue: fix computation of allocated size for netlink skb
Upstream commit cabaa9bf:
Size of the netlink skb was wrongly computed because the formula was using NLMSG_ALIGN instead of NLMSG_SPACE. NLMSG_ALIGN does not add the room for netlink header as NLMSG_SPACE does. This was causing a failure of message building in some cases.
On my test system, all messages for packets in range [8*k+41, 8*k+48] where k is an integer were invalid and the corresponding packets were dropped.
---
commit 26a01f41cb49b1d5d75832d50ac7ab6def468e37
tree b1be993bc991a756a02da285e4cb9fff9c024ec2
parent 2cfc500a853497da88ca6b097873bcb0de65e764
author Eric Leblond <[email protected]> Mon, 17 Mar 2008 15:30:13 +0100 committer Patrick McHardy <[email protected]> Mon, 17 Mar 2008 15:30:13 +0100
net/netfilter/nfnetlink_queue.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/nfnetlink_queue.c +1 -1
@@ -353,7 +353,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,QDEBUG ("entered\n" ); - size =NLMSG_ALIGN (sizeof (struct nfgenmsg )) + size =NLMSG_SPACE (sizeof (struct nfgenmsg )) +nla_total_size (sizeof (struct nfqnl_msg_packet_hdr )) +nla_total_size (sizeof (u_int32_t))/* ifindex */ +nla_total_size (sizeof (u_int32_t))/* ifindex */
PATCH 3/3 : nfnetlink_log: fix computation of netlink skb size
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: fix computation of netlink skb size
Upstream commit 7000d38d:
This patch is similar to nfnetlink_queue fixes. It fixes the computation of skb size by using NLMSG_SPACE instead of NLMSG_ALIGN.
---
commit fb462f0e14c1aeb8ca109f0681dd626f373999ef
tree f4094c018fc31b7732bbba172ba8d4bf846a0c2e
parent 26a01f41cb49b1d5d75832d50ac7ab6def468e37
author Eric Leblond <[email protected]> Mon, 17 Mar 2008 15:30:14 +0100 committer Patrick McHardy <[email protected]> Mon, 17 Mar 2008 15:30:14 +0100
net/netfilter/nfnetlink_log.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/nfnetlink_log.c +1 -1
@@ -594,7 +594,7 @@ nfulnl_log_packet(unsigned int pf,/* FIXME: do we want to make the size calculation conditional based on * what is actually present? way more branches and checks, but more * memory efficient... */ - size =NLMSG_ALIGN (sizeof (struct nfgenmsg )) + size =NLMSG_SPACE (sizeof (struct nfgenmsg )) +nla_total_size (sizeof (struct nfulnl_msg_packet_hdr )) +nla_total_size (sizeof (u_int32_t))/* ifindex */ +nla_total_size (sizeof (u_int32_t))/* ifindex */
Chris Wright
AppliedQuoted 5 lines · * Patrick McHardy ([email protected]) wrote:
These patches fix a problem in the time match, causing it to never match on Sunday, and undersized skb allocation in
nfnetlink_logandnfnetlink_queue, causing lost messages.Please apply, thanks.
Applied, I updated the From: for each patch, please correct me if it's wrong.
thanks,
-chris