patch-1.3.60 linux/net/ipv4/route.c

Next file: linux/net/ipv4/tcp.c
Previous file: linux/net/ipv4/raw.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.59/linux/net/ipv4/route.c linux/net/ipv4/route.c
@@ -39,7 +39,7 @@
  *					routing caches and better behaviour.
  *		
  *		Olaf Erb	:	irtt wasnt being copied right.
- *		Bjorn Ekwall	:	Added KERNELD hack for autodialling
+ *		Bjorn Ekwall	:	Kerneld route support.
  *
  *		This program is free software; you can redistribute it and/or
  *		modify it under the terms of the GNU General Public License
@@ -1498,11 +1498,21 @@
 
 	if (!f || (fi->fib_flags & RTF_REJECT))
 	{
+#ifdef CONFIG_KERNELD	
+		char wanted_route[20];
+#endif		
 #if RT_CACHE_DEBUG >= 2
 		printk("rt_route failed @%08x\n", daddr);
 #endif
 		ip_rt_unlock();
 		kfree_s(rth, sizeof(struct rtable));
+#ifdef CONFIG_KERNELD		
+		daddr=ntohl(daddr);
+		sprintf(wanted_route, "%d.%d.%d.%d",
+			(int)(daddr >> 24) & 0xff, (int)(daddr >> 16) & 0xff,
+			(int)(daddr >> 8) & 0xff, (int)daddr & 0xff);
+		kerneld_route(wanted_route); 	/* Dynamic route request */
+#endif		
 		return NULL;
 	}
 
@@ -1517,7 +1527,7 @@
 			fi = f->fib_info;
 		}
 	}
-
+	
 	if (!f)
 	{
 		ip_rt_unlock();
@@ -1565,12 +1575,7 @@
 		ATOMIC_DECR(&rt->rt_refcnt);
 }
 
-#ifdef CONFIG_KERNELD
-static struct rtable * real_ip_rt_route
-#else
-struct rtable * ip_rt_route
-#endif
-	(__u32 daddr, int local)
+struct rtable * ip_rt_route(__u32 daddr, int local)
 {
 	struct rtable * rth;
 
@@ -1589,28 +1594,6 @@
 	}
 	return ip_rt_slow_route (daddr, local);
 }
-
-#ifdef CONFIG_KERNELD
-struct rtable * ip_rt_route(__u32 daddr, int local)
-{
-	struct rtable *rt;
-	char wanted_route[20];
-	long ipaddr = ntohl(daddr);
-
-	if ((rt = real_ip_rt_route(daddr, local)) == NULL) {
-		sprintf(wanted_route, "%d.%d.%d.%d",
-			(int)(ipaddr >> 24) & 0xff, (int)(ipaddr >> 16) & 0xff,
-			(int)(ipaddr >> 8) & 0xff, (int)ipaddr & 0xff);
-		/* Not good while forwarding a packet... see ipc/msg.c */
-		kerneld_route(wanted_route); /* perhaps a ppp-connection? */
-		/* Try again */
-		rt = real_ip_rt_route(daddr, local);
-	}
-
-	return rt;
-}
-#endif
-
 
 /*
  *	Process a route add request from the user, or from a kernel

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this