summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-11-08 22:43:13 +0000
committerRoy Marples <roy@marples.name>2016-11-08 22:43:13 +0000
commita6c6cb1f4ece0ac672b226f46e45d57d10e95e7a (patch)
tree69a6e42e080efee4834631f850029f9fd2f72122
parent9474a3840620f37714d7de205cb422d4ea1141da (diff)
downloaddhcpcd-a6c6cb1f4ece0ac672b226f46e45d57d10e95e7a.tar.xz
Reject routes on Linux don't use a gateway.
-rw-r--r--if-linux.c5
-rw-r--r--ipv6.c3
2 files changed, 7 insertions, 1 deletions
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);