]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix INFORM support a little.
authorRoy Marples <roy@marples.name>
Sat, 12 Apr 2008 03:54:17 +0000 (03:54 +0000)
committerRoy Marples <roy@marples.name>
Sat, 12 Apr 2008 03:54:17 +0000 (03:54 +0000)
client.c
dhcpcd.8.in

index 3f344c0a3192d9ac067df72fbf55a910267a6da9..cdaa4734c56d063bf597853443789bd82586951f 100644 (file)
--- a/client.c
+++ b/client.c
@@ -538,6 +538,17 @@ client_setup(struct if_state *state, const struct options *options)
                        /* The inform address HAS to be configured for it to
                         * work with most DHCP servers */
                        /* add_address */
+                       addr.s_addr = lease->addr.s_addr | ~lease->net.s_addr;
+                       logger(LOG_DEBUG, "adding IP address %s/%d",
+                              inet_ntoa(lease->addr),
+                              inet_ntocidr(lease->net));
+                       if (add_address(iface->name, &lease->addr,
+                                       &lease->net, &addr) == -1)
+                       {
+                               logger(LOG_ERR, "add_address: %s",
+                                      strerror(errno));
+                               return -1;
+                       }
                        iface->addr.s_addr = lease->addr.s_addr;
                        iface->net.s_addr = lease->net.s_addr;
                }
@@ -788,6 +799,9 @@ handle_timeout(struct if_state *state, const struct options *options)
 
                do_socket(state, SOCKET_CLOSED);
 
+               if (options->options & DHCPCD_INFORM)
+                       return -1;
+
 #ifdef ENABLE_INFO
                if (!(state->options & DHCPCD_TEST) &&
                    (state->options & DHCPCD_IPV4LL ||
index 4dd94d9e422c45f48c00290d9e556644bcf02f9a..1c738b662fe1c6ae875d7d9af997744833b327b1 100644 (file)
@@ -206,7 +206,8 @@ as above, but sends a DHCP inform instead of a request. This requires the
 interface to be configured first. This does not get a lease as such, just
 notifies the DHCP server of the
 .Ar address
-we are using.
+we are using. If we fail to contact a DHCP server then we return a failure
+instead of falling back on IPv4LL.
 .It Fl t , -timeout Ar seconds
 Timeout after
 .Ar seconds ,