Re: dhclient vs dhcpcd selection is broken



On Thursday 24 of June 2010 22:42:21 27/249 wrote:
> Hi guys!
> 
> I'm currently maintaining NetworkManager package in AgiliaLinux, and
> when updating to 0.8.0.998 I discovered a bug.
> This distro uses dhcpcd as default DHCP client, but there is also
> dhclient v3 on some configurations.
> I configured NM as --with-dhclient=no --with-dhcpcd=/sbin/dhcpcd, but
> NetworkManager tried to use dhclient anyway, and fails, because it
> requires v4 (it seems to be incompatible with v3).
> 
> I resolved the problem with the patch:
> 
> --- a/src/dhcp-manager/nm-dhcp-dhclient.c	2010-05-22 22:35:03.000000000
> +0400 +++ b/src/dhcp-manager/nm-dhcp-dhclient.c	2010-06-25
> 00:22:47.618906714 +0400 @@ -64,7 +64,8 @@
>  const char *
>  nm_dhcp_dhclient_get_path (const char *try_first)
>  {
> -	static const char *dhclient_paths[] = {
> +	return NULL; // Never use dhclient
> +/*	static const char *dhclient_paths[] = {
>  		"/sbin/dhclient",
>  		"/usr/sbin/dhclient",
>  		"/usr/pkg/sbin/dhclient",
> @@ -83,6 +84,7 @@
>  	}
> 
>  	return *path;
> +	*/
>  }
> 
>  static char *
> 
> Of course it is a dirty hack, but while I don't need dhclient support,
> it works for me, but it will be better if you fix it in more elegant
> and flexible way.

NetworkManager has two levels of DHCP client detection: build and runtime.
While building you can check and define paths for DHCP clients.
With your configuration (--with-dhclient=no --with-dhcpcd=/sbin/dhcpcd), you 
don't need dhclient to be present and there will be no default path for 
dhclient built into the binary. For dhcpcd, /sbin/dhcpcd will be used as the 
default path at runtime.

At runtime, the used DHCP client can be configured in NetworkManager.conf (man 
NetworkManager.conf) via dhcp key in [main] section.
You can specify either dhclient of dhcpcd here. When the key is missing, 
dhclient is searched for first and then dhcpcd. The paths from the build are 
tried in the first place.

So, for your case, use this in NetworkManager.conf:
[main]
dhcp=dhcpcd

Jirka


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]