2008-05-23 Dan Williams <dcbw@redhat.com>
authorDan Williams <dcbw@redhat.com>
Fri, 23 May 2008 10:40:00 +0000 (10:40 +0000)
committerDan Williams <dcbw@redhat.com>
Fri, 23 May 2008 10:40:00 +0000 (10:40 +0000)
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

git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3687 4912f4e0-d625-0410-9fb7-b9a5a253dbdc

12 files changed:
ChangeLog
src/NetworkManagerSystem.c
src/backends/NetworkManagerArch.c
src/backends/NetworkManagerDebian.c
src/backends/NetworkManagerFrugalware.c
src/backends/NetworkManagerGeneric.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

index 6926a19..26399d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 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
+
+2008-05-23  Dan Williams  <dcbw@redhat.com>
+
        * src/supplicant-manager/nm-supplicant-settings-verify.c
                - Switch 'bssid' from bytes to keyword type
                - (validate_type_keyword): allow NULL keyword lists
index 1287e57..80acebc 100644 (file)
@@ -654,3 +654,54 @@ out:
        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);
+}
+
index f9cad1e..a0462f5 100644 (file)
@@ -90,29 +90,6 @@ void nm_system_device_flush_ip4_routes_with_iface (const char *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_setup_static_ip4_config
  *
  * Set up the device with a particular IPv4 address/netmask/gateway.
index 7a8e483..51528f8 100644 (file)
@@ -79,29 +79,6 @@ void nm_system_device_flush_ip4_routes_with_iface (const char *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_enable_loopback
  *
  * Bring up the loopback interface
index 8d6ee0d..2e72b69 100644 (file)
@@ -81,38 +81,6 @@ void nm_system_device_flush_ip4_routes_with_iface (const char *iface)
        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
  *
index 8c0f194..c16d2ee 100644 (file)
@@ -83,38 +83,6 @@ void nm_generic_device_flush_ip4_routes_with_iface (const char *iface)
 }
 
 /*
- * 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
index eec4848..a6ac548 100644 (file)
@@ -90,28 +90,6 @@ gboolean nm_system_device_has_active_routes (NMDevice *dev)
 }
 
 
-/*
- * 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;
index 31a05b7..9db21c8 100644 (file)
@@ -88,31 +88,6 @@ gboolean nm_system_device_has_active_routes (NMDevice *dev)
        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;
index 5ea5287..c6f2352 100644 (file)
@@ -89,31 +89,6 @@ gboolean nm_system_device_has_active_routes (NMDevice *dev)
        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
  *
index 33908d7..f0f3921 100644 (file)
@@ -87,30 +87,6 @@ gboolean nm_system_device_has_active_routes (NMDevice *dev)
 }
 
 
-/*
- * 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;
index 3e2d3d5..32ea6c0 100644 (file)
@@ -75,29 +75,6 @@ void nm_system_device_flush_ip4_routes_with_iface (const char *iface)
        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
  *
index 7af55a0..303fb0a 100644 (file)
@@ -97,30 +97,6 @@ gboolean nm_system_device_has_active_routes (NMDevice *dev)
 
 
 /*
- * 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