Question on udhcpc script

Bhattiprolu RaviKumar ravikumar.bhattiprolu at
Mon Feb 1 09:36:02 UTC 2021

  We are using busybox to get DHCPv6  address. However, I am bit confused
on the part of the script /etc/udhcpc.d/50default:

wait_for_ipv6_default_route() {
*        printf "Waiting for IPv6 default route to appear"*
        while [ $IF_WAIT_DELAY -gt 0 ]; do
*                if [ -z "$(ip -6 route list | grep default)" ]; then*
                        printf "\n"
                sleep 1
                printf "."
                : $((IF_WAIT_DELAY -= 1))
        printf " timeout!\n"

The print says "Waiting for IPv6 default route to appear". However the if
statement is checking for "$(ip -6 route list | grep default)"to be null
(-z check) which means default route is not present.

In our case, after DHCP, default route gets setup and "$(ip -6 route list |
grep default)"returns an entry starting with default and since check is -z,
it continues in the loop and finally prints "timeout".

I am confused here. Am I missing something here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the busybox mailing list