]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix INFORM and document it in dhcpcd-run-hooks.
authorRoy Marples <roy@marples.name>
Wed, 13 Aug 2008 19:41:40 +0000 (19:41 +0000)
committerRoy Marples <roy@marples.name>
Wed, 13 Aug 2008 19:41:40 +0000 (19:41 +0000)
client.c
configure.c
dhcpcd-run-hooks.8.in

index 3d982a2635a96073a8605a0b96d767e4a123986f..66a7f9d31b7b54f66bb7ec6ac6b62730fbe9dfdb 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1252,7 +1252,7 @@ handle_timeout(struct if_state *state, const struct options *options)
                 * INIT-REBOOT state correctly. */
                lease->server.s_addr = 0;
                state->messages = 0;
-               if (lease->addr.s_addr) {
+               if (lease->addr.s_addr && !(state->options & DHCPCD_INFORM)) {
                        logger(LOG_INFO, "renewing lease of %s",
                               inet_ntoa(lease->addr));
                        state->state = STATE_RENEWING;
@@ -1467,10 +1467,9 @@ handle_dhcp(struct if_state *state, struct dhcp_message **dhcpp,
                                        dhcp, DHO_SERVERID);
                        log_dhcp(LOG_INFO, "acknowledged", dhcp);
                }
-               if (!state->offer) {
-                       state->offer = dhcp;
-                       *dhcpp = NULL;
-               }
+               free(state->offer);
+               state->offer = dhcp;
+               *dhcpp = NULL;
                break;
        default:
                logger(LOG_ERR, "wrong state %d", state->state);
@@ -1479,8 +1478,9 @@ handle_dhcp(struct if_state *state, struct dhcp_message **dhcpp,
        do_socket(state, SOCKET_CLOSED);
        r = bind_dhcp(state, options);
        if (!(state->options & DHCPCD_ARP)) {
-               logger(LOG_DEBUG, "renew in %ld seconds",
-                      (long int)state->stop.tv_sec);
+               if (!(state->options & DHCPCD_INFORM))
+                       logger(LOG_DEBUG, "renew in %ld seconds",
+                              (long int)state->stop.tv_sec);
                return r;
        }
        state->state = STATE_ANNOUNCING;
index db2228eb8ce813bed986d1eaa7a238811054b8e1..dad3bce6d19c5397716c9ee3c92fbf7d577fba7b 100644 (file)
@@ -350,10 +350,12 @@ configure(struct interface *iface, const char *reason,
 #endif
 
        /* Grab our IP config */
-       if (dhcp == NULL || dhcp->yiaddr == 0)
+       if (dhcp == NULL)
                up = 0;
        else {
                addr.s_addr = dhcp->yiaddr;
+               if (addr.s_addr == 0)
+                       addr.s_addr = lease->addr.s_addr;
                /* Ensure we have all the needed values */
                if (get_option_addr(&net.s_addr, dhcp, DHO_SUBNETMASK) == -1)
                        net.s_addr = get_netmask(addr.s_addr);
index 556601ede217c0ce2e120b5bdc5aaa94700520f0..fb435ccd5ca5c148e0902744c4822f4e1f16619d 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 12, 2008
+.Dd August 13, 2008
 .Dt DHCPCD.SH 8 SMM
 .Sh NAME
 .Nm dhcpcd-run-hooks
@@ -69,6 +69,9 @@ Here's a list of reasons why
 .Nm
 could be invoked:
 .Bl -tag -width indent
+.It Dv INFORM
+dhcpcd informed a DHCP server about it's address and obtained other
+configuration details.
 .It Dv BOUND
 dhcpcd obtained a new lease from a DHCP server.
 .It Dv RENEW