dhclient hang

2015-12-07 Thread Martin Pieuchot
If for some reason SIOCAIFADDR fails, exit instead of hanging.

Without this diff I need to kill dhclient(8) with ctrl+C during boot
if I happen to have the address offered by the server configured on
a different interface.

WARNING: do not try to do that on -current without my rt_delete diffs
or your kernel with panic!

Ok?

Index: kroute.c
===
RCS file: /cvs/src/sbin/dhclient/kroute.c,v
retrieving revision 1.75
diff -u -p -r1.75 kroute.c
--- kroute.c10 Feb 2015 04:20:26 -  1.75
+++ kroute.c7 Dec 2015 15:51:17 -
@@ -473,7 +473,7 @@ priv_add_address(struct imsg_add_address
/* No need to set broadcast address. Kernel can figure it out. */
 
if (ioctl(s, SIOCAIFADDR, ) == -1)
-   warning("SIOCAIFADDR failed (%s): %s", inet_ntoa(imsg->addr),
+   error("SIOCAIFADDR failed (%s): %s", inet_ntoa(imsg->addr),
strerror(errno));
 
close(s);



Re: dhclient hang

2015-12-07 Thread Kenneth Westerback
I don't understand what you mean by hang? Does it hang the box? I would
expect dhclient to reject the offer and try again. Does dhclient never try
again?

I'll take a closer look tomorrow, but if it isn't now it should be easy to
fix dhclient to try again for a different lease.

 Ken
On 7 Dec 2015 10:57, "Martin Pieuchot"  wrote:

> If for some reason SIOCAIFADDR fails, exit instead of hanging.
>
> Without this diff I need to kill dhclient(8) with ctrl+C during boot
> if I happen to have the address offered by the server configured on
> a different interface.
>
> WARNING: do not try to do that on -current without my rt_delete diffs
> or your kernel with panic!
>
> Ok?
>
> Index: kroute.c
> ===
> RCS file: /cvs/src/sbin/dhclient/kroute.c,v
> retrieving revision 1.75
> diff -u -p -r1.75 kroute.c
> --- kroute.c10 Feb 2015 04:20:26 -  1.75
> +++ kroute.c7 Dec 2015 15:51:17 -
> @@ -473,7 +473,7 @@ priv_add_address(struct imsg_add_address
> /* No need to set broadcast address. Kernel can figure it out. */
>
> if (ioctl(s, SIOCAIFADDR, ) == -1)
> -   warning("SIOCAIFADDR failed (%s): %s",
> inet_ntoa(imsg->addr),
> +   error("SIOCAIFADDR failed (%s): %s", inet_ntoa(imsg->addr),
> strerror(errno));
>
> close(s);
>


Re: dhclient hang

2015-12-07 Thread Bob Beck
I think trying again for a different lease is the right thing..  I'm
really tired of dhclient exiting for stupid reasons ;)

On Mon, Dec 7, 2015 at 3:11 PM, Kenneth Westerback
 wrote:
> I don't understand what you mean by hang? Does it hang the box? I would
> expect dhclient to reject the offer and try again. Does dhclient never try
> again?
>
> I'll take a closer look tomorrow, but if it isn't now it should be easy to
> fix dhclient to try again for a different lease.
>
>  Ken
> On 7 Dec 2015 10:57, "Martin Pieuchot"  wrote:
>
>> If for some reason SIOCAIFADDR fails, exit instead of hanging.
>>
>> Without this diff I need to kill dhclient(8) with ctrl+C during boot
>> if I happen to have the address offered by the server configured on
>> a different interface.
>>
>> WARNING: do not try to do that on -current without my rt_delete diffs
>> or your kernel with panic!
>>
>> Ok?
>>
>> Index: kroute.c
>> ===
>> RCS file: /cvs/src/sbin/dhclient/kroute.c,v
>> retrieving revision 1.75
>> diff -u -p -r1.75 kroute.c
>> --- kroute.c10 Feb 2015 04:20:26 -  1.75
>> +++ kroute.c7 Dec 2015 15:51:17 -
>> @@ -473,7 +473,7 @@ priv_add_address(struct imsg_add_address
>> /* No need to set broadcast address. Kernel can figure it out. */
>>
>> if (ioctl(s, SIOCAIFADDR, ) == -1)
>> -   warning("SIOCAIFADDR failed (%s): %s",
>> inet_ntoa(imsg->addr),
>> +   error("SIOCAIFADDR failed (%s): %s", inet_ntoa(imsg->addr),
>> strerror(errno));
>>
>> close(s);
>>