Skip to contentSkip to conversation

multiple 2.4.x ipt_REJECT fixes

PATCH Applied Harald Welte 2 participants 2 messages Apr 27, 2003 – Apr 28, 2003

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

PATCH 1/1 multiple 2.4.x ipt_REJECT fixes

Hi Dave!

Again another patch, courtesy of Patrick McHardy. This time a 2.4.x only patch (applies against 2.4.21-rc1). The fix is incremental to a change in early 2.4.21-preX days.

Please apply, Thanks

# 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.1101 -> 1.1102
# net/ipv4/netfilter/ipt_REJECT.c 1.10 -> 1.11
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/04/21 [email protected] 1.1102
# - fix tcp-rst routing
# - fix memory leak
# - remove unecessary "struct in_device" declaration
# - remove RTO_CONN
# --------------------------------------------
#

net/ipv4/netfilter/ipt_REJECT.c +6 -6
diff -Nru a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
@@ -11,7 +11,6 @@
 #include <net/icmp.h>
 #include <net/ip.h>
 #include <net/tcp.h>
-struct in_device;
 #include <net/route.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv4/ipt_REJECT.h>
@@ -65,10 +64,9 @@
 		return;
 
 	/* Routing: if not headed for us, route won't like source */
-	if (ip_route_output(&rt, oldskb->nh.iph->daddr,
-			    local ? oldskb->nh.iph->saddr : 0,
-			    RT_TOS(oldskb->nh.iph->tos) | RTO_CONN,
-			    0) != 0)
+	if (ip_route_output(&rt, oldskb->nh.iph->saddr,
+			    local ? oldskb->nh.iph->daddr : 0,
+			    RT_TOS(oldskb->nh.iph->tos), 0) != 0)
 		return;
 
 	hh_len = (rt->u.dst.dev->hard_header_len + 15)&~15;
@@ -80,8 +78,10 @@
 	   hh_len of incoming interface < hh_len of outgoing interface */
 	nskb = skb_copy_expand(oldskb, hh_len, skb_tailroom(oldskb),
 			       GFP_ATOMIC);
-	if (!nskb)
+	if (!nskb) {
+		dst_release(&rt->u.dst);
 		return;
+	}
 
 	dst_release(nskb->dst);
 	nskb->dst = &rt->u.dst;
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
#1 lore raw

From: Harald Welte <[email protected]>
Date: Sun, 27 Apr 2003 12:46:03 +0200

Again another patch, courtesy of Patrick McHardy. This time a 2.4.x only patch (applies against 2.4.21-rc1). The fix is incremental to a change in early 2.4.21-preX days.

Please apply, Thanks

Applied, and I retrofitted the fixes into 2.5.x
On the 2.5.x side, I had fixed the tcp-rst routing inadvertantly during the IPSEC routing changes :-)