Skip to contentSkip to conversation

netfilter: fix UDP incremental checksumming

PATCH New Harald Welte 3 participants 3 messages Oct 2, 2003 – Oct 13, 2003

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

PATCH 1/1 netfilter: fix UDP incremental checksumming

Hi Davem!

Please apply the following patchto your 2.4 tree and push it to Marcelo. Thanks.

Author: Patrick McHardy <[email protected]>

Add size check to ip_nat_mangle_udp_packet

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.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

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1134 -> 1.1135
# net/ipv4/netfilter/ip_nat_helper.c 1.10 -> 1.11
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/28 [email protected] 1.1135
# [NETFILTER]: Add size check to ip_nat_mangle_udp_packet
# --------------------------------------------
#

net/ipv4/netfilter/ip_nat_helper.c +7 -0
diff -Nru a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c
@@ -233,6 +233,13 @@
 	newudplen = udplen - match_len + rep_len;
 	newlen = iph->ihl*4 + newudplen;
 
+	/* UDP helpers might accidentally mangle the wrong packet */
+	if (udplen < sizeof(*udph) + match_offset + match_len) {
+		if (net_ratelimit())
+			printk("ip_nat_mangle_udp_packet: undersized packet\n");
+		return 0;
+	}
+
 	if (newlen > 65535) {
 		if (net_ratelimit())
 			printk("ip_nat_mangle_udp_packet: nat'ed packet "
#1 lore raw

PATCH RESEND 1/1 netfilter: add size check for udp packet mangling

Quoted 9 lines · Harald Welte

Hi Davem!

Please apply the following patchto your 2.4 tree and push it to Marcelo. Thanks.

Author: Patrick McHardy <[email protected]>

Add size check to ip_nat_mangle_udp_packet

Hi Dave

Harald sent this with the wrong subject and it got dropped. Here it is with the correct subject.
Found when syncing patch-o-matic with 2.4-bk Please apply. More resends are coming.

Author: Patrick McHardy <[email protected]>

Add size check to ip_nat_mangle_udp_packet

Signature · 1 line
/Martin

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.1134 -> 1.1135
# net/ipv4/netfilter/ip_nat_helper.c 1.10 -> 1.11
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/28 [email protected] 1.1135
# [NETFILTER]: Add size check to ip_nat_mangle_udp_packet
# --------------------------------------------
#

net/ipv4/netfilter/ip_nat_helper.c +7 -0
diff -Nru a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c
@@ -233,6 +233,13 @@
 	newudplen = udplen - match_len + rep_len;
 	newlen = iph->ihl*4 + newudplen;
 
+	/* UDP helpers might accidentally mangle the wrong packet */
+	if (udplen < sizeof(*udph) + match_offset + match_len) {
+		if (net_ratelimit())
+			printk("ip_nat_mangle_udp_packet: undersized packet\n");
+		return 0;
+	}
+
 	if (newlen > 65535) {
 		if (net_ratelimit())
 			printk("ip_nat_mangle_udp_packet: nat'ed packet "
#2 lore raw

Re: [PATCH 2.4 RESEND] netfilter: add size check for udp packet mangling

Quoted 4 lines · On Mon, 13 Oct 2003 20:17:38 +0200 Martin Josefsson <[email protected]>…

Harald sent this with the wrong subject and it got dropped. Here it is with the correct subject.
Found when syncing patch-o-matic with 2.4-bk Please apply. More resends are coming.

Applied, thanks for doing these double-checks with patch-o-matic.