Re: [PATCH] Check for ip in ./configure



On Sat, 2006-07-08 at 08:54 +0200, Timoth�Lecomte wrote:
> Dear NetworkManager developpers,
> 
> Please find attached a patch to check for 'ip' in ./configure instead of 
> hardcoding the path by hand in each backend. Hopefully it will decrease 
> the number of differences between the backends.

Thanks; I've committed it to stable and HEAD.

> I would like to make other changes of this kind. Do you think it is 
> appropriate ?

Yes, quite appropriate.

> By the way, if somebody could explain to me the philosophy behind these 
> distro-specific backends, I will appreciate it. Do you expect each 
> distro to write a 1000+ line source code (plus the initscripts) ?
> I have found a message 
> (http://www.mail-archive.com/networkmanager-list gnome org/msg03396.html) 
> proposing a rework of the current code, but no further detail on the 
> status of this project. Any update ?
> I'd like to make NetworkManager work out-of-the-box for my distribution, 
> Sourcemage, but I think it is a pain for the distributions and for you 
> maintainers to have all those distribution-specific files.

The backends were a good idea when nobody wanted to write a lot of
netlink code to talk to netlink directly (which is what /sbin/ip does
anyway).  I personally didn't like spawning a whole new process to do
all the stuff the backends do, but that was the quickest path at the
time.  All the nm_spawn_process() stuff will eventually go away and be
replaced with libnl calls that have the same functionality, but use
netlink directly and (1) don't have the overhead of spawning a process,
and (2) have better error reporting mechanisms.

Dan

> Best regards,
> 
> Timoth�> plain text document attachment (ip.diff)
> diff -Naur old/configure.in new/configure.in
> --- old/configure.in	2006-06-07 22:39:16.000000000 +0200
> +++ new/configure.in	2006-07-08 07:25:48.000000000 +0200
> @@ -254,6 +254,19 @@
>  AC_DEFINE_UNQUOTED(WPA_SUPPLICANT_BINARY_PATH, "$WPA_SUPPLICANT_BINARY_PATH", [Define to path of wpa_supplicant binary])
>  AC_SUBST(WPA_SUPPLICANT_BINARY_PATH)
>  
> +# ip binary path
> +AC_ARG_WITH(ip, AC_HELP_STRING([--with-ip=/path/to/ip], [path to ip])) 
> +if test "x${with_ip}" = x; then
> +  AC_PATH_PROG(IP_BINARY_PATH, ip, [], $PATH:/sbin:/usr/sbin)
> +  if ! test -x "$IP_BINARY_PATH"; then
> +	AC_MSG_ERROR(iproute2 was not installed.  See http://linux-net.osdl.org/index.php/Iproute2)
> +  fi
> +else
> +  IP_BINARY_PATH="$with_ip"
> +fi
> +AC_DEFINE_UNQUOTED(IP_BINARY_PATH, "$IP_BINARY_PATH", [Define to path of ip binary])
> +AC_SUBST(IP_BINARY_PATH)
> +
>  #### find the actual value for $prefix that we'll end up with
>  ##   (I know this is broken and should be done in the Makefile, but
>  ##    that's a major pain and almost nobody actually seems to care)
> diff -Naur old/src/backends/NetworkManagerArch.c new/src/backends/NetworkManagerArch.c
> --- old/src/backends/NetworkManagerArch.c	2006-03-27 20:30:57.000000000 +0200
> +++ new/src/backends/NetworkManagerArch.c	2006-07-08 08:19:23.000000000 +0200
> @@ -29,6 +29,10 @@
>   * (C) Copyright 2004 Red Hat, Inc.
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
>  #include <stdio.h>
>  #include <sys/types.h>
>  #include <sys/socket.h>
> @@ -87,7 +91,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/usr/sbin/ip route add default dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add default dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -105,7 +109,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/usr/sbin/ip route add %s dev %s", route, iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add %s dev %s", route, iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -142,7 +146,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove routing table entries */
> -	buf = g_strdup_printf ("/usr/sbin/ip route flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -178,7 +182,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove all IP addresses for a device */
> -	buf = g_strdup_printf ("/usr/sbin/ip addr flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" addr flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -248,7 +252,7 @@
>  	temp_addr2.s_addr = broadcast;
>  	s_tmp = g_strdup (inet_ntoa (temp_addr));
>  	s_tmp2 = g_strdup (inet_ntoa (temp_addr2));
> -	buf = g_strdup_printf ("/sbin/ip addr add %s/%d brd %s dev %s label %s",
> +	buf = g_strdup_printf (IP_BINARY_PATH" addr add %s/%d brd %s dev %s label %s",
>  					   s_tmp, prefix, s_tmp2, iface, iface);
>  	g_free (s_tmp);
>  	g_free (s_tmp2);
> @@ -275,7 +279,7 @@
>  
>  	/* set the default route to be this device's gateway */
>  	temp_addr.s_addr = nm_device_config_get_ip4_gateway (dev);
> -	buf = g_strdup_printf ("/sbin/ip route replace default via %s dev %s",
> +	buf = g_strdup_printf (IP_BINARY_PATH" route replace default via %s dev %s",
>  					   inet_ntoa (temp_addr), iface);
>  	if ((err = nm_spawn_process (buf)))
>  	{
> @@ -315,7 +319,7 @@
>   */
>  void nm_system_flush_loopback_routes (void)
>  {
> -	nm_spawn_process ("/usr/sbin/ip route flush dev lo");
> +	nm_spawn_process (IP_BINARY_PATH" route flush dev lo");
>  }
>  
> 
> @@ -327,7 +331,7 @@
>   */
>  void nm_system_delete_default_route (void)
>  {
> -	nm_spawn_process ("/usr/sbin/ip route del default");
> +	nm_spawn_process (IP_BINARY_PATH" route del default");
>  }
>  
> 
> @@ -339,7 +343,7 @@
>   */
>  void nm_system_flush_arp_cache (void)
>  {
> -	nm_spawn_process ("/usr/sbin/ip neigh flush all");
> +	nm_spawn_process (IP_BINARY_PATH" neigh flush all");
>  }
>  
> 
> @@ -407,7 +411,7 @@
>  	eui[0] ^= 2;
>  
>  	/* Add the default link-local IPv6 address to a device */
> -	buf = g_strdup_printf ("/usr/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
> +	buf = g_strdup_printf (IP_BINARY_PATH" -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
>  			 eui[0], eui[1], eui[2], eui[3],
>  			 eui[4], eui[5],
>  			 eui[6], eui[7], nm_device_get_iface (dev));
> diff -Naur old/src/backends/NetworkManagerDebian.c new/src/backends/NetworkManagerDebian.c
> --- old/src/backends/NetworkManagerDebian.c	2006-03-29 21:03:01.000000000 +0200
> +++ new/src/backends/NetworkManagerDebian.c	2006-07-08 08:19:27.000000000 +0200
> @@ -23,6 +23,10 @@
>   * (C) Copyright 2004 Red Hat, Inc.
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
>  #include <stdio.h>
>  #include <sys/types.h>
>  #include <signal.h>
> @@ -79,7 +83,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add default dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -97,7 +101,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add %s dev %s", route, iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -133,7 +137,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove routing table entries */
> -	buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -169,7 +173,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove all IP addresses for a device */
> -	buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" addr flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -195,7 +199,7 @@
>   */
>  void nm_system_flush_loopback_routes (void)
>  {
> -	nm_spawn_process ("/sbin/ip route flush dev lo");
> +	nm_spawn_process (IP_BINARY_PATH" route flush dev lo");
>  }
>  
> 
> @@ -207,7 +211,7 @@
>   */
>  void nm_system_delete_default_route (void)
>  {
> -	nm_spawn_process ("/sbin/ip route del default");
> +	nm_spawn_process (IP_BINARY_PATH" route del default");
>  }
>  
> 
> @@ -219,7 +223,7 @@
>   */
>  void nm_system_flush_arp_cache (void)
>  {
> -	nm_spawn_process ("/sbin/ip neigh flush all");
> +	nm_spawn_process (IP_BINARY_PATH" neigh flush all");
>  }
>  
> 
> @@ -286,7 +290,7 @@
>    eui[0] ^= 2;
>  
>    /* Add the default link-local IPv6 address to a device */
> -  buf = g_strdup_printf ("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
> +  buf = g_strdup_printf (IP_BINARY_PATH" -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
>  			 eui[0], eui[1], eui[2], eui[3],
>  			 eui[4], eui[5],
>  			 eui[6], eui[7], nm_device_get_iface (dev));
> diff -Naur old/src/backends/NetworkManagerGentoo.c new/src/backends/NetworkManagerGentoo.c
> --- old/src/backends/NetworkManagerGentoo.c	2006-03-29 21:03:01.000000000 +0200
> +++ new/src/backends/NetworkManagerGentoo.c	2006-07-08 08:19:37.000000000 +0200
> @@ -23,6 +23,10 @@
>   * (C) Copyright 2004 Robert Paskowitz
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
>  #include <stdio.h>
>  #include <sys/types.h>
>  #include <signal.h>
> @@ -78,7 +82,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove routing table entries */
> -	buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -126,7 +130,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove all IP addresses for a device */
> -	buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" addr flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -156,7 +160,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add %s dev %s", route, iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -184,7 +188,7 @@
>  void nm_system_flush_loopback_routes (void)
>  {
>  	/* Remove routing table entries for lo */
> -	nm_spawn_process ("/sbin/ip route flush dev lo");
> +	nm_spawn_process (IP_BINARY_PATH" route flush dev lo");
>  }
>  
>  /*
> @@ -195,7 +199,7 @@
>   */
>  void nm_system_delete_default_route (void)
>  {
> -	nm_spawn_process ("/sbin/ip route del default");
> +	nm_spawn_process (IP_BINARY_PATH" route del default");
>  }
>  
>  /*
> @@ -206,7 +210,7 @@
>   */
>  void nm_system_flush_arp_cache (void)
>  {
> -	nm_spawn_process ("/sbin/ip neigh flush all");
> +	nm_spawn_process (IP_BINARY_PATH" neigh flush all");
>  }
>  
> 
> @@ -278,7 +282,7 @@
>  	eui[0] ^= 2;
>  	
>  	/* Add the default link-local IPv6 address to a device */
> -	buf = g_strdup_printf("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s", 
> +	buf = g_strdup_printf(IP_BINARY_PATH" -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s", 
>  						eui[0], eui[1], eui[2], eui[3], eui[4], eui[5], 
>  						eui[6], eui[7], nm_device_get_iface(dev));
>  	nm_spawn_process(buf);
> @@ -462,7 +466,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add default dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> diff -Naur old/src/backends/NetworkManagerRedHat.c new/src/backends/NetworkManagerRedHat.c
> --- old/src/backends/NetworkManagerRedHat.c	2006-03-29 21:03:01.000000000 +0200
> +++ new/src/backends/NetworkManagerRedHat.c	2006-07-08 08:19:43.000000000 +0200
> @@ -19,6 +19,10 @@
>   * (C) Copyright 2004 Red Hat, Inc.
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
>  #include <stdio.h>
>  #include <sys/types.h>
>  #include <signal.h>
> @@ -76,7 +80,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove routing table entries */
> -	buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -113,7 +117,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add default dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -132,7 +136,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add %s dev %s", route, iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -182,7 +186,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove all IP addresses for a device */
> -	buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" addr flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -209,8 +213,8 @@
>   */
>  void nm_system_enable_loopback (void)
>  {
> -	nm_spawn_process ("/sbin/ip link set dev lo up");
> -	nm_spawn_process ("/sbin/ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo scope host label loopback");
> +	nm_spawn_process (IP_BINARY_PATH" link set dev lo up");
> +	nm_spawn_process (IP_BINARY_PATH" addr add 127.0.0.1/8 brd 127.255.255.255 dev lo scope host label loopback");
>  }
>  
> 
> @@ -224,7 +228,7 @@
>  void nm_system_flush_loopback_routes (void)
>  {
>  	/* Remove routing table entries for lo */
> -	nm_spawn_process ("/sbin/ip route flush dev lo");
> +	nm_spawn_process (IP_BINARY_PATH" route flush dev lo");
>  }
>  
> 
> @@ -236,7 +240,7 @@
>   */
>  void nm_system_delete_default_route (void)
>  {
> -	nm_spawn_process ("/sbin/ip route del default");
> +	nm_spawn_process (IP_BINARY_PATH" route del default");
>  }
>  
> 
> @@ -248,7 +252,7 @@
>   */
>  void nm_system_flush_arp_cache (void)
>  {
> -	nm_spawn_process ("/sbin/ip neigh flush all");
> +	nm_spawn_process (IP_BINARY_PATH" neigh flush all");
>  }
>  
> 
> @@ -333,7 +337,7 @@
>  	eui[0] ^= 2;
>  
>  	/* Add the default link-local IPv6 address to a device */
> -	buf = g_strdup_printf ("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
> +	buf = g_strdup_printf (IP_BINARY_PATH" -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
>  						eui[0], eui[1], eui[2], eui[3], eui[4], eui[5],
>  						eui[6], eui[7], nm_device_get_iface (dev));
>  	nm_spawn_process (buf);
> diff -Naur old/src/backends/NetworkManagerSlackware.c new/src/backends/NetworkManagerSlackware.c
> --- old/src/backends/NetworkManagerSlackware.c	2006-03-29 21:03:01.000000000 +0200
> +++ new/src/backends/NetworkManagerSlackware.c	2006-07-08 08:19:49.000000000 +0200
> @@ -20,6 +20,10 @@
>   * (C) Copyright 2004 Narayan Newton
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
>  #include <stdio.h>
>  #include <sys/types.h>
>  #include <signal.h>
> @@ -75,7 +79,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove routing table entries */
> -	buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -111,7 +115,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove all IP addresses for a device */
> -	buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" addr flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -165,8 +169,8 @@
>   */
>  void nm_system_enable_loopback (void)
>  {
> -	nm_spawn_process ("/sbin/ip link set dev lo up");
> -	nm_spawn_process ("/sbin/ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo label loopback");
> +	nm_spawn_process (IP_BINARY_PATH" link set dev lo up");
> +	nm_spawn_process (IP_BINARY_PATH" addr add 127.0.0.1/8 brd 127.255.255.255 dev lo label loopback");
>  }
>  
> 
> @@ -178,7 +182,7 @@
>   */
>  void nm_system_delete_default_route (void)
>  {
> -	nm_spawn_process ("/sbin/ip route del default");
> +	nm_spawn_process (IP_BINARY_PATH" route del default");
>  }
>  
> 
> @@ -242,7 +246,7 @@
>  	eui[0] ^= 2;
>  
>  	/* Add the default link-local IPv6 address to a device */
> -	buf = g_strdup_printf ("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
> +	buf = g_strdup_printf (IP_BINARY_PATH" -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
>  	                       eui[0], eui[1], eui[2], eui[3], eui[4], eui[5],
>  	                       eui[6], eui[7], nm_device_get_iface (dev));
>  	nm_spawn_process (buf);
> @@ -262,7 +266,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add %s dev %s", route, iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -297,7 +301,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add default dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -313,7 +317,7 @@
>  void nm_system_flush_loopback_routes (void)
>  {
>  	/* Remove routing table entries for lo */
> -	nm_spawn_process ("/sbin/ip route flush dev lo");
> +	nm_spawn_process (IP_BINARY_PATH" route flush dev lo");
>  }
>  
>   
> @@ -325,7 +329,7 @@
>   */
>  void nm_system_flush_arp_cache (void)
>  {
> -	nm_spawn_process ("/sbin/ip neigh flush all");
> +	nm_spawn_process (IP_BINARY_PATH" neigh flush all");
>  }
>  
>  void nm_system_deactivate_all_dialup (GSList *list)
> diff -Naur old/src/backends/NetworkManagerSuSE.c new/src/backends/NetworkManagerSuSE.c
> --- old/src/backends/NetworkManagerSuSE.c	2006-05-22 17:23:42.000000000 +0200
> +++ new/src/backends/NetworkManagerSuSE.c	2006-07-08 08:19:57.000000000 +0200
> @@ -23,6 +23,10 @@
>   * (C) Copyright 2005-2006 SuSE GmbH
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
>  #include <stdio.h>
>  #include <sys/types.h>
>  #include <signal.h>
> @@ -94,7 +98,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove routing table entries */
> -	buf = g_strdup_printf ("/sbin/ip route flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -131,7 +135,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add default dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add default dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -150,7 +154,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Add default gateway */
> -	buf = g_strdup_printf ("/sbin/ip route add %s dev %s", route, iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" route add %s dev %s", route, iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -200,7 +204,7 @@
>  	g_return_if_fail (iface != NULL);
>  
>  	/* Remove all IP addresses for a device */
> -	buf = g_strdup_printf ("/sbin/ip addr flush dev %s", iface);
> +	buf = g_strdup_printf (IP_BINARY_PATH" addr flush dev %s", iface);
>  	nm_spawn_process (buf);
>  	g_free (buf);
>  }
> @@ -214,8 +218,8 @@
>   */
>  void nm_system_enable_loopback (void)
>  {
> -	nm_spawn_process ("/sbin/ip link set dev lo up");
> -	nm_spawn_process ("/sbin/ip addr add 127.0.0.1/8 brd 127.255.255.255 dev lo scope host label loopback");
> +	nm_spawn_process (IP_BINARY_PATH" link set dev lo up");
> +	nm_spawn_process (IP_BINARY_PATH" addr add 127.0.0.1/8 brd 127.255.255.255 dev lo scope host label loopback");
>  }
>  
> 
> @@ -229,7 +233,7 @@
>  void nm_system_flush_loopback_routes (void)
>  {
>  	/* Remove routing table entries for lo */
> -	nm_spawn_process ("/sbin/ip route flush dev lo");
> +	nm_spawn_process (IP_BINARY_PATH" route flush dev lo");
>  }
>  
> 
> @@ -241,7 +245,7 @@
>   */
>  void nm_system_delete_default_route (void)
>  {
> -	nm_spawn_process ("/sbin/ip route del default");
> +	nm_spawn_process (IP_BINARY_PATH" route del default");
>  }
>  
> 
> @@ -253,7 +257,7 @@
>   */
>  void nm_system_flush_arp_cache (void)
>  {
> -	nm_spawn_process ("/sbin/ip neigh flush all");
> +	nm_spawn_process (IP_BINARY_PATH" neigh flush all");
>  }
>  
> 
> @@ -341,7 +345,7 @@
>  	eui[0] ^= 2;
>  
>  	/* Add the default link-local IPv6 address to a device */
> -	buf = g_strdup_printf ("/sbin/ip -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
> +	buf = g_strdup_printf (IP_BINARY_PATH" -6 addr add fe80::%x%02x:%x%02x:%x%02x:%x%02x/64 dev %s",
>  						eui[0], eui[1], eui[2], eui[3], eui[4], eui[5],
>  						eui[6], eui[7], nm_device_get_iface (dev));
>  	nm_spawn_process (buf);
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list




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