]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix detecting host routes.
authorRoy Marples <roy@marples.name>
Thu, 26 Mar 2015 21:39:02 +0000 (21:39 +0000)
committerRoy Marples <roy@marples.name>
Thu, 26 Mar 2015 21:39:02 +0000 (21:39 +0000)
ipv4.c

diff --git a/ipv4.c b/ipv4.c
index 7e4e72350358ac40cd6eb2e5027ca033b13182e0..e0b2169f3f6f76318683441ca76c25d36eebe418 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
@@ -332,6 +332,12 @@ ipv4_handlert(struct dhcpcd_ctx *ctx, int cmd, struct rt *rt)
        if (ctx->ipv4_kroutes == NULL)
                return 0;
 
+       /* DHCP host routes have a gateway of the destination.
+        * We need to emulate that */
+       if (rt->gate.s_addr == INADDR_ANY &&
+           rt->net.s_addr == INADDR_BROADCAST)
+               rt->gate = rt->dest;
+
        f = ipv4_findrt(ctx, rt, 1);
        switch (cmd) {
        case RTM_ADD: