Commit graph

59 commits

Author SHA1 Message Date
Jiří Klimeš
fdfbe00aac policy: remove "invalid mark" for failed connections after 5 mins
If there is a temporary connection failure (e.g. due to unavailable DHCP), the
connection is marked as invalid after several retries. Reset the flag after
5 mins to allow next auto-reconnection.
2011-06-23 11:45:16 +02:00
Jiří Klimeš
9eaf31f49a policy: don't cache "(none)" hostname on startup (rh #706094) 2011-06-14 13:21:14 +02:00
Dan Williams
650c546748 core: add some logging for activation and disconnection
'vperic' had an interesting problem on IRC where every 10 minutes
the ethernet would change state from ACTIVATED -> DISCONNECTED with
a reason code of 0; the only thing I can find is that something was
telling NM to activate a connection periodically, becasue that appears
to be the only place that changes state to DISCONNECTED with a
reason code of 0.  No logging; no apparent carrier changes.

So log this condition just in case we run into it later.
2011-06-02 09:06:48 -05:00
Jiří Klimeš
9aa7efcf28 core: reset auto retries counter when cable is replugged
When re-plugging we may be in a different network. So we should try the
compatible connections again.

Based on a patch from Mikhail Efremov.
2011-05-30 13:07:49 +02:00
Jiří Klimeš
29a4239f43 policy: make auto-activation retries really work for RETRIES_DEFAULT attempts
Retries counter was not initialized when connections were loaded. That forced
the counter to start from -1 and continue decreasing on connection failures.
And connection attempts never stopped.
2011-05-20 13:01:04 +02:00
Dan Williams
f898dbf1a9 dispatcher: enhance dispatcher script environment (bgo #648382)
For VPN connections, the interface name would be that of the VPN's
IP interface, but the script environment would be the that of the
VPN's parent device.  Enhance the environment by adding any VPN
specific details as additional environment variables prefixed by
"VPN_".  Leave the existing environment setup intact for backwards
compatiblity.

Additionally, the dispatcher never got updated for IPv6 support,
so push IPv6 configuration and DHCPv6 configuration into the
environment too.

Even better, push everything the dispatcher needs to it instead
of making the dispatcher make D-Bus requests back to NM, which
sometimes fails if NM has already torn down the device or the
connection which the device was using.

And add some testcases to ensure that we don't break backwards compat,
the testcases here were grabbed from a 0.8.4 machine with a hacked up
dispatcher to dump everything it was given from NM.
2011-05-02 22:54:28 -05:00
Dan Williams
8b445c0872 policy: don't recheck auto-activation when device is UNMANAGED or UNAVAILABLE
Pointless, since we're not going to activate it anyway when it's
in one of those states.
2011-04-19 00:31:53 -05:00
Dan Williams
1eae713a63 policy: clarify device auto-activation code
Instead of having new/delete code sprinkled around, consolidate it.
2011-04-19 00:26:37 -05:00
Dan Williams
df511f74f7 build: use -Wundef and fix up cases where stuff wasn't defined (bgo #647157) 2011-04-14 13:19:12 -05:00
Dan Williams
04b2c297ec policy: consolidate auto-retries and invalidation
Instead of having two of these, just use the autoconnect retries as
the invalid tag.  Make sure the auto-retries tag always exists by
secretly adding +1 behind the scenes (so the data we set is never NULL).
This should make the code clearer, and will enable the next commit
for authentication failures to decrease the auto retries count.
2011-04-01 18:50:58 -05:00
Dan Williams
5fd3163a46 policy: don't retry connections where secrets requests failed
If the user canceled a secrets request, or we simply can't get
secrets for the connection, invalidate it and  make sure it doesn't
get tried automatically again right after it fails.
2011-04-01 13:30:37 -05:00
Dan Williams
7da9e2f607 vpn: fix memory leaks
Two problems here:

1) code	that called nm_vpn_service_get_active_connections() wasn't freeing
the returned list, leaking it

2) No real reason to reference each item in the returned list in
nm_vpn_manager_get_active_connections(), it just makes it easier to
forget to unref things later
2011-03-24 14:13:12 -05:00
Jiří Klimeš
c207d020f7 core: use nm_connection_get_id() and nm_connection_get_uuid() to simplify code 2011-03-08 13:41:28 +01:00
Dan Williams
4427774d57 agents: filter agents by UID for user-requested connections
When a user makes an explicit request for secrets via GetSecrets
or activates a device, don't ask other users' agents for secrets.
Restrict secrets request to agents owned by the user that made the
initial activate or GetSecrets request.

Automatic activations still request secrets from any available agent.
2011-01-26 18:36:08 -06:00
Dan Williams
b3959aefa3 core: rename NMSysconfigConnection -> NMSettingsConnection 2011-01-26 11:38:12 -06:00
Giovanni Campagna
9067356856 core: fix policy handling of connections-loaded signal 2011-01-21 14:20:38 -06:00
Dan Williams
f9ceafd4a1 Merge remote branch 'origin/master' into rm-userset 2011-01-12 15:46:37 -06:00
Dan Williams
430151d6c2 build: make WiMAX support optional 2011-01-05 18:23:08 -06:00
Dan Williams
3e4b54a5d0 policy: recheck auto-activatable connections when WiMAX NSPs change 2011-01-04 18:23:29 -06:00
Dan Williams
81cb867e9f policy: don't update hostname on exit
It's a leftover from when /etc/hosts got fixed up, and since that
isn't being done anymore, there's no reason to touch the hostname
on exit.  It will already have been updated in response to device
deactivation (if the hostname was DHCP-provided for example) so
it shouldn't need to be touched on exit.

This also removes a potential crash on shutdown when systemd or
another startup manager kills D-Bus before NetworkManager, which
made the dispatcher code angry (which got executed on hostname
change).
2011-01-02 10:24:23 -06:00
Dan Williams
136139f699 policy: only autoactivate connections visible to some user
If the connection is restricted to certain users, don't auto-activate
that connection unless at least one of those users is logged in.
2010-12-23 08:14:18 -06:00
Dan Williams
39eed50e47 policy: stop touching /etc/hosts
Handling of /etc/hosts is highly site- and admin- specific in
many more complex cases, and it's exceedingly hard and error-
prone for NetworkManager to handle all those cases.  So remove
this functionality entirely.  That's not a big loss, as it
turns out there's a much more elegant solution.

The only requirement is that the machine's hostname map back
to an IP address owned by the machine.  That requirement can
be satisifed by nss-myhostname or even possibly the distro's
installer.  If the user does not want nss-myhostname then it
can be uninstalled.  Distros should use a "recommends" feature
in their packaging system so that the NetworkManager package
does *not* have a hard requirement on nss-myhostname.  Thus
everyone is happy; things Just Work when nss-myhostname is
installed, but more advanced users can uninstall it and
customize /etc/hosts as they wish.

Another alternative is a dispatcher script that listents for
the 'hostname' event, and updates /etc/hosts according to the
administrator's preference.
2010-12-17 09:28:49 -06:00
Dan Williams
02d942320d core: fix nm_settings_get_connections() result confusion
It used to reference items in the list, but no longer does because
that's stupid.  Fixes some merge damage and a leak.
2010-11-17 17:42:22 -06:00
Dan Williams
cfaa80b261 Merge remote branch 'origin/master' into rm-userset 2010-11-16 18:08:48 -06:00
Dan Williams
3d8b6acaba core: revert API parts of fe493ec91e
And add a default autoconnect retries value.
2010-11-03 13:23:09 -05:00
Jiří Klimeš
fe493ec91e core: add configurable auto connection retries (bgo #628825)
Presently, when automatic connecting fails, the connection is marked
as invalid and is not retried again. This commit adds a configuration
parameter to specify how many times the connection should be re-tried.
2010-11-03 16:22:55 +01:00
Dan Williams
83ab4ec2ee settings: system-settings -> settings 2010-10-27 20:22:14 -05:00
Dan Williams
1ec6b67162 settings: rename NMSysconfigSettings to NMSettings 2010-10-27 20:05:23 -05:00
Dan Williams
18f819d71d policy: clean up device signal handling 2010-10-27 16:57:31 -05:00
Dan Williams
3c32c02778 policy: fix and clean up policy signal disconnection on dispose 2010-10-27 16:46:32 -05:00
Dan Williams
330cb35630 policy: make sure we have a valid settings object 2010-10-27 16:22:18 -05:00
Dan Williams
84def2fedf settings: remove connection tracking from NMManager
NMSysconfigSettings has the authoritative list of connections, no reason
to duplicate all that tracking code in NMManager.  Add the missing bits
that the manager had to NMSysconfigSettings, and point NMPolicy at the
settings object instead of NMManager for that.
2010-10-27 15:47:10 -05:00
Dan Williams
8f7aedc7e0 Merge remote branch 'origin/master' into rm-userset 2010-10-18 19:02:27 -05:00
Dan Williams
be97e7f104 build: include <config.h> for kill(2), isblank(3), and isascii(3)
config.h defines _GNU_SOURCE, which in turn defines the bits necessary
for kill, isblank, and isascii.  So wherever we use those, we need
to make sure config.h is included.
2010-10-08 22:46:55 -05:00
Dan Williams
82dd97c4b7 policy: ensure stale IP mappings are not left in /etc/hosts (bgo #629020) (rh #630146)
NM-added mappings for active IP addresses were not getting properly
removed when the address disappeared of NM quit, because the bits
of code that determine whether or not /etc/hosts should change were
not taking the disappearance of the IP address into account, and
were leaving the file unchanged.

To fix that, if there is no default IP address, but there are NM-added
IP address entries in /etc/hosts, make sure we update /etc/hosts and
remove them.
2010-10-07 00:29:44 -05:00
Dan Williams
8b41f70dd5 Merge remote branch 'origin/master' into rm-userset 2010-09-27 10:30:46 -05:00
Dan Williams
6e287e4179 Merge remote branch 'origin/master' into rm-userset 2010-09-16 17:10:49 -05:00
Dan Williams
64b6cd1ebc core: add DNS plugin config options 2010-09-09 17:14:20 -05:00
Dan Williams
9b2b809aae core: rename NMNamedManager -> NMDnsManager 2010-09-07 22:08:18 -05:00
Dan Williams
022d8e665c Merge remote branch 'origin/master' into gsoc 2010-08-26 09:18:37 -05:00
Dan Williams
c4db66c7ed vpn: fix refcounting of the VPN manager 2010-08-17 15:04:54 -05:00
Zephaniah E. Loss-Cutler-Hull
d5468c8527 vpn: let plugins forbid VPN connections from getting the default route (bgo #621698)
Minor fixes and cleanups by dcbw.
2010-08-12 23:53:42 -05:00
Daniel Gnoutcheff
5fda5283b9 core: remove internal API refs. to user settings
Remove all references to connection scope and user-settings services
from the various internal APIs of the daemon. The external DBus API
remains unchanged, albeit in stub form for scope stuff.
2010-08-06 13:05:46 -04:00
Daniel Gnoutcheff
443c95a6b9 nm-manager: start removing user settings services
It turns out that user settings services are strange and complicated
beasts. We will remove support for them, and we will later implement
security mechanisms on the system settings service that will do what
user settings services were intended to do.

This commit is a bulk removal of nm-manager's internal support code for
user settings services. The external API is largely unchanged, but
errors are returned if anyone ties to do something with user settings.

Work remaining includes some possible flattening of nm-manager's
internal code, along with code removal and API changes in other modules.
2010-08-06 13:05:46 -04:00
Dan Williams
af2be00b8c Revert "core: fail connections if IP configuration expires" (rh #616084) (rh #590874)
This reverts commit b172519045.

When something like NTP updates the system clock, that can cause
dhclient to expire the lease, and at that point we just want NM
to let dhclient re-aquire the lease instead of failing the
whole connection.
2010-07-27 20:31:27 -07:00
Dan Williams
759bf79466 dns: include domain part of hostname in resolv.conf 'searches' (rh #600407)
Add the current domain name (from the hostname) to the searches list.
The bug report is that when the hostname is set to something like
'dcbw.foobar.com' (ie an FQDN) that pinging 'dcbw' doesn't work
because the resolver doesn't have anything to append to 'dcbw' when
looking it up.
2010-06-23 12:02:16 -07:00
Dan Williams
171dcf51b5 policy: pass default IPv4 and IPv6 addresses to hostname functions
In preparation for updating /etc/hosts to assign the current hostname
to the current IP address to allow programs that (somewhat incorrectly)
do DNS lookups on the machine's current hostname to find out its
IP address.
2010-06-17 23:01:40 -07:00
Dan Williams
773c006a4c policy: support IPv6 address reverse-lookup for hostname too 2010-06-08 10:40:08 -07:00
Dan Williams
5c31397091 core: don't auto-activate user connections if the user lacks permissions 2010-06-04 13:05:27 -07:00
Dan Williams
fa70542c61 core: add networking enable/disable knob distinct from sleep/wake (rh #589108) (bgo #346615)
Since forever we've used sleep/wake as the way to implement
Networking Enabled.  When the state file was introduced to make the
networking and wifi states persistent, we ran into a bug where
a failed suspend (like if the machine ran out of power while
suspended) would result in networking being disabled on reboot
since suspend/resume used the same knob as enable/disable.

This patch adds a distinct call for enable/disable networking
which changes the state file, while sleep/wake no longer change
the state file.
2010-05-22 09:51:22 -07:00