From: Roy Marples Date: Tue, 8 Nov 2016 22:43:13 +0000 (+0000) Subject: Reject routes on Linux don't use a gateway. X-Git-Tag: v7.0.0-beta1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6c6cb1f4ece0ac672b226f46e45d57d10e95e7a;p=thirdparty%2Fdhcpcd.git Reject routes on Linux don't use a gateway. --- diff --git a/if-linux.c b/if-linux.c index 4d0f61bd..8edc94ba 100644 --- a/if-linux.c +++ b/if-linux.c @@ -1165,7 +1165,10 @@ if_route(unsigned char cmd, const struct rt *rt) nlm.rt.rtm_scope = RT_SCOPE_LINK; else nlm.rt.rtm_scope = RT_SCOPE_UNIVERSE; - nlm.rt.rtm_type = RTN_UNICAST; + if (rt->rt_flags & RTF_REJECT) + nlm.rt.rtm_type = RTN_UNREACHABLE; + else + nlm.rt.rtm_type = RTN_UNICAST; } #define ADDSA(type, sa) \ diff --git a/ipv6.c b/ipv6.c index 4514bb98..3ed05263 100644 --- a/ipv6.c +++ b/ipv6.c @@ -2161,7 +2161,10 @@ inet6_makeprefix(struct interface *ifp, const struct ra *rap, sa_in6_init(&rt->rt_netmask, &netmask); if (addr->flags & IPV6_AF_DELEGATEDPFX) { rt->rt_flags |= RTF_REJECT; + /* Linux does not like a gateway for a reject route. */ +#ifndef __linux__ sa_in6_init(&rt->rt_gateway, &in6addr_loopback); +#endif } else rt->rt_gateway.sa_family = AF_UNSPEC; sa_in6_init(&rt->rt_ifa, &addr->addr);