Files
NetworkManager/src/backends/NetworkManagerDebian.c
Dan Williams 54aac18883 2008-04-07 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
		- Remove the DOWN and CANCELLED device states
		- Add UNMANAGED and UNAVAILABLE device states
		- Document the device states

	* introspection/nm-device.xml
	  src/nm-device-interface.c
	  src/nm-device-interface.h
		- Add the 'managed' property

	* test/nm-tool.c
		- (detail_device): print out device state

	* src/NetworkManagerSystem.h
	  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_get_system_config, nm_system_device_get_disabled
		   nm_system_device_free_system_config): remove; they were unused and
			their functionality should be re-implemented in each distro's
			system settings service plugin 

	* src/nm-gsm-device.c
	  src/nm-gsm-device.h
	  src/nm-cdma-device.c
	  src/nm-cdma-device.h
		- (*_new): take the 'managed' argument

	* src/nm-device.c
		- (nm_device_set_address): remove, fold into nm_device_bring_up()
		- (nm_device_init): start in unmanaged state, not disconnected
		- (constructor): don't start device until the system settings service
			has had a chance to figure out if the device is managed or not
		- (nm_device_deactivate, nm_device_bring_up, nm_device_bring_down):
			don't set device state here, let callers handle that as appropriate
		- (nm_device_dispose): don't touch the device if it's not managed
		- (set_property, get_property, nm_device_class_init): implement the
			'managed' property
		- (nm_device_state_changed): bring the device up if its now managed,
			and deactivate it if it used to be active
		- (nm_device_get_managed, nm_device_set_managed): do the right thing
			with the managed state

	* src/nm-hal-manager.c
		- (wired_device_creator, wireless_device_creator, modem_device_creator):
			take initial managed state and pass it along to device constructors
		- (create_device_and_add_to_list): get managed state and pass to
			type creators

	* src/nm-device-802-11-wireless.c
		- (real_can_activate): fold in most of
			nm_device_802_11_wireless_can_activate()
		- (can_scan): can't scan in UNAVAILABLE or UNMANAGED
		- (link_timeout_cb): instead of deactivating, change device state and
			let the device state handler to it
		- (real_update_hw_address): clean up
		- (state_changed_cb): when entering UNAVAILABLE state, schedule an idle
			handler to transition to DISCONNECTED if the device isn't rfkilled

	* src/nm-device-802-3-ethernet.c
		- (set_carrier): move above callers and get rid of prototype
		- (device_state_changed): when entering UNAVAILABLE state, schedule an
			idle handler to transition to DISCONNECTED if the device has a
			carrier
		- (real_update_hw_address): clean up
		- (link_timeout_cb, ppp_state_changed): change state instead of calling
			deactivation directly as deactivation doesn't change state anymore

	* src/NetworkManagerPolicy.c
		- (schedule_activate_check): yay, remove wireless_enabled hack since
			the NMManager and wireless devices work that out themselves now
		- (device_state_changed): change to a switch and update for new device
			states
		- (device_carrier_changed): remove; device handles this now through
			state changes
		- (device_added): don't care about carrier any more; the initial
			activation check will happen when the device transitions to
			DISCONNECTED

	* src/nm-manager.c
		- (dispose): clear unmanaged devices
		- (handle_unmanaged_devices): update unmanaged device list and toggle
			the managed property on each device when needed
		- (system_settings_properties_changed_cb): handle signals from the
			system settings service
		- (system_settings_get_unmanaged_devices_cb): handle callback from
			getting the unmanaged device list method call
		- (query_unmanaged_devices): ask the system settings service for its
			list of unmanaged devices
		- (nm_manager_name_owner_changed, initial_get_connections): get unmanaged
			devices
		- (manager_set_wireless_enabled): push rfkill state down to wireless
			devices directly and let them handle the necessary state transitions
		- (manager_device_state_changed): update for new device states
		- (nm_manager_add_device): set initial rfkill state on wireless devices
		- (nm_manager_remove_device): don't touch the device if it's unmanaged
		- (nm_manager_activate_connection): return error if the device is
			unmanaged
		- (nm_manager_sleep): handle new device states correctly; don't change
			the state of unavailable/unmanaged devices

	* libnm-glib/nm-device-802-11-wireless.c
		- (state_changed_cb): update for new device states



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3540 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-04-08 02:58:02 +00:00

257 lines
5.0 KiB
C

/* NetworkManager -- Network link manager
*
* Matthew Garrett <mjg59@srcf.ucam.org>
*
* Heavily based on NetworkManagerRedhat.c by Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Tom Parker
* (C) Copyright 2004 Matthew Garrett
* (C) Copyright 2004 Red Hat, Inc.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include "NetworkManagerGeneric.h"
#include "NetworkManagerSystem.h"
#include "NetworkManagerUtils.h"
#include "nm-device.h"
#include "nm-device-802-3-ethernet.h"
#include "nm-device-802-11-wireless.h"
#include "interface_parser.h"
#include "nm-utils.h"
#define ARPING "/usr/sbin/arping"
/*
* nm_system_init
*
* Initializes the distribution-specific system backend
*
*/
void nm_system_init (void)
{
nm_generic_init ();
}
/*
* nm_system_device_replace_default_route
*
* Add default route to the given device
*
*/
void
nm_system_device_replace_default_route (const char *iface,
guint32 gw,
guint32 mss)
{
nm_generic_device_replace_default_route (iface, gw, mss);
}
/*
* nm_system_device_add_route_via_device_with_iface
*
* Add route to the given device
*
*/
void nm_system_device_add_route_via_device_with_iface (const char *iface, const char *route)
{
nm_generic_device_add_route_via_device_with_iface (iface, route);
}
/*
* nm_system_device_flush_addresses
*
* Flush all network addresses associated with a network device
*
*/
void nm_system_device_flush_routes (NMDevice *dev)
{
nm_generic_device_flush_routes (dev);
}
/*
* nm_system_device_flush_routes_with_iface
*
* Flush all routes associated with a network device
*
*/
void nm_system_device_flush_routes_with_iface (const char *iface)
{
nm_generic_device_flush_routes_with_iface (iface);
}
/*
* nm_system_device_flush_addresses
*
* Flush all network addresses associated with a network device
*
*/
void nm_system_device_flush_addresses (NMDevice *dev)
{
nm_generic_device_flush_addresses (dev);
}
/*
* nm_system_device_flush_addresses_with_iface
*
* Flush all network addresses associated with a network device
*
*/
void nm_system_device_flush_addresses_with_iface (const char *iface)
{
nm_generic_device_flush_addresses_with_iface (iface);
}
/*
* nm_system_enable_loopback
*
* Bring up the loopback interface
*
*/
void nm_system_enable_loopback (void)
{
nm_spawn_process ("/sbin/ifup lo");
}
/*
* nm_system_flush_loopback_routes
*
* Flush all routes associated with the loopback device, because it
* sometimes gets the first route for ZeroConf/Link-Local traffic.
*
*/
void nm_system_flush_loopback_routes (void)
{
nm_generic_flush_loopback_routes ();
}
/*
* nm_system_flush_arp_cache
*
* Flush all entries in the arp cache.
*
*/
void nm_system_flush_arp_cache (void)
{
nm_generic_flush_arp_cache ();
}
/*
* nm_system_kill_all_dhcp_daemons
*
* Kill all DHCP daemons currently running, done at startup.
*
*/
void nm_system_kill_all_dhcp_daemons (void)
{
nm_spawn_process ("/usr/bin/killall -q dhclient");
}
/*
* nm_system_update_dns
*
* Make glibc/nscd aware of any changes to the resolv.conf file by
* restarting nscd.
*
*/
void nm_system_update_dns (void)
{
nm_spawn_process ("/usr/sbin/invoke-rc.d nscd restart");
}
/*
* nm_system_restart_mdns_responder
*
* Restart the multicast DNS responder so that it knows about new
* network interfaces and IP addresses.
*
*/
void nm_system_restart_mdns_responder (void)
{
nm_spawn_process ("/usr/bin/killall -q -USR1 mDNSResponder");
}
/*
* nm_system_device_add_ip6_link_address
*
* Add a default link-local IPv6 address to a device.
*
*/
void nm_system_device_add_ip6_link_address (NMDevice *dev)
{
nm_generic_device_add_ip6_link_address (dev);
}
/*
* nm_system_activate_nis
*
* set up the nis domain and write a yp.conf
*
*/
void nm_system_activate_nis (NMIP4Config *config)
{
}
/*
* nm_system_shutdown_nis
*
* shutdown ypbind
*
*/
void nm_system_shutdown_nis (void)
{
}
/*
* nm_system_set_hostname
*
* set the hostname
*
*/
void nm_system_set_hostname (NMIP4Config *config)
{
}
/*
* nm_system_should_modify_resolv_conf
*
* Can NM update resolv.conf, or is it locked down?
*/
gboolean nm_system_should_modify_resolv_conf (void)
{
return TRUE;
}