changeset 2158:814fea24c951 draft

Linux has had address loopback routes since 2.2 I can't find an easy test for this, so just skip it.
author Roy Marples <roy@marples.name>
date Sat, 16 Nov 2013 11:55:27 +0000
parents d608ee8004e9
children 240670669be0
files ipv4.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ipv4.c	Fri Nov 15 16:55:07 2013 +0000
+++ b/ipv4.c	Sat Nov 16 11:55:27 2013 +0000
@@ -55,6 +55,12 @@
 #include "net.h"
 #include "script.h"
 
+#define IPV4_LOOPBACK_ROUTE
+#ifdef __linux__
+/* Linux has had loopback routes in the local table since 2.2 */
+#undef IPV4_LOOPBACK_ROUTE
+#endif
+
 static struct rt_head *routes;
 
 int
@@ -335,6 +341,7 @@
 	return rt;
 }
 
+#ifdef IPV4_LOOPBACK_ROUTE
 static struct rt_head *
 add_loopback_route(struct rt_head *rt, const struct interface *ifp)
 {
@@ -360,6 +367,7 @@
 	TAILQ_INSERT_HEAD(rt, r, next);
 	return rt;
 }
+#endif
 
 static struct rt_head *
 get_routes(struct interface *ifp)
@@ -508,7 +516,9 @@
 		dnr = get_routes(ifp);
 		dnr = massage_host_routes(dnr, ifp);
 		dnr = add_subnet_route(dnr, ifp);
+#ifdef IPV4_LOOPBACK_ROUTE
 		dnr = add_loopback_route(dnr, ifp);
+#endif
 		if (ifp->options->options & DHCPCD_GATEWAY) {
 			dnr = add_router_host_route(dnr, ifp);
 			dnr = add_destination_route(dnr, ifp);