summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-04-24 11:00:57 +0000
committerRoy Marples <roy@marples.name>2019-04-24 11:00:57 +0000
commitf96f6447a6b3adfd17ad2c07ca08154c4751b872 (patch)
treedd31157b5a81f6b0b3585c982d35d6f987e2c63f
parent6fcd7ff4a7e39b7e80c2c1babe7fc150ef7e1efe (diff)
downloaddhcpcd-f96f6447a6b3adfd17ad2c07ca08154c4751b872.tar.xz
sun: Fix adding IPv4LL default route
-rw-r--r--src/if-sun.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/if-sun.c b/src/if-sun.c
index bb5b5c0a..191e0e68 100644
--- a/src/if-sun.c
+++ b/src/if-sun.c
@@ -526,6 +526,7 @@ if_route0(struct dhcpcd_ctx *ctx, struct rtm *rtmsg,
struct rt_msghdr *rtm;
char *bp = rtmsg->buffer;
socklen_t sl;
+ bool gateway_unspec;
/* WARNING: Solaris will not allow you to delete RTF_KERNEL routes.
* This includes subnet/prefix routes. */
@@ -544,6 +545,8 @@ if_route0(struct dhcpcd_ctx *ctx, struct rtm *rtmsg,
rtm->rtm_flags = rt->rt_flags;
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY;
+ gateway_unspec = sa_is_unspecified(&rt->rt_gateway);
+
if (cmd == RTM_ADD || cmd == RTM_CHANGE) {
bool netmask_bcast = sa_is_allones(&rt->rt_netmask);
@@ -563,7 +566,7 @@ if_route0(struct dhcpcd_ctx *ctx, struct rtm *rtmsg,
if (netmask_bcast)
rtm->rtm_flags |= RTF_HOST;
- else
+ else if (!gateway_unspec)
rtm->rtm_flags |= RTF_GATEWAY;
/* Emulate the kernel by marking address generated
@@ -582,7 +585,7 @@ if_route0(struct dhcpcd_ctx *ctx, struct rtm *rtmsg,
ADDSA(&rt->rt_dest);
- if (sa_is_unspecified(&rt->rt_gateway))
+ if (gateway_unspec)
ADDSA(&rt->rt_ifa);
else
ADDSA(&rt->rt_gateway);