Commit Graph

188 Commits

Author SHA1 Message Date
Dan Williams
89af61f73c core: better matching of rfkill types
This also fixes a bug where WWAN devices were not correctly
recognized for enable/disable operations.
2010-03-25 11:36:19 -07:00
Dan Williams
9e627d1bce trivial: rename some CamelCase source files to not-camel-case 2010-03-02 15:06:14 -08:00
Dan Williams
35c4b97d7d dhcp6: first stab at autoconf otherconf/managed mode support 2010-01-27 16:20:09 -08:00
Dan Williams
fbe413cbcd dhcp: ensure DHCP client is stopped on timeout 2010-01-15 12:50:38 -08:00
Dan Williams
f9bd97020d ipv6: push router advertisement flags to listeners 2010-01-14 22:57:51 -08:00
Dan Williams
a9e32f3c3b dhcp: add initial DHCPv6 support (managed mode only) 2010-01-14 00:45:10 -08:00
Dan Williams
9e805187cd core: rename some DHCPv4 specific variables 2010-01-13 18:06:05 -08:00
Dan Williams
2a718bbb1b core: simplify DHCP setup and cleanup
nm_device_set_use_dhcp() and nm_device_get_use_dhcp() were somewhat
confusing and don't really reflect the new DHCP architecture with
NMDHCPClient.  Now that timeout and state signals are specific to
the NMDHCPClient it doesn't make sense to check for DHCP use
in the callbacks for those signals since they'll never get called
if DHCP isn't in use.  We might as well just keep the DHCP manager
around and check whether a DHCP client instance exists when we need
to figure out whether DHCP is in use.
2010-01-13 17:59:54 -08:00
Dan Williams
fe62e59c7e dhcp: add DHCPv6 functionality 2010-01-13 16:51:20 -08:00
Dan Williams
1806235049 dhcp: convert dhcp backends to classes 2010-01-12 22:09:28 -08:00
Dan Williams
d997785db3 dhcp6: genericize DHCP client tracking
Since the same interface could be used for both	DHCPv4 and DHCPv6 we
can't just use 'iface' for tracking DHCP client lease changes.  Instead
use a generated client ID, and track DHCP events based on the client's
PID instead of interface name.
2010-01-08 17:16:05 -08:00
Dan Williams
3ee1eb7a6c dhcp6: add dhclient ipv6 states 2010-01-08 15:22:11 -08:00
Dan Williams
23fec8dc72 ip6: save the accept_ra value and re-set it when the device is deactivated 2009-10-19 15:38:21 -07:00
Dan Williams
442dc676ef ip6: use device's IP interface, not its physical interface 2009-10-19 14:05:36 -07:00
Dan Williams
aa7bb93968 core: spacing fix 2009-09-28 10:49:55 -07:00
Dan Williams
99fb844657 core: device disconnection cleanups
Return an error when trying to disconnect an already-disconnected
or deactivated device.
2009-09-18 09:05:11 -07:00
Alexander Sack
2be94b44c3 core: implement manual disconnect feature
In the past networkmanager did not allow to manually disconnect devices.

Manually disconnected devices will not be automatically reconnected until one
of the following events occur:
 1. user activates a connection for the currently disconnected device
 2. network manager awakes from hibernate/suspend
 3. network manager is restarted (e.g. reboot)

Add a Disconnect method to generic NMDevice dbus interface; set a new private
autoconnect_inhibit flag if Disconnect method is called through dbus.
Based on this auto activation for devices gets inhibited until one
of the above events occur.
2009-09-18 17:06:48 +02:00
Dan Williams
7a2e2cfda3 core: rename nm_device_can_activate -> nm_device_is_available
Becuase when the device is in >= DISCONNECTED state, that already
means it can activate if a connection is available.
2009-09-14 13:33:06 -07:00
Dan Williams
393bdd3737 core: generalize unavailable -> disconnected delayed transition
Instead of doing this in every device subclass, do it in the NMDevice
superclass.  nm_device_can_activate() already did the same logic that
each of the subclass device_state_changed() handlers were doing to
figure out whether they could do the transition from unavailable
to disconnected, so just use that in NMDevice and kill lots of code.
2009-09-14 13:24:29 -07:00
Dan Winship
7344cc186d Add NMIP6Manager to handle IPv6 addrconf
Automatic IPv6 configuration is handled by the kernel, but to
integrate it properly with NetworkManager, we need to watch what the
kernel does to see whether or not it was successful (so that we can
let the user know if there is no IPv6 router present, for example).
NMIP6Manager takes care of this.
2009-08-26 14:37:45 -04:00
Alexander Sack
b6637b2053 core: make sure device interfaces are up before ip4 configuration 2009-08-20 21:02:17 +02:00
Dan Williams
c2fb1f850a gsm/bt: fix merge of user-defined IPv4 settings 2009-08-17 19:48:42 -05:00
Dan Williams
78bb1c01b7 core: implement connection assumption
Mark activation requests that contain connections to be assumed,
and use that to short-circuit various parts of the activation
process by not touching various device attributes, since they
are already set up.  Also ensure the device is not deactivated
when it initially becomes managed, because that would kill the
connection we are about to assume.
2009-08-05 18:03:09 -04:00
Dan Williams
4802094985 Merge commit 'origin/master' into iscsi 2009-08-05 15:46:11 -04:00
Dan Williams
f2eb3dea65 core: base infrastructure for connection assumption
Figure out what connections can be assumed when a device is added,
and on shutdown don't blow away connections that can be assumed on
NM restart.
2009-08-03 17:15:03 -04:00
Dan Winship
fc8e609784 Initial IPv6 support (only handles "manual" and "ignore" currently) 2009-07-29 21:35:01 -04:00
Daniel Drake
8f0652a9f0 core: allow devices to suppress other device's autoconnect
This allows a device (or a companion) to signal that it is not a good
time for a specific device to autoconnect to a network.

The OLPC mesh device will use this to prevent automatic connection
to WLAN networks while the mesh device is active.
2009-07-15 17:22:10 -04:00
Daniel Drake
3fe8d0eed4 core: allow devices to specify a DHCP anycast address
Relevant only for OLPC at this point; the mesh device uses it to
target DHCP requests at a pre-defined mesh portal anycast address.
2009-07-15 13:53:49 -04:00
Daniel Drake
0f56957b77 core: allow device subclasses to override DHCP timeout 2009-07-15 13:48:28 -04:00
Dan Williams
be9bc944d4 core: fix setting device type during device creation 2009-07-07 22:25:58 -04:00
Dan Williams
b62ff36e33 core: get rid of nm_device_set_device_type() 2009-07-07 14:57:05 -04:00
Dan Williams
fa2bde265e core: kill nm_print_device_capabilities() 2009-07-07 14:38:55 -04:00
Dan Williams
a0629647e2 core: use NMDevicePrivate everywhere 2009-07-07 14:34:01 -04:00
Dan Williams
3cdb0f6c7a core: add a 'type-desc' property to NMDeviceInterface and use it
instead of littering the code with NM_IS_*.
2009-07-07 14:24:12 -04:00
Dan Williams
c9067d8fed everything: use libgudev instead of HAL; merge NM and nm-system-settings
The only thing that doesn't work yet is the system-settings service's
"auto eth" connections for ethernet devices that don't have an existing
connection.  Might also have issues with unmanaged devices that can't
provide a MAC address until they are brought up, but we'll see.
2009-06-11 00:39:12 -04:00
Dan Williams
027ef78682 core: actually emit reason for device state changes
Found by 代尔欣 <daierxin@gmail.com>
2009-05-12 12:05:47 -04:00
Dan Williams
756bc70402 dhcp: (dhclient) use per-connection leasefiles and don't delete on deactivate
So that leases are actually useful...
2009-05-03 00:51:09 -04:00
Dan Williams
e5146b8f82 core: fix case of unmanaged device being managed at startup (rh #494527)
device_start() would unconditionally transition the device to UNAVAILABLE
no matter what the initial managed setting was.  There was a short window
for a race with HAL where device_start() wouldn't get canceled if HAL
was starting up in parallel with NetworkManager.
2009-04-11 08:10:55 -04:00
Dan Williams
f0e3bf658e core: don't schedule same activation stage multiple times
Fix issues with crappy wifi drivers which send a stream of associate
events before NM can schedule the next activation stage, which actually
scheduled *multiple* next stages.  Only allow one stage to be scheduled at
at time, and don't schedule the same stage again if it's already next up
to the plate.
2009-03-23 17:39:34 -04:00
Dan Williams
31539034b3 core: fix segfault when device's IP4Config object isn't ready (rh #491620) 2009-03-23 14:38:33 -04:00
Dan Williams
f2e8870338 dhcp: handle classless static routes (bgo #567246)
Based on patches by Johan Bilien <jobi@via.ecp.fr>,
nick loeve <trickie@gmail.com>, and Roy Marples <roy@marples.name>
with significant changes for dhclient formatting and test cases.

Note that dhclient needs help before it can actually parse
classless static routes by adding the following to the
dhclient.conf file:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
2009-01-18 23:19:09 -05:00
Jan Kantert
4ca66db721 Use g_timeout_add_seconds() to reduce wakeups
(and refine the older glib compat mechanism, by Dan)
2008-12-31 18:57:36 -05:00
Dan Williams
c47cdcf0e7 2008-11-19 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting.h
	  libnm-util/nm-setting.c
	  src/nm-device.c
	  src/nm-manager.c
	  system-settings/plugins/ifcfg-fedora/plugin.c
		- Prefix compare flag defines with NM_SETTING_



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4299 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-19 16:20:47 +00:00
Dan Williams
214114fb2d 2008-11-07 Dan Williams <dcbw@redhat.com>
Fix deletion of VPN gateway route on DHCP renew (bgo #558133)

	* src/NetworkManagerSystem.c
	  src/NetworkManagerSystem.h
		- (nm_system_device_set_ip4_route): return the route that was added
		- (nm_system_add_ip4_vpn_gateway_route): make add_vpn_gateway_route()
			public, clean up, and return the route that was added
		- (nm_system_apply_ip4_config): remove VPN related stuff to simplify,
			since nm_system_add_ip4_vpn_gateway_route() is now available; add
			flags to allow only certain attributes of the NMIP4Config to be
			applied

	* src/nm-device.c
		- (handle_dhcp_lease_change): don't touch the DHCP4 config on failure
		- (nm_device_set_ip4_config): use nm_ip4_config_diff() to only apply
			what's really changed between the old and new configs; don't export
			the new IP4 config on failure; always send the DNS info to the
			named manager

	* src/vpn-manager/nm-vpn-connection.c
		- (device_ip4_config_changed, nm_vpn_connection_new, dispose): track the
			parent device's IP4Config and re-add the VPN gateway route when it
			changes
		- (nm_vpn_connection_ip4_config_get): add the VPN gateway route (since
			nm_system_apply_ip4_config() no longer does) and cache it for later
		- (connection_state_changed): move cleanup code to its own function
		- (vpn_cleanup): delete any previously added VPN gateway route; and
			re-apply the parent device's addresses and routes using
			nm_system_apply_ip4_config(), not nm_device_set_ip4_config()



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4277 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-07 13:57:39 +00:00
Dan Williams
24e50f7f6f 2008-11-02 Dan Williams <dcbw@redhat.com>
* Add license headers to everything in src/



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4247 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-11-03 04:13:42 +00:00
Dan Williams
4129798d51 2008-10-30 Dan Williams <dcbw@redhat.com>
* src/nm-device-ethernet.c
	  src/nm-device-wifi.c
	  src/nm-device.c
	  src/ppp-manager/nm-ppp-manager.c
		- Harmonize return checking of ioctl

	* system-settings/plugins/ifcfg-fedora/reader.c
		- (is_wireless_device): fall back to SIOCGIWNAME (rh #466340)



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4236 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-30 05:52:20 +00:00
Dan Williams
bfb7243663 2008-10-29 Dan Williams <dcbw@redhat.com>
* libnm-util/libnm-util.ver
	  libnm-util/nm-setting-ip4-config.c
	  libnm-util/nm-setting-ip4-config.h
		- Make properties private and add accessor functions

	* callouts/nm-dispatcher-action.c
	  libnm-glib/libnm-glib-test.c
	  libnm-util/nm-utils.c
	  src/NetworkManagerPolicy.c
	  src/NetworkManagerSystem.c
	  src/NetworkManagerUtils.c
	  src/dhcp-manager/nm-dhcp-dhclient.c
	  src/dhcp-manager/nm-dhcp-manager.c
	  src/dnsmasq-manager/nm-dnsmasq-manager.c
	  src/nm-device-wifi.c
	  src/nm-device.c
	  src/nm-hso-gsm-device.c
	  src/nm-ip4-config.c
	  src/nm-ip4-config.h
	  src/ppp-manager/nm-ppp-manager.c
	  src/vpn-manager/nm-vpn-connection.c
	  system-settings/plugins/ifcfg-fedora/reader.c
	  system-settings/plugins/ifcfg-suse/parser.c
	  system-settings/plugins/ifcfg-suse/plugin.c
	  system-settings/plugins/ifupdown/parser.c
	  test/nm-tool.c
	  vpn-daemons/vpnc/properties/nm-vpnc.c
		- Use IP4 accessor functions



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4233 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-29 14:35:25 +00:00
Dan Williams
817deade70 2008-10-22 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerSystem.c
	  src/nm-device.c
		- Use the device's IP interface where appropriate (Per Hallsmark)



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4206 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-22 16:32:13 +00:00
Dan Williams
f078992e4d 2008-10-11 Dan Williams <dcbw@redhat.com>
* include/NetworkManager.h
	  introspection/nm-device.xml
	  include/NetworkManagerVPN.h
		- Add a few more state reasons for the device deactivated state

	* src/nm-device-interface.c
	  src/nm-device-interface.h
		- (nm_device_interface_deactivate): add a 'reason' argument

	* src/nm-device.c
	  src/nm-device.h
		- (nm_device_deactivate, nm_device_take_down): add a 'reason' argument
		- (nm_device_state_changed): pass the state change reason to
			nm_device_take_down()
		- (nm_device_set_managed): take a 'reason' argument, and pass it along
			to the state change function

	* src/nm-manager.c
	  src/nm-manager.h
		- (remove_one_device, handle_unmanaged_devices, sync_devices,
		   impl_manager_sleep): pass a reason code to nm_device_set_managed()
		- (nm_manager_deactivate_connection): add a 'reason' argument and pass
			something reasonable along to VPN deactivation

	* src/vpn-manager/nm-vpn-manager.c
	  src/vpn-manager/nm-vpn-manager.h
		- (nm_vpn_manager_deactivate_connection): add a 'reason' argument and
			pass that along to nm_vpn_connection_disconnect()



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4174 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-11 19:57:45 +00:00
Dan Williams
ad7a46d867 2008-10-10 Dan Williams <dcbw@redhat.com>
Rework default route handling to consolidate decisions in the policy,
	and to take active VPN connections into account when changing the default
	route (bgo #545912)

	* src/NetworkManager.c
		- (main): pass the vpn_manager to the policy so it knows about active
			VPN connections; clean up the named manager which wasn't done before

	* src/NetworkManagerPolicy.c
	  src/NetworkManagerPolicy.h
		- (nm_policy_new): get a clue about the vpn_manager
		- (update_default_route): remove, fold into update_routing_and_dns()
		- (update_routing_and_dns): handle active VPN connections too; an
			active VPN connection becomes the default route if it does not have
			server-specified or user-specified custom routes.  Otherwise, the
			best active device gets the default route
		- (vpn_connection_activated, vpn_connection_deactivated, nm_policy_new,
		   nm_policy_destroy): track VPN connection activation and deactivation
			and update the default route when appropriate

	* src/NetworkManagerSystem.c
	  src/NetworkManagerSystem.h
		- (nm_system_vpn_device_unset_from_ip4_config): remove, put functionality
			in the VPN connection itself
		- (nm_system_vpn_device_set_from_ip4_config,
		   nm_system_device_set_from_ip4_config): merge together to make
			nm_system_apply_ip4_config()
		- (add_vpn_gateway_route): add a route to the VPN's external gateway
			via the parent device
		- (nm_system_apply_ip4_config): simplify
		- (add_ip4_route_to_gateway): new function; add a direct route to the
			gateway if needed
		- (nm_system_device_replace_default_ip4_route): simplify, break gateway
			route stuff out into add_ip4_route_to_gateway() for clarity

	* src/nm-device.c
		- (nm_device_set_ip4_config): update for nm_system_apply_ip4_config()

	* src/vpn-manager/nm-vpn-connection.c
	  src/vpn-manager/nm-vpn-connection.h
		- (nm_vpn_connection_get_ip4_config, nm_vpn_connection_get_ip_iface,
		   nm_vpn_connection_get_parent_device): add
		- (nm_vpn_connection_ip4_config_get): make the requirement of a tunnel
			device explicit
		- (connection_state_changed): update the named manager now that
			nm_system_vpn_device_unset_from_ip4_config() is gone; do something
			useful on errors

	* src/vpn-manager/nm-vpn-manager.c
	  src/vpn-manager/nm-vpn-manager.h
		- Add a 'connection-activated' signal
		- (nm_vpn_manager_get_active_connections): new function; mainly for the
			policy to find out about active VPN connections



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4167 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-10 23:05:45 +00:00