Skip to contentSkip to conversation

: Fix SNAT/DNAT target size checks

PATCH In review Patrick McHardy 1 participant 1 message Jan 25, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 : Fix SNAT/DNAT target size checks

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/01/25 03:56:48+01:00 [email protected]
# [NETFILTER]: Fix SNAT/DNAT target size checks
#

#   This patch fixes two size checks in the checkentry() for SNAT and DNAT
#   targets. The patch to remove support for multiple ranges forgot to use
#   IPT_ALIGN(). This isn't a problem on x86 but other archs like parisc
#   are affected and thus can't add any SNAT/DNAT rules.

#
# Signed-off-by: Martin Josefsson <[email protected]>
# Signed-off-by: Patrick McHardy <[email protected]>
#

# net/ipv4/netfilter/ip_nat_rule.c
#   2005/01/25 03:56:39+01:00 [email protected] +2 -2
#   [NETFILTER]: Fix SNAT/DNAT target size checks
#   
#   This patch fixes two size checks in the checkentry() for SNAT and DNAT
#   targets. The patch to remove support for multiple ranges forgot to use
#   IPT_ALIGN(). This isn't a problem on x86 but other archs like parisc
#   are affected and thus can't add any SNAT/DNAT rules.
#   
#   Signed-off-by: Martin Josefsson <[email protected]>
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
diff -Nru a/net/ipv4/netfilter/ip_nat_rule.c b/net/ipv4/netfilter/ip_nat_rule.c
--- a/net/ipv4/netfilter/ip_nat_rule.c	2005-01-25 04:37:00 +01:00
+++ b/net/ipv4/netfilter/ip_nat_rule.c	2005-01-25 04:37:00 +01:00
@@ -181,7 +181,7 @@
 		return 0;
 	}

- if (targinfosize != sizeof(struct ip_nat_multi_range_compat)) {
+ if (targinfosize != IPT_ALIGN(sizeof(struct ip_nat_multi_range_compat))) {
DEBUGP("SNAT: Target size %u wrong for %u ranges\n",
targinfosize, mr->rangesize);
return 0;
@@ -214,7 +214,7 @@
return 0;
}

- if (targinfosize != sizeof(struct ip_nat_multi_range_compat)) {
+ if (targinfosize != IPT_ALIGN(sizeof(struct ip_nat_multi_range_compat))) {
DEBUGP("DNAT: Target size %u wrong for %u ranges\n",
targinfosize, mr->rangesize);
return 0;