From: Roy Marples Date: Sat, 16 Nov 2013 11:55:27 +0000 (+0000) Subject: Linux has had address loopback routes since 2.2 X-Git-Tag: v6.2.0~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d0b7b9fddf39b2f5c5347525a12e183f8d8c2ee;p=thirdparty%2Fdhcpcd.git Linux has had address loopback routes since 2.2 I can't find an easy test for this, so just skip it. --- diff --git a/ipv4.c b/ipv4.c index b5fb5f54..066f15e3 100644 --- a/ipv4.c +++ b/ipv4.c @@ -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 @@ 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);