[PATCH] Move Frugalware backend closer to the generic backend



I'm not using Frugalware, but it calls /usr/sbin/ip directly to do the
same stuff as the generic backend, this patch move the Frugalware
backend closer to the generic implementation.

regards,

Benoit

diff -r 433564361ff1 src/backends/NetworkManagerFrugalware.c
--- a/src/backends/NetworkManagerFrugalware.c	Tue Apr 15 17:53:53 2008 -0400
+++ b/src/backends/NetworkManagerFrugalware.c	Tue Apr 15 18:56:27 2008 -0400
@@ -48,6 +48,7 @@
  */
 void nm_system_init (void)
 {
+	nm_generic_init ();
 }
 
 /*
@@ -58,9 +59,7 @@
  */
 void nm_system_device_flush_ip4_routes (NMDevice *dev)
 {
-	g_return_if_fail (dev != NULL);
-
-	nm_system_device_flush_ip4_routes_with_iface (nm_device_get_iface (dev));
+	nm_generic_device_flush_ip4_routes (dev);
 }
 
 /*
@@ -71,14 +70,7 @@
  */
 void nm_system_device_flush_ip4_routes_with_iface (const char *iface)
 {
-	char	*buf;
-
-	g_return_if_fail (iface != NULL);
-
-	/* Remove routing table entries */
-	buf = g_strdup_printf ("/usr/sbin/ip -4 route flush dev %s", iface);
-	nm_spawn_process (buf);
-	g_free (buf);
+	nm_generic_device_flush_ip4_routes_with_iface (iface);
 }
 
 
@@ -90,9 +82,7 @@
  */
 void nm_system_device_flush_ip4_addresses (NMDevice *dev)
 {
-	g_return_if_fail (dev != NULL);
-
-	nm_system_device_flush_ip4_addresses_with_iface (nm_device_get_iface (dev));
+	nm_generic_device_flush_ip4_addresses (dev);
 }
 
 /*
@@ -103,14 +93,7 @@
  */
 void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
 {
-	char	*buf;
-
-	g_return_if_fail (iface != NULL);
-
-	/* Remove all IP addresses for a device */
-	buf = g_strdup_printf ("/usr/sbin/ip -4 addr flush dev %s", iface);
-	nm_spawn_process (buf);
-	g_free (buf);
+	nm_generic_device_flush_ip4_addresses_with_iface (iface);
 }
 
 /*
@@ -186,14 +169,7 @@
  */
 void nm_system_device_add_route_via_device_with_iface (const char *iface, const char *route)
 {
-	char	*buf;
-
-	g_return_if_fail (iface != NULL);
-
-	/* Add default gateway */
-	buf = g_strdup_printf ("/usr/sbin/ip route add %s dev %s", route, iface);
-	nm_spawn_process (buf);
-	g_free (buf);
+	nm_generic_device_add_route_via_device_with_iface (iface, route);
 }
 
 
@@ -221,7 +197,7 @@
  */
 void nm_system_flush_loopback_routes (void)
 {
-	nm_system_device_flush_ip4_routes_with_iface ("lo");
+	nm_generic_flush_loopback_routes ();
 }
 
  
@@ -233,7 +209,7 @@
  */
 void nm_system_flush_arp_cache (void)
 {
-	nm_spawn_process ("/usr/sbin/ip neigh flush all");
+	nm_generic_flush_arp_cache ();
 }
 
 /*

-- 
:wq


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