diff options
| author | Roy Marples <roy@marples.name> | 2009-01-01 14:23:36 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-01-01 14:23:36 +0000 |
| commit | 91a44b91b06f127a98ae7f64e377e59d47eba329 (patch) | |
| tree | 6efaf365bf98aec1aa3be0e08c870700efc6f4af /bind.c | |
| parent | 32dd1d3c3e47045db22ea6b0f65ff0b82a21a153 (diff) | |
| download | dhcpcd-91a44b91b06f127a98ae7f64e377e59d47eba329.tar.xz | |
Add a static directive that allows the configuration of variables, which
supercedes any DHCP configured variables.
If ip_address is configured then we don't bother with a DHCP
transaction.
Diffstat (limited to 'bind.c')
| -rw-r--r-- | bind.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -1,6 +1,6 @@ /* * dhcpcd - DHCP client daemon - * Copyright 2006-2008 Roy Marples <roy@marples.name> + * Copyright 2006-2009 Roy Marples <roy@marples.name> * All rights reserved * Redistribution and use in source and binary forms, with or without @@ -129,7 +129,13 @@ bind_interface(void *arg) state->new = state->offer; state->offer = NULL; get_lease(lease, state->new); - if (IN_LINKLOCAL(htonl(state->new->yiaddr))) { + if (ifo->options & DHCPCD_STATIC) { + syslog(LOG_INFO, "%s: using static address %s", + iface->name, inet_ntoa(lease->addr)); + lease->leasetime = ~0U; + lease->net.s_addr = ifo->request_netmask.s_addr; + reason = "STATIC"; + } else if (IN_LINKLOCAL(htonl(state->new->yiaddr))) { syslog(LOG_INFO, "%s: using IPv4LL address %s", iface->name, inet_ntoa(lease->addr)); lease->leasetime = ~0U; @@ -146,7 +152,7 @@ bind_interface(void *arg) } else { if (gettimeofday(&tv, NULL) == 0) lease->leasedfrom = tv.tv_sec; - if (lease->frominfo) + else if (lease->frominfo) reason = "TIMEOUT"; if (lease->leasetime == ~0U) { lease->renewaltime = lease->rebindtime = lease->leasetime; @@ -176,7 +182,7 @@ bind_interface(void *arg) inet_ntoa(lease->addr), lease->leasetime); } } - if (!reason) { + if (reason == NULL) { if (state->old) { if (state->old->yiaddr == state->new->yiaddr && lease->server.s_addr) |
