From: Roy Marples Date: Sat, 12 Apr 2008 03:54:17 +0000 (+0000) Subject: Fix INFORM support a little. X-Git-Tag: v4.0.2~509 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ab998f88b6fb39c3e8247d17a2707f5bd37d3a1;p=thirdparty%2Fdhcpcd.git Fix INFORM support a little. --- diff --git a/client.c b/client.c index 3f344c0a..cdaa4734 100644 --- 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 || diff --git a/dhcpcd.8.in b/dhcpcd.8.in index 4dd94d9e..1c738b66 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -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 ,