NetworkManager r3687 - in trunk: . src src/backends
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3687 - in trunk: . src src/backends
- Date: Fri, 23 May 2008 10:40:00 +0000 (UTC)
Author: dcbw
Date: Fri May 23 10:40:00 2008
New Revision: 3687
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3687&view=rev
Log:
2008-05-23 Dan Williams <dcbw redhat com>
Patch from Benoit Boissinot <bboissin+networkmanager gmail com>
* src/NetworkManagerSystem.c
- (nm_system_device_flush_ip4_addresses_with_iface): implement with
libnl
* src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGentoo.c
src/backends/NetworkManagerMandriva.c
src/backends/NetworkManagerPaldo.c
src/backends/NetworkManagerRedHat.c
src/backends/NetworkManagerSlackware.c
src/backends/NetworkManagerSuSE.c
- (nm_system_device_flush_ip4_addresses,
nm_system_device_flush_ip4_addresses_with_iface): remove
* src/backends/NetworkManagerGeneric.c
- (nm_generic_device_flush_ip4_addresses,
nm_generic_device_flush_ip4_addresses_with_iface): remove
Modified:
trunk/ChangeLog
trunk/src/NetworkManagerSystem.c
trunk/src/backends/NetworkManagerArch.c
trunk/src/backends/NetworkManagerDebian.c
trunk/src/backends/NetworkManagerFrugalware.c
trunk/src/backends/NetworkManagerGeneric.c
trunk/src/backends/NetworkManagerGentoo.c
trunk/src/backends/NetworkManagerMandriva.c
trunk/src/backends/NetworkManagerPaldo.c
trunk/src/backends/NetworkManagerRedHat.c
trunk/src/backends/NetworkManagerSlackware.c
trunk/src/backends/NetworkManagerSuSE.c
Modified: trunk/src/NetworkManagerSystem.c
==============================================================================
--- trunk/src/NetworkManagerSystem.c (original)
+++ trunk/src/NetworkManagerSystem.c Fri May 23 10:40:00 2008
@@ -654,3 +654,54 @@
rtnl_route_put (route);
}
+/*
+ * nm_system_device_flush_ip4_addresses
+ *
+ * Flush all network addresses associated with a network device
+ *
+ */
+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_system_device_flush_ip4_addresses_with_iface
+ *
+ * Flush all network addresses associated with a network device
+ *
+ */
+void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
+{
+ struct nl_handle *nlh = NULL;
+ struct nl_cache *addr_cache = NULL;
+ int iface_idx;
+ AddrCheckData check_data;
+
+ g_return_if_fail (iface != NULL);
+ iface_idx = nm_netlink_iface_to_index (iface);
+ g_return_if_fail (iface_idx >= 0);
+
+ nlh = nm_netlink_get_default_handle ();
+ g_return_if_fail (nlh != NULL);
+
+ memset (&check_data, 0, sizeof (check_data));
+ check_data.iface = iface;
+ check_data.nlh = nlh;
+ check_data.family = AF_INET;
+ check_data.ifindex = nm_netlink_iface_to_index (iface);
+
+ addr_cache = rtnl_addr_alloc_cache (nlh);
+ if (!addr_cache)
+ return;
+ nl_cache_mngt_provide (addr_cache);
+
+ /* Remove all IP addresses for a device */
+ nl_cache_foreach (addr_cache, check_one_address, &check_data);
+
+ nl_cache_free (addr_cache);
+}
+
Modified: trunk/src/backends/NetworkManagerArch.c
==============================================================================
--- trunk/src/backends/NetworkManagerArch.c (original)
+++ trunk/src/backends/NetworkManagerArch.c Fri May 23 10:40:00 2008
@@ -90,29 +90,6 @@
}
/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
-/*
* nm_system_device_setup_static_ip4_config
*
* Set up the device with a particular IPv4 address/netmask/gateway.
Modified: trunk/src/backends/NetworkManagerDebian.c
==============================================================================
--- trunk/src/backends/NetworkManagerDebian.c (original)
+++ trunk/src/backends/NetworkManagerDebian.c Fri May 23 10:40:00 2008
@@ -79,29 +79,6 @@
}
/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
-/*
* nm_system_enable_loopback
*
* Bring up the loopback interface
Modified: trunk/src/backends/NetworkManagerFrugalware.c
==============================================================================
--- trunk/src/backends/NetworkManagerFrugalware.c (original)
+++ trunk/src/backends/NetworkManagerFrugalware.c Fri May 23 10:40:00 2008
@@ -81,38 +81,6 @@
g_free (buf);
}
-
-/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-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_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-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_system_device_has_active_routes
*
Modified: trunk/src/backends/NetworkManagerGeneric.c
==============================================================================
--- trunk/src/backends/NetworkManagerGeneric.c (original)
+++ trunk/src/backends/NetworkManagerGeneric.c Fri May 23 10:40:00 2008
@@ -83,38 +83,6 @@
}
/*
- * nm_generic_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_generic_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_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_generic_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 (IP_BINARY_PATH" -4 addr flush dev %s", iface);
- nm_spawn_process (buf);
- g_free (buf);
-}
-
-/*
* nm_generic_enable_loopback
*
* Bring up the loopback interface
Modified: trunk/src/backends/NetworkManagerGentoo.c
==============================================================================
--- trunk/src/backends/NetworkManagerGentoo.c (original)
+++ trunk/src/backends/NetworkManagerGentoo.c Fri May 23 10:40:00 2008
@@ -90,28 +90,6 @@
}
-/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
#if 0
/* Alert other computers of our new address */
temp_addr.s_addr = addr;
Modified: trunk/src/backends/NetworkManagerMandriva.c
==============================================================================
--- trunk/src/backends/NetworkManagerMandriva.c (original)
+++ trunk/src/backends/NetworkManagerMandriva.c Fri May 23 10:40:00 2008
@@ -88,31 +88,6 @@
return (FALSE);
}
-
-/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
-
#if 0
/* Alert other computers of our new address */
temp_addr.s_addr = addr;
Modified: trunk/src/backends/NetworkManagerPaldo.c
==============================================================================
--- trunk/src/backends/NetworkManagerPaldo.c (original)
+++ trunk/src/backends/NetworkManagerPaldo.c Fri May 23 10:40:00 2008
@@ -89,31 +89,6 @@
return (FALSE);
}
-
-/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
-
/*
* nm_system_enable_loopback
*
Modified: trunk/src/backends/NetworkManagerRedHat.c
==============================================================================
--- trunk/src/backends/NetworkManagerRedHat.c (original)
+++ trunk/src/backends/NetworkManagerRedHat.c Fri May 23 10:40:00 2008
@@ -87,30 +87,6 @@
}
-/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
-
#if 0
/* Alert other computers of our new address */
temp_addr.s_addr = addr;
Modified: trunk/src/backends/NetworkManagerSlackware.c
==============================================================================
--- trunk/src/backends/NetworkManagerSlackware.c (original)
+++ trunk/src/backends/NetworkManagerSlackware.c Fri May 23 10:40:00 2008
@@ -75,29 +75,6 @@
nm_generic_device_flush_ip4_routes_with_iface (iface);
}
-
-/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
/*
* nm_system_device_has_active_routes
*
Modified: trunk/src/backends/NetworkManagerSuSE.c
==============================================================================
--- trunk/src/backends/NetworkManagerSuSE.c (original)
+++ trunk/src/backends/NetworkManagerSuSE.c Fri May 23 10:40:00 2008
@@ -97,30 +97,6 @@
/*
- * nm_system_device_flush_ip4_addresses
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses (NMDevice *dev)
-{
- nm_generic_device_flush_ip4_addresses (dev);
-}
-
-
-/*
- * nm_system_device_flush_ip4_addresses_with_iface
- *
- * Flush all network addresses associated with a network device
- *
- */
-void nm_system_device_flush_ip4_addresses_with_iface (const char *iface)
-{
- nm_generic_device_flush_ip4_addresses_with_iface (iface);
-}
-
-
-/*
* nm_system_enable_loopback
*
* Bring up the loopback interface
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]