Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Feb 2019 23:05:31 -0800
From:      Ryan Moeller <ryan@ixsystems.com>
To:        Nash Kaminski <nashkaminski@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: dhclient appears to misinterpret the exit status of dhclient-script
Message-ID:  <478FCAF0-6263-4E6B-80C2-1C11BDA04F70@ixsystems.com>
In-Reply-To: <CAEF9=Z7Rz58uyic3bBtMJgy5Zv1feFtL1BJdcu7XP_N=uVoosg@mail.gmail.com>
References:  <CAEF9=Z7Rz58uyic3bBtMJgy5Zv1feFtL1BJdcu7XP_N=uVoosg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Nice catch! Apparently this was fixed in OpenBSD 11 years ago, before =
they nuked the whole script thing.
=
https://github.com/openbsd/src/commit/b215a882fd7e98ff38505d62bfc539bee124=
e0ee

> On Feb 7, 2019, at 6:45 PM, Nash Kaminski <nashkaminski@gmail.com> =
wrote:
>=20
> Hello,
>=20
> I have been attempting to debug a peculiar issue with dhclient on a
> vanilla FreeBSD 11.2 system where it appears that even if
> dhclient-script returns nonzero when invoked in response to a protocol
> timeout, dhclient continues as if the address was bound successfully,
> as opposed to the protocol being restarted after the defined retry
> interval.
>=20
> After some investigation, it appears that the root cause of this
> behavior is a result of the lower byte of the exit status being
> returned, instead of the upper byte containing the return code, on
> line 2319 of sbin/dhclient/dhclient.c (Ref:
> =
https://github.com/freebsd/freebsd/blob/releng/11.2/sbin/dhclient/dhclient=
.c#L2319).
>=20
> Making the following change makes dhclient behave as expected. Am I
> missing something or is there indeed a significant bug here?
>=20
> Index: sbin/dhclient/dhclient.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- sbin/dhclient/dhclient.c    (revision 342377)
> +++ sbin/dhclient/dhclient.c    (working copy)
> @@ -2316,7 +2316,7 @@
>        if (ip)
>                script_flush_env(ip->client);
>=20
> -       return (wstatus & 0xff);
> +       return WEXITSTATUS(wstatus);
>=20
> }
>=20
>=20
> - Nash
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?478FCAF0-6263-4E6B-80C2-1C11BDA04F70>