summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-10-18 10:52:01 +0000
committerRoy Marples <roy@marples.name>2008-10-18 10:52:01 +0000
commitaec7d71ddb2d4236c7db2fe79350274ca26e178f (patch)
treed4ad638e87ad7f880dc0132d20070e918d3aaea7 /dhcpcd.c
parent49c0efdadb6fa4a27bf0405302945403d4d62ef8 (diff)
downloaddhcpcd-aec7d71ddb2d4236c7db2fe79350274ca26e178f.tar.xz
Use the existing start_reboot function instead of a start_request.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 249c7628..d1ea55e2 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -746,31 +746,11 @@ start_reboot(struct interface *iface)
send_request(iface);
}
-static void
-start_request(struct interface *iface)
-{
- struct if_options *ifo = iface->state->options;
-
- syslog(LOG_INFO, "%s: requesting lease of %s",
- iface->name, inet_ntoa(ifo->request_address));
- iface->state->state = DHS_REQUEST;
- iface->state->xid = arc4random();
- open_sockets(iface);
- delete_timeout(NULL, iface);
- iface->state->offer = xzalloc(sizeof(*iface->state->offer));
- iface->state->offer->yiaddr = ifo->request_address.s_addr;
- get_lease(&iface->state->lease, iface->state->offer);
- iface->state->lease.frominfo = 1;
- /* We should only go into this request loop once */
- ifo->request_address.s_addr = 0;
- add_timeout_sec(10, start_discover, iface);
- send_request(iface);
-}
-
void
start_interface(void *arg)
{
struct interface *iface = arg;
+ struct if_options *ifo = iface->state->options;
struct stat st;
struct timeval now;
uint32_t l;
@@ -781,11 +761,12 @@ start_interface(void *arg)
}
iface->start_uptime = uptime();
- if (iface->state->options->request_address.s_addr) {
- start_request(iface);
- return;
- }
- iface->state->offer = read_lease(iface);
+ if (ifo->request_address.s_addr) {
+ iface->state->offer = xzalloc(sizeof(*iface->state->offer));
+ iface->state->offer->yiaddr = ifo->request_address.s_addr;
+ ifo->request_address.s_addr = 0;
+ } else
+ iface->state->offer = read_lease(iface);
/* if (iface->state->offer) {
if (IN_LINKLOCAL(htonl(iface->state->offer->yiaddr))) {
free(iface->state->offer);