diff --git a/dhclient-script b/dhclient-script index c0d936a..4117d42 100644 --- a/dhclient-script +++ b/dhclient-script @@ -569,6 +569,17 @@ dhconfig() { execute_client_side_configuration_scripts "config" } +wait_for_link_local() { + # we need a link-local address to be ready (not tentative) + for i in $(seq 50); do + linklocal=$(ip -6 addr show dev "${interface}" scope link) + # tentative flag means DAD is still not complete + tentative=$(echo "${linklocal}" | grep tentative) + [[ -n "${linklocal}" && -z "${tentative}" ]] && exit_with_hooks 0 + sleep 0.1 + done +} + # Section 18.1.8. (Receipt of Reply Messages) of RFC 3315 says: # The client SHOULD perform duplicate address detection on each of # the addresses in any IAs it receives in the Reply message before @@ -769,18 +780,17 @@ case "${reason}" in # remove any stale addresses from aborted clients ip -6 addr flush dev "${interface}" scope global permanent - # we need a link-local address to be ready (not tentative) - for i in $(seq 50); do - linklocal=$(ip -6 addr show dev "${interface}" scope link) - # tentative flag means DAD is still not complete - tentative=$(echo "${linklocal}" | grep tentative) - [[ -n "${linklocal}" && -z "${tentative}" ]] && exit_with_hooks 0 - sleep 0.1 - done + wait_for_link_local exit_with_hooks 0 ;; + PREINIT6S) # stateless + ip link set dev "${interface}" up + wait_for_link_local + exit_with_hooks 0 + ;; + BOUND|RENEW|REBIND|REBOOT) if [ -z "${interface}" ] || [ -z "${new_ip_address}" ]; then exit_with_hooks 2 diff --git a/dhcp-dhclient-preinit6s.patch b/dhcp-dhclient-preinit6s.patch new file mode 100644 index 0000000..f45e9a9 --- /dev/null +++ b/dhcp-dhclient-preinit6s.patch @@ -0,0 +1,58 @@ +diff -up dhcp-4.3.3/client/dhclient.c.preinit6s dhcp-4.3.3/client/dhclient.c +--- dhcp-4.3.3/client/dhclient.c.preinit6s 2015-09-22 16:42:27.211145636 +0200 ++++ dhcp-4.3.3/client/dhclient.c 2015-09-22 16:42:54.826112762 +0200 +@@ -691,6 +691,12 @@ main(int argc, char **argv) { + + inaddr_any.s_addr = INADDR_ANY; + ++ /* Discover all the network interfaces. */ ++ discover_interfaces(DISCOVER_UNCONFIGURED); ++ ++ /* Parse the dhclient.conf file. */ ++ read_client_conf(); ++ + /* Stateless special case. */ + if (stateless) { + if (release_mode || (wanted_ia_na > 0) || +@@ -702,12 +708,6 @@ main(int argc, char **argv) { + return 0; + } + +- /* Discover all the network interfaces. */ +- discover_interfaces(DISCOVER_UNCONFIGURED); +- +- /* Parse the dhclient.conf file. */ +- read_client_conf(); +- + /* Parse any extra command line configuration arguments: */ + if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) { + arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg); +@@ -1169,15 +1169,23 @@ void run_stateless(int exit_mode) + struct client_state *client; + omapi_object_t *listener; + isc_result_t result; +- +- /* Discover the network interface. */ +- discover_interfaces(DISCOVER_REQUESTED); ++ struct interface_info *ip; + + if (!interfaces) + usage(); + +- /* Parse the dhclient.conf file. */ +- read_client_conf(); ++ for (ip = interfaces; ip; ip = ip->next) { ++ if ((interfaces_requested > 0) && ++ ((ip->flags & (INTERFACE_REQUESTED | ++ INTERFACE_AUTOMATIC)) != ++ INTERFACE_REQUESTED)) ++ continue; ++ script_init(ip->client, "PREINIT6S", NULL); ++ script_go(ip->client); ++ } ++ ++ /* Discover the network interface. */ ++ discover_interfaces(DISCOVER_REQUESTED); + + /* Parse the lease database. */ + read_client_leases(); diff --git a/dhcp.spec b/dhcp.spec index 4cb4be0..0236a0d 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -18,7 +18,7 @@ Summary: Dynamic host configuration protocol software Name: dhcp Version: 4.3.3 -Release: 2%{?dist} +Release: 3%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # dcantrell maintaining the package) made incorrect use of the epoch and # that's why it is at 12 now. It should have never been used, but it was. @@ -67,14 +67,14 @@ Patch27: dhcp-duidv4.patch Patch28: dhcp-systemtap.patch Patch29: dhcp-getifaddrs.patch Patch30: dhcp-omapi-leak.patch - +Patch31: dhcp-client-request-release-bind-iface.patch Patch32: dhcp-interval.patch Patch33: dhcp-no-subnet-error2info.patch Patch34: dhcp-sd_notify.patch Patch35: dhcp-VLAN-ID.patch Patch36: dhcp-option97-pxe-client-id.patch Patch37: dhcp-stateless-DUID-LLT.patch -Patch38: dhcp-client-request-release-bind-iface.patch +Patch38: dhcp-dhclient-preinit6s.patch BuildRequires: autoconf BuildRequires: automake @@ -311,6 +311,10 @@ rm bind/bind.tar.gz # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #33990]) %patch30 -p1 -b .leak +# send unicast request/release via correct interface (#800561, #1177351) +# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30544]) +%patch31 -p1 -b .bind-iface + # isc_time_nowplusinterval() is not safe with 64-bit time_t (#662254, #789601) # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #28038]) %patch32 -p1 -b .interval @@ -333,9 +337,8 @@ rm bind/bind.tar.gz # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #38144]) %patch37 -p1 -b .stateless-DUID-LLT -# send unicast request/release via correct interface (#800561, #1177351) -# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30544]) -%patch38 -p1 -b .bind-iface +# dhclient: make sure link-local address is ready in stateless mode (#1263466) +%patch38 -p1 -b .preinit6s # DHCLIENT_DEFAULT_PREFIX_LEN 64 -> 128 # https://bugzilla.gnome.org/show_bug.cgi?id=656610 @@ -660,6 +663,9 @@ done %doc doc/html/ %changelog +* Tue Sep 22 2015 Jiri Popelka - 12:4.3.3-3 +- dhclient: make sure link-local address is ready in stateless mode (#1263466) + * Mon Sep 07 2015 Jiri Popelka - 12:4.3.3-2 - VLAN ID is only bottom 12-bits of TCI (#1259552)