Re: ICMP redirects never followed in 2.0.30?

Ivan Nejgebauer (ian@uns.ns.ac.yu)
26 Aug 1997 21:40:52 -0000


smurf@lap.noris.de (Matthias Urlichs) wrote:
>> [faulty redirect handling]
>> In pre-7, the code is still there... I just tossed the #if conditionals.

... in which case a packet will be accepted even if IP forwarding is
off. The following patch (against vanilla 2.0.30) should take care of
the problem:

--- net/ipv4/icmp.c.old Tue Aug 26 23:19:42 1997
+++ net/ipv4/icmp.c Tue Aug 26 23:24:57 1997
@@ -826,13 +826,13 @@
* When using no routing protocol, we MAY follow redirects. (RFC 1812, 5.2.7.2)
*/

-#if !defined(CONFIG_IP_DUMB_ROUTER)
if (sysctl_ip_forward) {
NETDEBUG(printk(KERN_INFO "icmp: ICMP redirect ignored. dest = %lX, "
"orig gw = %lX, \"new\" gw = %lX, device = %s.\n", ntohl(ip),
ntohl(source), ntohl(icmph->un.gateway), dev->name));
+
+ goto flush_it;
}
-#else
switch(icmph->code & 7)
{
case ICMP_REDIR_NET:
@@ -870,7 +870,6 @@
default:
break;
}
-#endif
/*
* Discard the original packet
*/