]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Use the existing start_reboot function instead of a start_request.
authorRoy Marples <roy@marples.name>
Sat, 18 Oct 2008 10:52:01 +0000 (10:52 +0000)
committerRoy Marples <roy@marples.name>
Sat, 18 Oct 2008 10:52:01 +0000 (10:52 +0000)
dhcp.c
dhcpcd.c

diff --git a/dhcp.c b/dhcp.c
index bd360885b630e6387af5332b83edb5d65ff60439..59c648dfeb0824cb469db84efb9bc3a1fbc836ed 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -831,14 +831,13 @@ make_message(struct dhcp_message **message,
                        if (lease->server.s_addr)
                                PUTADDR(DHO_SERVERID, lease->server);
                }
-       }
 
-       if (type == DHCP_RELEASE) {
-               if (lease->server.s_addr)
+               if (type == DHCP_RELEASE) {
+                   if (lease->server.s_addr)
                        PUTADDR(DHO_SERVERID, lease->server);
+               }
        }
 
-
        if (type == DHCP_DISCOVER ||
            type == DHCP_INFORM ||
            type == DHCP_REQUEST)
index 249c76283be16725b6f7baac8f84d6f9bb1b1938..d1ea55e24e62c0b38f221ee7a6cbe130f4cdd1f5 100644 (file)
--- 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);