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




git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3687 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-05-23 10:40:00 +00:00
parent 97f0ffdb42
commit 3f6e3a2a15
12 changed files with 75 additions and 253 deletions

View file

@ -1,3 +1,27 @@
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

View 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);
}

View file

@ -89,29 +89,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_setup_static_ip4_config
*

View file

@ -78,29 +78,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_enable_loopback
*

View 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
*

View file

@ -82,38 +82,6 @@ void nm_generic_device_flush_ip4_routes_with_iface (const char *iface)
g_free (buf);
}
/*
* 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
*

View 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;

View 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;

View 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
*

View 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;

View 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
*

View file

@ -96,30 +96,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
*