Mercurial > hg > dhcpcd
changeset 4188:23ff91710a01 draft
dhcp: Don't set ciaddr or unicast if the address we have is faked.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Thu, 07 Dec 2017 15:15:45 +0000 |
| parents | 73de5e0edf30 |
| children | 0b088d803b61 |
| files | src/dhcp.c |
| diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dhcp.c Thu Dec 07 15:12:18 2017 +0000 +++ b/src/dhcp.c Thu Dec 07 15:15:45 2017 +0000 @@ -777,7 +777,8 @@ (type == DHCP_INFORM || type == DHCP_RELEASE || (type == DHCP_REQUEST && state->addr->mask.s_addr == lease->mask.s_addr && - (state->new == NULL || IS_DHCP(state->new))))) + (state->new == NULL || IS_DHCP(state->new)) && + !(state->added & STATE_FAKE)))) bootp->ciaddr = state->addr->addr.s_addr; bootp->op = BOOTREQUEST; @@ -845,6 +846,7 @@ if (type == DHCP_DECLINE || (type == DHCP_REQUEST && (state->addr == NULL || + state->added & STATE_FAKE || lease->addr.s_addr != state->addr->addr.s_addr))) { PUT_ADDR(DHO_IPADDRESS, &lease->addr); @@ -2028,7 +2030,7 @@ ifp->name, lease->leasetime - lease->rebindtime); state->state = DHS_REBIND; eloop_timeout_delete(ifp->ctx->eloop, send_renew, ifp); - state->lease.server.s_addr = 0; + state->lease.server.s_addr = INADDR_ANY; state->interval = 0; ifp->options->options &= ~(DHCPCD_CSR_WARNED | DHCPCD_ROUTER_HOST_ROUTE_WARNED); @@ -2626,7 +2628,7 @@ #endif dhcp_new_xid(ifp); - state->lease.server.s_addr = 0; + state->lease.server.s_addr = INADDR_ANY; eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); #ifdef IPV4LL
