Commit Graph

7207 Commits

Author SHA1 Message Date
Jiří Klimeš
17bc5867dc ifcfg-rh: socket() returns -1 on failure 2011-06-15 10:43:07 +02:00
Jiří Klimeš
6fe22d99f0 ifcfg-rh: fix possible crash when route file creation fails 2011-06-14 17:15:51 +02:00
Jiří Klimeš
74954136dd supplicant: remove unused D-Bus dbus_g_bus_get() call from test-supplicant-config.c 2011-06-14 16:03:28 +02:00
Jiří Klimeš
e8b5e2910d dhcp: remove unused D-Bus dbus_g_bus_get() call from test-dhcp-options.c 2011-06-14 15:54:08 +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
5e3c51fa4e wifi/mesh: require WEXT 21 or later
Seriously, get a kernel more recent than 2007.  Really.
2011-06-08 17:09:14 -05:00
Jiří Klimeš
9549c70d94 core: fix auto-connect to hidden SSIDs (rh #707406)
Previously (in NM 0.8.x) most WiFi connection were from user settings service.
And the service updated 'seen-bssids' property when got connected.
But the settings service in 0.9 don't do that. That inhibits auto-connecting to
hidden networks. This commit takes care of updating 'seen-bssids'. However, we
don't want to write out the conection each time it's activated (touching /etc).
So, seen BSSIDs are kept separately from the connection in a look-aside file.

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
2011-06-08 14:51:27 -05:00
Jiří Klimeš
060e865ecd core: trivial whitespace fixes 2011-06-08 14:51:27 -05:00
Dan Williams
9cba854fa0 settings: ensure transient secrets are ignored when rereading connections (rh #703785)
When a connection changes on-disk, the in-memory copy of it may contain
transient secrets (agent-owned or not saved) that dont' get written out
to disk.  When comparing the on-disk copy to the in-memory copy make sure
transient secrets are ignored so that we don't re-read the on-disk copy
needlessly.
2011-06-07 18:39:18 -05:00
Dan Williams
a2acfdd46b core: simplify device activation precheck
The FIXME is correct; comparing the whole connection is just dumb now
since all connections are owned by NM, so we can simply compare pointers
to figure out of the incoming activation request is using the same
connection as the current activation request.  Plus, this comparison
would fail entirely if the connection has transient/always-ask secrets.
2011-06-07 14:22:55 -05:00
Dan Williams
f1329b486f core: more BT device removed log message less noisy
Don't log when any BT device is removed, just log when a device
we actually care about is removed.
2011-06-07 11:08:13 -05: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
Dan Williams
d2ae0bac82 keyfile: better handle cert/key files that don't exist (bgo #649807)
The keyfile code has to handle a few different formats of cert/key values,
and wasn't doing a good enough job of detecting plain paths as values.  By
default the writer will write out a plain path (ie, not prefixed with file://)
and the reader will handle that correctly, *unless* that file does not
exist, at which the reader assumed it was a byte array.  This caused the
read-in keyfile not to match the in-memory connection (since the in-memory
connection though the cert/key held a path, but the read-in one thought it
contained a blob) and this seems to eventually have triggered a write-out
with the new values (as a blob), which would then drop a .pem file into
system-connections/ containing the path that should have been in the
keyfile in the first place.

This all happened because we assumed that the given path for the cert or
key would actually be valid, which doesn't seem to be the case for a lot
of people.  Clearly these connections won't work (since the certificate or
key does not exist) but the keyfile plugin shouldn't be messing up the
connection's settings at the very least.

Fix that by handling the check of whether the cert/key data is a path or
not in a less restrictive manner and add some testcases to make sure that
everything works as we expect.
2011-06-01 16:51:47 -05:00
Dan Williams
0f37efd77b keyfile: write relative cert/key paths too
If the cert/key path is relative to the keyfile then don't
bother writing the absolute path out.  This also prevents the
keyfile plugin from rewriting a relative path to an absolute one,
preventing some annoyance for people that hand-edit keyfiles.
2011-06-01 16:51:47 -05:00
Dan Williams
06ec2a5382 keyfile: convert relative cert/key paths to absolute ones when reading
Passing a relative path to wpa_supplicant does no good since the supplicant
may not have the same working directory as NetworkManager.  Relative paths
used in keyfiles are assumed to be relative to the keyfile itself anyway,
so actually use the absolute path we compute for the cert/key instead of
leaving it relative.
2011-06-01 16:10:58 -05:00
Dan Williams
c1dd530798 keyfile: ignore .pem and .der file changes
Since the keyfile plugin only stores the paths of these files,
we don't really care about what's in them.  We also don't want
to attempt to read them as keyfiles, which produces warnings
in the logs.
2011-06-01 13:26:25 -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
Dan Williams
232bb3cea2 settings: suppress warnings about NULL hash tables 2011-05-26 19:43:19 -05:00
Dan Williams
459e7b9518 api/core: add ActiveConnection property to device objects
Enables easier traversal of the object hierarchy; if a client is
watching signals on a device they can easily get back to the
parent NMActiveConnection object to grab connection details or
status.
2011-05-26 19:19:32 -05:00
Jiří Klimeš
ce05bdb62e core: fix copying SSID from the connection to the hidden AP 2011-05-26 14:08:10 +02:00
Dan Williams
e75f5bc862 settings: only update transient secrets if they exist
Otherwise here the transient_secrets GHashTable will be NULL, and
g_hash_table_iter_init() doesn't like that much.
2011-05-25 18:52:55 -05:00
Dan Williams
a2dcf524bb core: silence error if ConsoleKit database isn't found the first time (rh #695617)
Ignore the first error if the CK database isn't there yet.
2011-05-25 15:14:12 -05:00
Dan Williams
730f10d707 settings: ensure connection changes don't overwrite transient secrets
Here's the problem:

- NM requests secrets
- secret agent returns secrets including some that are agent-owned or
  not-saved (ie, transient secrets)
- for whatever reason (other secrets are system-owned, whatever) the
  connection gets written back out to disk
- at some point later inotify triggers a connection re-read from disk
- the connection is read from disk, but doesn't contain the agent-owned
  or not-saved secrets, because they obviously don't get saved
- nm_settings_connection_replace_and_commit() blows away the agent-owned
  or not-saved secrets that the agent originally returned
- device activation no longer has the transient secrets

Re-reading connection data from disk shouldn't change transient secrets;
instead we need to merge the just-read system-owned secrets with whatever
transient secrets an agent sent.  Transient secrets should only be cleared
by nm_connection_clear_secrets() to ensure that they stick around for as
long as we need them.
2011-05-25 11:44:28 -05:00
Dan Williams
0b5ab39dbf wifi: always fix up Ad-Hoc frequency when connecting (rh #699203)
This used to only happen for user-created APs, but the supplicant
always wants a frequency no matter what, and the kernel drivers will
normally merge with any other IBSS with the same SSID no matter what
frequency is used, so we might as well just pass something since
it doesn't really matter in the end anyway.

As a bonus we get to remove the user_created stuff since it doesn't
really matter much anymore.
2011-05-24 12:37:55 -05:00
David Woodhouse
1951029908 core: complete the openconnect migration hack; add flags for the saved secrets too (bgo #650383)
Commit e083cd5c63 stopped openconnect from
saving its secrets. It'd been working for a whole three minutes since my
previous commit.

We need to have at least one secret with an *extant* flags setting of
NM_SETTING_SECRET_FLAG_NONE, in order to trigger a write-out of the new
set of secrets. And we might as well list all the secrets we *know* the
auth-dialog is going to use, although we know there will be some secrets
that we cannot predict in advance (the form entry boxes).
2011-05-23 13:54:03 -05:00
Dan Williams
c0387ffbc5 core: treat VPN secrets without flags as system-owned
All non-VPN secrets are considered system-owned if they do not
have any explicitly set secret flags, and this makes VPN secrets
treated the same way.  As part of the import process plugins and
the applet already update secret flags.  This ensures that VPN
secrets are treated consistently throughout the codebase.
2011-05-23 13:45:51 -05:00
Dan Williams
987a132c12 core: clean up auth handling after polkit enable/disable changes
Slash and burn the #ifdef jungle so that the flow and blocks are
cleaner and less confusing to follow.
2011-05-20 11:35:24 -05:00
Dan Williams
82d83af5ae core: rename PolkitCall to AuthCall 2011-05-20 10:55:24 -05: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
Philip Balister
0e45771126 core: yet more consistent usage of libnl CFLAGS and LIBS
This patch has been used in OpenEmbedded [1] since commit b167a9a9 [2][3].

[1] http://www.openembedded.org/
[2] http://cgit.openembedded.org/cgit.cgi/openembedded/commit/recipes/networkmanager/networkmanager/0002-respect-libnl-flags-also-in-dns-manager-vpn-manager-.patch?id=b167a9a9e55a7a493a7ee565cec9c7dd463362ff
[3] http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=b167a9a9e55a7a493a7ee565cec9c7dd463362ff

Signed-off-by: Philip Balister <philip@balister.org>
2011-05-19 15:40:07 -05:00
Martin Jansa
a23f3da669 core: use libnl CFLAGS and LIBS consistently
This patch is used in OpenEmbedded [1] since commit 154bd72b [2][3].

[1] http://www.openembedded.org/
[2] http://cgit.openembedded.org/cgit.cgi/openembedded/log/recipes/networkmanager/networkmanager/0001-respect-libnl-flags-also-in-backends-ip6-manager.patch
[3] http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=154bd72b1ca859afcae5ed4fe99ed611a13a475c

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2011-05-19 15:31:02 -05:00
Dan Williams
6dae3c2f33 ppp: enable pppd debug logging when PPP log domain is enabled for debuggin
Instead of just with the old environment variable.  This means we'll
log pppd debug output when the log level is changed via the D-Bus
interface now too.
2011-05-19 13:31:52 -05:00
Dan Williams
e083cd5c63 settings: when checking for system-owned secrets ignore NOT_SAVED
Previously a secret marked NOT_SAVED or NOT_REQUIRED would be
treated as a system secret when checking returned secrets.  That's
incorrect since unsaved or not required secrets aren't stored
by system settings.
2011-05-19 13:14:51 -05:00
David Woodhouse
05a959d1d6 settings: fix VPN secret flag handling in secrets returned from agents
We need to push one more level down into VPN secrets when checking
the secret flags on VPN settings.
2011-05-19 13:11:49 -05:00
Dan Williams
304d0b869b core: openconnect migration hack
Evil hack; but the problem is that before this commit anyone who
migrated connections wouldn't have the right secrets flag set in
their openconnect connections.  Figuring out some way of updating
those connections now is harder and we don't want people to have
to go through the delete-connection-file-change-applet-stamp-rerun
dance.  So we'll live with this for now...
2011-05-18 22:45:24 -05:00
Dan Williams
b6a63ff025 core: allow build-time enable/disable of PolicyKit
When PK is turned off, everything is authorized.
2011-05-18 22:38:39 -05:00
Dan Williams
f79dcb9560 core: consolidate PolicyKit code
Use one global PolkitAuthority object; we only really need to use it
in one place anyway.  So consolidate the code that uses polkit into
nm-manager-auth.c.
2011-05-18 22:20:24 -05:00
Dan Williams
9c2cce5ac9 trivial: remove unused prototype 2011-05-18 11:13:34 -05:00
Dan Williams
4d38c1a23a trivial: add missing curly brace 2011-05-18 11:10:50 -05:00
Dan Williams
a2cd94f83f wifi: ignore zero-length SSIDs in internal wifi code
Should never get these, and if we do, we should ignore them by
leaving the SSID as NULL.
2011-05-18 10:32:03 -05:00
Dan Williams
5f073ece4b wifi: return error for AddAndActivate requests for hidden APs
If there's no SSID, we can't connect at all.  So if a client passes
in a hidden AP, and doesn't send the SSID in the partial connection
info, we can't make a connection with it.  Return an error instead
of crashing.
2011-05-18 10:22:25 -05:00
Dan Williams
60c1870674 Revert "core: fix crash while connecting with AddAndActivateConnection() and SSID is missing"
This reverts commit 2b12825faa.

Fixes the problem, but the real issue was clients passing AP objects
that don't have an SSID; we need to reject connection creation
requests where the SSID can't be found.
2011-05-18 10:21:10 -05:00
Jiří Klimeš
2b12825faa core: fix crash while connecting with AddAndActivateConnection() and SSID is missing
A network with hidden SSID can appear in gnome-shell indicator applet as
<unknown> entry. Clicking it can make NM crash if there is no SSID in wireless
setting nor in AP.
2011-05-18 14:53:57 +02:00
Jiří Klimeš
5737573314 dhclient: only send hostname without domain as host-name option (rh #694758) 2011-05-13 11:44:22 +02:00
Thomas Bechtold
cecc0621ce core: recognize platform 'gadget' devices too 2011-05-12 12:14:09 -05:00
Dan Williams
74d798b6dd dispatcher: pass DHCP options as string:string hash
This is what was originally intended, but the NM-side code wasn't
doing this due to an oversight...
2011-05-11 16:01:12 -05:00
Dan Williams
bcba83592e wimax: make sure current NSP is cleared when appropriate
When removing all NSPs in the scan list clearly we should be clearing
out the current NSP as well, since it just got removed from the scan
list.  And make sure the current NSP is cleared when activation fails
or when the device becomes disconnected, since it's not connected to
anything and thus can't have a current NSP either.

The current NSP should only be set during the activation attempt and
while the device is connected.
2011-05-11 15:21:05 -05:00
Dan Williams
f74c9ebe8f wimax: don't attempt to connect while device is scanning
The WiMAX SDK will reject connect requests while the device is scanning,
which happens when right after suspend or when the wimax radio is
turned on.  Postpone the connect attempt until the device says it's
not scanning anymore instead of having the connect attempt fail
and be retried.
2011-05-11 15:21:05 -05:00
Dan Williams
5e2cda5c20 core: fix typo 2011-05-09 13:55:19 -05:00
Dan Williams
2bcd4016b4 settings: clean up signal handlers when destroying connections
Otherwise we might get crashes later.
2011-05-04 17:13:03 -05:00