]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Linux has had address loopback routes since 2.2
authorRoy Marples <roy@marples.name>
Sat, 16 Nov 2013 11:55:27 +0000 (11:55 +0000)
committerRoy Marples <roy@marples.name>
Sat, 16 Nov 2013 11:55:27 +0000 (11:55 +0000)
I can't find an easy test for this, so just skip it.

ipv4.c

diff --git a/ipv4.c b/ipv4.c
index b5fb5f54bb8db28cb264061afc5f96a7d49e30a1..066f15e37758b820e12ab59dea555af88bf25c8b 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
 #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 @@ add_subnet_route(struct rt_head *rt, const struct interface *ifp)
        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 @@ add_loopback_route(struct rt_head *rt, const struct interface *ifp)
        TAILQ_INSERT_HEAD(rt, r, next);
        return rt;
 }
+#endif
 
 static struct rt_head *
 get_routes(struct interface *ifp)
@@ -508,7 +516,9 @@ ipv4_buildroutes(void)
                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);