]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix adding static address masks.
authorRoy Marples <roy@marples.name>
Thu, 19 May 2016 20:50:15 +0000 (20:50 +0000)
committerRoy Marples <roy@marples.name>
Thu, 19 May 2016 20:50:15 +0000 (20:50 +0000)
dhcp.c

diff --git a/dhcp.c b/dhcp.c
index 63f315269300db8f1012cfba8d4c55b4a8ec33fa..ade23e05fa70ae66c87ab368b5c9cd546141d2f0 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -1434,8 +1434,12 @@ get_lease(struct interface *ifp,
        /* BOOTP does not set yiaddr for replies when ciaddr is set. */
        lease->addr.s_addr = bootp->yiaddr ? bootp->yiaddr : bootp->ciaddr;
        ctx = ifp->ctx;
-       if (ifp->options->options & DHCPCD_INFORM) {
-               lease->mask = ifp->options->req_mask;
+       if (ifp->options->options & (DHCPCD_STATIC | DHCPCD_INFORM)) {
+               if (ifp->options->req_mask.s_addr == INADDR_ANY)
+                       lease->mask.s_addr =
+                           ipv4_getnetmask(lease->addr.s_addr);
+               else
+                       lease->mask = ifp->options->req_mask;
                lease->brd.s_addr = lease->addr.s_addr | ~lease->mask.s_addr;
        } else {
                if (get_option_addr(ctx, &lease->mask, bootp, len,