Activity log for bug #1718568

Date Who What changed Old value New value Message
2017-09-21 03:19:46 Jeff bug added bug
2017-09-21 03:23:50 Jeff description Summary: ======== If a interface does not have a link-local address, dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in # set the link up and wait for ipv6 link local dad to finish ipv6_link_up_and_dad() this code sets out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for case " $out " in *\ dadfailed\ *) error "$dev: ipv6 dad failed." return 1;; *\ tentative\ *) :;; *) return 0;; esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution. case " $out " in *\ dadfailed\ *) error "$dev: ipv6 dad failed." return 1;; *\ tentative\ *) :;; " ") : ;; *) return 0;; esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet. Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution.         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;      " ")   :   ;;             *) return 0;;         esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet.
2017-09-21 03:26:36 Jeff bug watch added https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=783387
2017-09-21 03:26:36 Jeff bug task added isc-dhcp (Debian)
2017-09-21 03:49:01 Jeff description Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution.         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;      " ")   :   ;;             *) return 0;;         esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet. Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution.         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;       " ")     :     ;;             *) return 0;;         esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet.
2017-09-21 04:07:58 Jeff attachment added Patch to detect no link-local address https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1718568/+attachment/4954114/+files/dhclient-script.diff
2017-09-21 04:09:17 Jeff description Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution.         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;       " ")     :     ;;             *) return 0;;         esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet. Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution. .        case " $out " in .            *\ dadfailed\ *) .                error "$dev: ipv6 dad failed." .                return 1;; .            *\ tentative\ *) :;; +      " ") +    : +    ;; .            *) return 0;; .        esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet.
2017-09-21 04:18:58 Ubuntu Foundations Team Bug Bot tags ipv6 ipv6 patch
2017-09-21 04:19:05 Ubuntu Foundations Team Bug Bot bug added subscriber Ubuntu Review Team
2017-09-21 13:15:59 Bug Watch Updater isc-dhcp (Debian): status Unknown New
2017-09-21 15:43:32 Dan Streetman bug added subscriber Dan Streetman
2017-10-12 11:24:23 Dan Streetman nominated for series Ubuntu Artful
2017-10-12 11:24:23 Dan Streetman nominated for series Ubuntu Trusty
2017-10-12 11:24:23 Dan Streetman nominated for series Ubuntu Zesty
2017-10-12 11:24:23 Dan Streetman nominated for series Ubuntu Xenial
2017-10-12 11:48:16 Eric Desrochers bug task added isc-dhcp (Ubuntu Artful)
2017-10-12 11:48:20 Eric Desrochers bug task added isc-dhcp (Ubuntu Trusty)
2017-10-12 11:48:26 Eric Desrochers bug task added isc-dhcp (Ubuntu Xenial)
2017-10-12 11:48:31 Eric Desrochers bug task added isc-dhcp (Ubuntu Zesty)
2017-10-12 12:19:23 Dan Streetman isc-dhcp (Ubuntu Trusty): assignee Dan Streetman (ddstreet)
2017-10-12 12:19:24 Dan Streetman isc-dhcp (Ubuntu Xenial): assignee Dan Streetman (ddstreet)
2017-10-12 12:19:26 Dan Streetman isc-dhcp (Ubuntu Zesty): assignee Dan Streetman (ddstreet)
2017-10-12 12:19:28 Dan Streetman isc-dhcp (Ubuntu Artful): assignee Dan Streetman (ddstreet)
2017-10-12 12:19:31 Dan Streetman isc-dhcp (Ubuntu Artful): importance Undecided Medium
2017-10-12 12:19:34 Dan Streetman isc-dhcp (Ubuntu Zesty): importance Undecided Medium
2017-10-12 12:19:36 Dan Streetman isc-dhcp (Ubuntu Trusty): importance Undecided Medium
2017-10-12 12:19:38 Dan Streetman isc-dhcp (Ubuntu Xenial): importance Undecided Medium
2017-10-12 12:19:39 Dan Streetman isc-dhcp (Ubuntu Artful): status New In Progress
2017-10-12 12:19:41 Dan Streetman isc-dhcp (Ubuntu Zesty): status New In Progress
2017-10-12 12:19:42 Dan Streetman isc-dhcp (Ubuntu Xenial): status New In Progress
2017-10-12 12:19:44 Dan Streetman isc-dhcp (Ubuntu Trusty): status New In Progress
2017-10-12 13:28:52 Dan Streetman attachment added lp1718568-artful.debdiff https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1718568/+attachment/4968656/+files/lp1718568-artful.debdiff
2017-10-12 13:29:07 Dan Streetman attachment added lp1718568-zesty.debdiff https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1718568/+attachment/4968657/+files/lp1718568-zesty.debdiff
2017-10-12 13:29:22 Dan Streetman attachment added lp1718568-xenial.debdiff https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1718568/+attachment/4968658/+files/lp1718568-xenial.debdiff
2017-10-12 13:29:38 Dan Streetman attachment added lp1718568-trusty.debdiff https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1718568/+attachment/4968659/+files/lp1718568-trusty.debdiff
2017-10-12 13:40:14 Dan Streetman description Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution. .        case " $out " in .            *\ dadfailed\ *) .                error "$dev: ipv6 dad failed." .                return 1;; .            *\ tentative\ *) :;; +      " ") +    : +    ;; .            *) return 0;; .        esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet. [impact] bug 1633479 made a change to isc-dhcp to wait for an interface's link-local ipv6 address to switch from 'tentative' to normal, because all link-local addresses briefly go through a 'tentative' state while the kernel is performing ipv6 link-local 'duplicate address detection' (DAD). While in the 'tentative' state, dhclient can't take over the interface and send out dhcpv6 requests; it must wait until DAD completes. However, the change made in that bug does not account for the case where the 'tentative' check is done before the interface has even set up a link-local address; its case statement assumes if there is no 'tentative' or 'dadfailed' string in the output, the link-local address is ready to use. When the address check finds no address at all, this will return as successful, even though it shouldn't, and dhclient will fail to get the dhcpv6 address. [test case] on a system that is configured for dhcpv6 on one or more of its interfaces, repeatedly try to get the dhcpv6 address. For interfaces that are slower to actually set up their initial tentative link-local address, they will occasionally fail, since the current code is a race between the kernel adding the tentative link-local address, and the dhclient-script.linux code checking the interface for a tentative address. with the patch to correct this, even interfaces slow to add their tentative link-local address should correctly wait for the address to get added, and then transition from tentative to normal, and then begin the dhcpv6 process. [regression potential] errors in this function can cause dhclient to fail to get a ipv6 address for an interface; regression would happen if this patch makes it fail more than it already is failing, but would not cause other failures or problems after getting an ipv6 address; this patch will affect only startup-time. [other info] related bug 1633479 [original description] Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution. .        case " $out " in .            *\ dadfailed\ *) .                error "$dev: ipv6 dad failed." .                return 1;; .            *\ tentative\ *) :;; +      " ") +    : +    ;; .            *) return 0;; .        esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet.
2017-10-12 13:44:41 Dan Streetman nominated for series Ubuntu Bb-series
2017-10-12 13:47:00 Eric Desrochers bug task added isc-dhcp (Ubuntu Bb-series)
2017-10-12 13:47:13 Dan Streetman isc-dhcp (Ubuntu Bb-series): status New In Progress
2017-10-12 13:47:15 Dan Streetman isc-dhcp (Ubuntu Bb-series): importance Undecided Medium
2017-10-12 13:47:18 Dan Streetman isc-dhcp (Ubuntu Bb-series): assignee Dan Streetman (ddstreet)
2018-02-16 20:27:56 Dan Streetman isc-dhcp (Ubuntu Zesty): status In Progress Won't Fix
2018-02-20 16:47:53 Dan Streetman attachment added lp1718568-bionic.debdiff https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1718568/+attachment/5059088/+files/lp1718568-bionic.debdiff
2018-02-20 18:01:11 Dan Streetman bug added subscriber Ubuntu Sponsors Team
2018-02-23 18:21:23 Launchpad Janitor isc-dhcp (Ubuntu Bionic): status In Progress Fix Released
2018-02-27 17:14:12 Łukasz Zemczak isc-dhcp (Ubuntu Artful): status In Progress Fix Committed
2018-02-27 17:14:15 Łukasz Zemczak bug added subscriber Ubuntu Stable Release Updates Team
2018-02-27 17:14:17 Łukasz Zemczak bug added subscriber SRU Verification
2018-02-27 17:14:22 Łukasz Zemczak tags ipv6 patch ipv6 patch verification-needed verification-needed-artful
2018-02-27 17:17:17 Łukasz Zemczak isc-dhcp (Ubuntu Xenial): status In Progress Fix Committed
2018-02-27 17:17:25 Łukasz Zemczak tags ipv6 patch verification-needed verification-needed-artful ipv6 patch verification-needed verification-needed-artful verification-needed-xenial
2018-02-27 17:19:01 Łukasz Zemczak isc-dhcp (Ubuntu Trusty): status In Progress Fix Committed
2018-02-27 17:19:09 Łukasz Zemczak tags ipv6 patch verification-needed verification-needed-artful verification-needed-xenial ipv6 patch verification-needed verification-needed-artful verification-needed-trusty verification-needed-xenial
2018-02-27 17:19:14 Łukasz Zemczak removed subscriber Ubuntu Sponsors Team
2018-03-01 22:40:04 Dan Streetman tags ipv6 patch verification-needed verification-needed-artful verification-needed-trusty verification-needed-xenial ipv6 patch
2018-03-01 22:40:10 Dan Streetman isc-dhcp (Ubuntu Artful): status Fix Committed In Progress
2018-03-01 22:40:12 Dan Streetman isc-dhcp (Ubuntu Xenial): status Fix Committed In Progress
2018-03-01 22:40:15 Dan Streetman isc-dhcp (Ubuntu Trusty): status Fix Committed In Progress
2018-03-02 20:14:54 Dan Streetman description [impact] bug 1633479 made a change to isc-dhcp to wait for an interface's link-local ipv6 address to switch from 'tentative' to normal, because all link-local addresses briefly go through a 'tentative' state while the kernel is performing ipv6 link-local 'duplicate address detection' (DAD). While in the 'tentative' state, dhclient can't take over the interface and send out dhcpv6 requests; it must wait until DAD completes. However, the change made in that bug does not account for the case where the 'tentative' check is done before the interface has even set up a link-local address; its case statement assumes if there is no 'tentative' or 'dadfailed' string in the output, the link-local address is ready to use. When the address check finds no address at all, this will return as successful, even though it shouldn't, and dhclient will fail to get the dhcpv6 address. [test case] on a system that is configured for dhcpv6 on one or more of its interfaces, repeatedly try to get the dhcpv6 address. For interfaces that are slower to actually set up their initial tentative link-local address, they will occasionally fail, since the current code is a race between the kernel adding the tentative link-local address, and the dhclient-script.linux code checking the interface for a tentative address. with the patch to correct this, even interfaces slow to add their tentative link-local address should correctly wait for the address to get added, and then transition from tentative to normal, and then begin the dhcpv6 process. [regression potential] errors in this function can cause dhclient to fail to get a ipv6 address for an interface; regression would happen if this patch makes it fail more than it already is failing, but would not cause other failures or problems after getting an ipv6 address; this patch will affect only startup-time. [other info] related bug 1633479 [original description] Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution. .        case " $out " in .            *\ dadfailed\ *) .                error "$dev: ipv6 dad failed." .                return 1;; .            *\ tentative\ *) :;; +      " ") +    : +    ;; .            *) return 0;; .        esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet. [impact] bug 1633479 made a change to isc-dhcp to wait for an interface's link-local ipv6 address to switch from 'tentative' to normal, because all link-local addresses briefly go through a 'tentative' state while the kernel is performing ipv6 link-local 'duplicate address detection' (DAD). While in the 'tentative' state, dhclient can't take over the interface and send out dhcpv6 requests; it must wait until DAD completes. However, the change made in that bug does not account for the case where the 'tentative' check is done before the interface has even set up a link-local address; its case statement assumes if there is no 'tentative' or 'dadfailed' string in the output, the link-local address is ready to use. When the address check finds no address at all, this will return as successful, even though it shouldn't, and dhclient will fail to get the dhcpv6 address. [test case] on a system that is configured for dhcpv6 on one or more of its interfaces, repeatedly try to get the dhcpv6 address. For interfaces that are slower to actually set up their initial tentative link-local address, they will occasionally fail, since the current code is a race between the kernel adding the tentative link-local address, and the dhclient-script.linux code checking the interface for a tentative address. with the patch to correct this, even interfaces slow to add their tentative link-local address should correctly wait for the address to get added, and then transition from tentative to normal, and then begin the dhcpv6 process. [regression potential] errors in this function can cause dhclient to fail to get a ipv6 address for an interface; regression would happen if this patch makes it fail more than it already is failing, but would not cause other failures or problems after getting an ipv6 address; this patch will affect only startup-time. additionally, the current behavior of dhclient when using an interface that has no link-local address after being brought up is to exit immediately; while after this patch dhclient will wait ~6 seconds before exiting (while waiting for the interface to get a non-tentative link-local addr). This is the point of this bug, that some NIC hw doesn't show a tentative link-local addr immediately after coming up. However, if dhclient -6 is configured to run on an interface without any link state at all (e.g. its physical cable is unplugged), then while before dhclient would exit immediately with error, it now waits 6 seconds. If the system is misconfigured like that, or if someone pulls a cable and reboots, then system boot will be delayed an extra 6 seconds. However, that short delay for misconfigured/broken systems seems acceptable to me, in exchange for allowing dhclient to work with slightly slow NIC hw. Additionally, consider that if the problem is instead no dhcpv6 server, dhclient -6 will wait a much, much longer amount of time for a dhcpv6 response before giving up. [other info] related bug 1633479 [original description] Summary: ======== If a interface does not yet have a link-local address (as it may have just been brought up), dhclient -6 <ifname> will fail. The built-in "wait for link-local address" loop does not function properly, causing DHCP failure. Discussion: =========== In trying to configure isc-dhcp-client 4.3.5-3ubuntu1 for IPv6 on Ubuntu 17.04, I was finding that on boot I was getting failures with the logged message "no link-local IPv6 address for <ifname>" I found that it took several seconds for the link-local address to be assigned when the interface came up (in this case, the ISP/modem-facing interface), and worked around it with a script that looks at   /sbin/ifconfig $IFACE | /bin/fgrep -q 'scopeid 0x20' and loops for a fixed number of times for that to be successful. On looking at /sbin/dhclient-script it appears that it *tries* to do the same thing in   # set the link up and wait for ipv6 link local dad to finish   ipv6_link_up_and_dad() this code sets   out=$(ip -6 -o address show dev "$dev" scope link) then checks it with a case statement inside of a loop for         case " $out " in             *\ dadfailed\ *)                 error "$dev: ipv6 dad failed."                 return 1;;             *\ tentative\ *) :;;             *) return 0;;         esac If there is no link-local address, $out will be empty. The default case is taken, and the loop exits immediately: $ echo "'$out'" ; case " $out " in > *\ dadfailed\ *) > echo "dadfailed" > ;; > *\ tentative\ *) > echo "tentative" > ;; > *) > echo "default" > esac '' default As a result, there is no "wait for link-local address" and when there is no link-local address, dhclient fails later on. Possible Fix: ============= Adding "the missing case" for "no address" case that continues the loop is one possible solution. .        case " $out " in .            *\ dadfailed\ *) .                error "$dev: ipv6 dad failed." .                return 1;; .            *\ tentative\ *) :;; +      " ") +    : +    ;; .            *) return 0;; .        esac At least in my situation, this prevents the failure of dhclient due to the link-local address not being "ready" yet.
2018-03-05 12:11:49 Łukasz Zemczak isc-dhcp (Ubuntu Artful): status In Progress Fix Committed
2018-03-05 12:11:54 Łukasz Zemczak tags ipv6 patch ipv6 patch verification-needed verification-needed-artful
2018-03-05 12:15:31 Łukasz Zemczak isc-dhcp (Ubuntu Xenial): status In Progress Fix Committed
2018-03-05 12:15:36 Łukasz Zemczak tags ipv6 patch verification-needed verification-needed-artful ipv6 patch verification-needed verification-needed-artful verification-needed-xenial
2018-03-05 12:16:30 Łukasz Zemczak isc-dhcp (Ubuntu Trusty): status In Progress Fix Committed
2018-03-05 12:16:36 Łukasz Zemczak tags ipv6 patch verification-needed verification-needed-artful verification-needed-xenial ipv6 patch verification-needed verification-needed-artful verification-needed-trusty verification-needed-xenial
2018-03-08 19:11:56 Dan Streetman tags ipv6 patch verification-needed verification-needed-artful verification-needed-trusty verification-needed-xenial ipv6 patch verification-done verification-done-artful verification-done-trusty verification-done-xenial
2018-03-15 08:25:38 Launchpad Janitor isc-dhcp (Ubuntu Artful): status Fix Committed Fix Released
2018-03-15 08:25:44 Łukasz Zemczak removed subscriber Ubuntu Stable Release Updates Team
2018-03-15 08:30:17 Launchpad Janitor isc-dhcp (Ubuntu Xenial): status Fix Committed Fix Released
2018-03-15 08:32:12 Launchpad Janitor isc-dhcp (Ubuntu Trusty): status Fix Committed Fix Released