svn commit: r239356 - head/sbin/dhclient

Ian Lepore freebsd at damnhippie.dyndns.org
Fri Aug 17 17:02:17 UTC 2012


On Fri, 2012-08-17 at 15:53 +0000, John Baldwin wrote:
> Author: jhb
> Date: Fri Aug 17 15:53:43 2012
> New Revision: 239356
> URL: http://svn.freebsd.org/changeset/base/239356
> 
> Log:
>   Fix dhclient to properly exit and teardown the configured lease when
>   link is lost.  devd will start a new dhclient instance when link is
>   restored.
>   
>   PR:		bin/166656
>   Submitted by:	Peter Jeremy (mostly)
>   Reviewed by:	brooks (earlier version from Peter)
>   MFC after:	1 month
> 
> Modified:
>   head/sbin/dhclient/dhclient.c
> 
> Modified: head/sbin/dhclient/dhclient.c
> ==============================================================================
> --- head/sbin/dhclient/dhclient.c	Fri Aug 17 14:22:56 2012	(r239355)
> +++ head/sbin/dhclient/dhclient.c	Fri Aug 17 15:53:43 2012	(r239356)
> @@ -278,6 +278,11 @@ routehandler(struct protocol *p)
>  			    ifi->name);
>  			goto die;
>  		}
> +		if (!interface_link_status(ifi->name)) {
> +			warning("Interface %s is down, dhclient exiting",
> +			    ifi->name);
> +			goto die;
> +		}
>  		break;
>  	case RTM_IFANNOUNCE:
>  		ifan = (struct if_announcemsghdr *)rtm;
> @@ -316,6 +321,8 @@ routehandler(struct protocol *p)
>  
>  die:
>  	script_init("FAIL", NULL);
> +	if (ifi->client->active)
> +		script_write_params("old_", ifi->client->active);
>  	if (ifi->client->alias)
>  		script_write_params("alias_", ifi->client->alias);
>  	script_go();

I think the attached patch should give the same result without needing
to create/destroy a socket to check the link status every time a routing
info message arrives.  I've actually had this patch in my head for
several years, I just hadn't gotten around to submitting it yet.

-- Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhclient.diff
Type: text/x-patch
Size: 490 bytes
Desc: 
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20120817/64ee4aa4/dhclient.bin


More information about the svn-src-head mailing list