Commit Graph

8762 Commits

Author SHA1 Message Date
Yuri Chornoivan
544f505043 po: updated Ukrainian (uk) translation (bgo #711358)
https://bugzilla.gnome.org/show_bug.cgi?id=711358

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-04 11:28:43 +01:00
Thomas Haller
2542888283 ifcfg-rh: fix crash when reading connection (assert in connection_new_or_changed)
rh #1025007 reports a crash on g_assert_no_error() in
connection_new_or_changed() of src/settings/plugins/ifcfg-rh/plugin.c.
From the back trace I am not 100% sure, what the problem was, but I
think that nm_settings_connection_replace_settings failed because of
nm_connection_update_secrets. Apparently such a situation can
happen and it should simply be accepted as valid.

What might have happened, is that the connection used to have
secrets (maybe it had 802.1x configured?) and then it got changed,
so update_secrets() fails because the connection no longer has a
setting to which the secrets would apply.

https://bugzilla.redhat.com/show_bug.cgi?id=1025007

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-01 18:40:56 +01:00
Dan Winship
e213707623 settings: add unrecognized-specs, implement in ifcfg-rh
In Fedora, OVS ports are now identified in ifcfg files as
"TYPE=OVSPort", which NM doesn't recognize, and so it would ignore
those ifcfg files. Unfortunately, this meant that if auto-default
wasn't disabled, and there was no other configuration defined for the
device, then NM would create an NMDefaultWiredConnection for it and
screw things up.

So, add an "unrecognized-specs" settings plugin property, which allows
a plugin to indicate to NetworkManager that it knows of some
non-NetworkManager-supported connection defined for a device. This
will suppress default-wired connection creation for that device,
similar to the "no-auto-default" config file option, but determined by
the plugin instead of by manual configuration. Devices listed in
unrecognized-specs may still be managed by NetworkManager, unless they
are also listed in unmanaged-specs.

https://bugzilla.redhat.com/show_bug.cgi?id=1022256
2013-11-01 13:04:12 -04:00
Dan Winship
0d3674a50a ifcfg-rh: centralize unmanaged-spec handling in the reader
Rather than having each connection-parsing function do its own
unmanaged-spec handling, just do it all directly from
connection_from_file(), and don't bother trying to fully parse the
file if it is unmanaged, since it won't ever be seen outside of the
plugin in that case anyway.

This also makes it possible to have an ifcfg file of an unrecognized
type be unmanaged.
2013-11-01 13:04:11 -04:00
Dan Winship
16e824fe34 libnm-util: belatedly export nm_setting_generic_new() 2013-11-01 13:04:11 -04:00
Dan Williams
e3b3b3dcfd ifcfg-rh: add a missing monitor-connection-files check
NMIfcfgConnection was still watching for hard link changes even if
monitor-connection-files was off.
2013-11-01 13:04:11 -04:00
Dan Winship
0065bd6643 ifcfg-rh: fix handling of runtime NM_CONTROLLED=yes -> no changes
We were accidentally removing the connection from priv->connections
(and thus from unmanaged-specs) when NM_CONTROLLED changed to no when
rereading a changed connection file.
2013-11-01 12:13:23 -04:00
Dan Winship
84672c73e3 ifcfg-rh: handle change from one unmanaged-spec to another
If an ifcfg file changed from one non-NULL unmanaged-spec to another
(eg, if it previously had an interface-name: unmanaged-spec, and then
you add a HWADDR line, switching it to a mac: unmanaged-spec), we were
not updating the connection's unmanaged property, or emitting
unmanaged-specs-changed.

Also, remove the notify::unmanaged handler, since only plugin.c ever
changes an existing NMIfcfgConnection's unmanaged property, and it
always emits the signal itself afterward (and it needs to manually
emit the signal in other cases anyway, like when a connection is
removed).
2013-11-01 12:02:22 -04:00
Jiří Klimeš
8ec031fb0e core: again allow calling AddAndActivateConnection() without a connection
When settings are NULL or empty in impl_manager_add_and_activate_connection(),
the connection is created and completed by nm_utils_complete_generic() or
nm_device_complete_connection().

Also, do not assert in nm_connection_is_type(). Returning FALSE there is
sufficient.

Related commit a878cd8145
2013-11-01 14:07:04 +01:00
Jiří Klimeš
fc9eae55b3 keyfile: replace g_str_equal() with g_strcmp0()
It fixes crash when nm_keyfile_connection_get_path() returns NULL.
2013-11-01 12:38:25 +01:00
Jiří Klimeš
abe4f4daf5 libnm-util: do not assert valid connection type in nm_connection_is_type()
That is not useful, simply return FALSE.
2013-11-01 12:38:25 +01:00
Thomas Haller
886ca75ac3 core: fix crash when reading routes from VPN Ip6Config (bgo #706332)
https://bugzilla.gnome.org/show_bug.cgi?id=706332

Reported-by: Nicolas Iooss <nicolas.iooss.2010_nm@m4x.org>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-01 11:08:59 +01:00
Jiří Klimeš
6457e2c367 core: fix crash on an activation error
Reported by Oleksii Shevchuk (alxchk) on IRC
2013-11-01 10:23:09 +01:00
Dan Williams
732012cc8c core/cli: allow activations with only one of [ device, connection ] (bgo #707427) (rh #961543)
If a connection is given but no device, the correct device will be
automatically determined.

If a device is given but not a connection, a connection will be
automatically chose from among that device's available connections.

Adds the cli command "nmcli dev connect <ifname>".
2013-10-31 15:49:07 -05:00
Dan Williams
7d57386e04 cli: add support for 'nmcli dev connect ifname XXX' 2013-10-31 15:45:21 -05:00
Dan Williams
42c7ea85a1 cli: add support for 'nmcli con up ifname XXX'
Passes a NULL connection to nm_client_activate_connection() allowing
NetworkManager to pick the best available connection for the interface.
2013-10-31 15:45:20 -05:00
Dan Williams
4ec5f5c8e3 libnm-glib: add support for NULL connections to nm_client_activate_connection()
Pass along to NetworkManager, which picks the best available connection for the
device and activates it.
2013-10-31 15:33:58 -05:00
Dan Williams
35124dbb14 core: extend ActivateConnection to allow NULL connection paths
When called with a connection path, activates that connection.

When called without a connection path, picks the best available
connection to activate for that device.

Doesn't work with VPN connections because they don't have devices.
2013-10-31 15:33:58 -05:00
Dan Williams
f4befaab00 core: also check specific object when determining available connections 2013-10-31 15:33:57 -05:00
Dan Williams
8a173e1d7a core: removal of PendingActivation object from nm-manager.c (bgo #707335)
This branch decouples NMActiveConnection creation from device activation
so that the NMActiveConnection object tracks the entire activation request
(either internally-requested by the Policy or externally via D-Bus) from
start to finish, instead of the previous situation where the PendingActivation
handled D-Bus requests separately.  This also will allow implementation of
the DEACTIVATING state in the future.  The NMActiveConnection object tracking
the activation is not actually exported to D-Bus until the device or VPN
activation is completely authorized and actually begins.

It also encapsulates all the details needed to authorize a request into
a new NMAuthSubject class, replacing various "dbus_sender" and "user_requested"
arguments throughout the code.
2013-10-31 15:25:38 -05:00
Dan Williams
b3c0756f79 trivial: add logging for ActiveConnection master-ready tracking 2013-10-31 14:55:32 -05:00
Dan Williams
ff7e47a418 core: kill PendingActivation and move authorization to NMActiveConnection
Besides killing PendingActivation, this patch decouples ActiveConnection
creation from actually activating that connection.  This allows the
ActiveConnection to complete authorization asynchronously.  This will
also be used in the future for handling the DEACTIVATING state of devices
(for "pre-down" functionality).
2013-10-31 14:55:32 -05:00
Dan Williams
625008e486 policy: track secondary activations by ActiveConnection not path
ActiveConnections will (soon) not have a D-Bus path on creation, but
only when they are exported after authorization is complete.  That
means we can't rely on their dbus path in the secondaries code.
Instead, track them directly since the path may be NULL.
2013-10-31 14:15:09 -05:00
Dan Williams
8242b79f29 policy: only clean up VPN DNS/routing configuration if the VPN got connected
It's pointless and wrong to try to clean up DNS and routing configuration
if the VPN never got to the point of retrieving that from the server.
2013-10-31 14:15:09 -05:00
Dan Williams
1b37cd0340 core: allow ActiveConnections to be created without a device
The device may not be created yet (in the case of software devices)
when the ActiveConnection is created; in that case we still want to
proceed with authorization for the connection, but we'll create the
device when authorization is complete.
2013-10-31 14:15:09 -05:00
Dan Williams
a7bab4015e core: have ActiveConnection track device state instead of subclasses
Both NMActRequest and NMVPNConnection need to track their device's state,
so instead of both subclasses having to do so, consolidate that code into
the superclass.
2013-10-31 14:15:08 -05:00
Dan Williams
1768b3abd5 core: add slave to master in stage1_prepare, not nm_device_activate()
When ActiveConnections take over authentication, it may mean that the
master active connection is still handling authentication when the
slave starts to activate.  Thus the master device may still be in
DISCONNECTED state and not ready to enslave the slave.
2013-10-31 14:15:08 -05:00
Dan Williams
f95bca2dcf core: ensure all devices chain up to parent act_stage1_prepare
We'll be moving some code into the NMDevice implementation soon, which
currently does nothing other than return success.
2013-10-31 14:15:08 -05:00
Dan Williams
087e1dfbb9 core: indicate via a property when master connections are ready for slaves
Add a 'master-ready' property to NMActiveConnection that NMDevice can
watch for to indicate that the master connection/device is ready to accept
slaves.  Since the slave device's ActiveConnection is already tracking
its master connection, and since ActiveConnections don't enter the
ACTIVATING state until their device is ready for slaves, it's pretty
trivial to implement this property.
2013-10-31 14:15:08 -05:00
Dan Williams
ae116d847e core: allow ActiveConnection connection to be changed
For the case of AddAndActivate, which needs to set the final connection
after authentication is done and NMSettings has returned the final
connection.
2013-10-31 14:15:08 -05:00
Dan Williams
8252357dd1 core: watch master ActiveConnections and follow master deactivation 2013-10-31 14:15:08 -05:00
Dan Williams
3bb2b158cd core: switch NMActiveConnection master to an NMActiveConnection instead of NMDevice
We need to track the master active connection, since it may require authentication
or other operations to complete before the device actually starts activating.
2013-10-31 14:15:08 -05:00
Dan Williams
4237df8c21 core: allow active connection 'master' to be set after object creation
We want to create the object earlier now, and figuring out the master is
a lot of code that we don't want to run before creating the object.  The
master still must be set before exporting the object over D-Bus though,
as before.
2013-10-31 14:15:08 -05:00
Dan Williams
4b8cd481dc core: add authorization code to NMActiveConnection
In preparation for killing PendingActivation; copy and rework the
PendingActivation authorization code for NMActiveConnection.
2013-10-31 14:15:08 -05:00
Dan Williams
0e595abcf3 core: pass NMAuthSubject around activation paths instead of uid + dbus sender 2013-10-31 14:15:08 -05:00
Dan Williams
bcef423174 core: use NMAuthSubject in D-Bus triggered activation paths 2013-10-31 14:15:08 -05:00
Dan Williams
1126e22572 core: remove unused auth chain creation functions
No longer used by anything.
2013-10-31 14:15:08 -05:00
Dan Williams
07b07a988a core: use NMAuthSubject in the manager for non-activation paths 2013-10-31 14:15:08 -05:00
Dan Williams
e672401315 settings: use NMAuthSubject in NMSettings 2013-10-31 14:15:07 -05:00
Dan Williams
f403e6afc0 settings: use NMAuthSubject in NMSettingsConnection 2013-10-31 14:15:07 -05:00
Dan Williams
e39435a596 agents: use NMAuthSubject 2013-10-31 14:15:07 -05:00
Dan Williams
7fe84e0ec7 core: add function to create auth chains from a subjects or contexts
The subject already contains all the information we need.
2013-10-31 14:15:07 -05:00
Dan Williams
49d098f29d core: add NMAuthSubject object to encapsulate authentication info
This object encapsulates all authentication information we need
about some entity that requests that NetworkManager perform an
action on its behalf.
2013-10-31 14:15:07 -05:00
Dan Williams
7a9d5a262a core: grab remote process id when authenticating D-Bus clients 2013-10-31 14:15:07 -05:00
Dan Williams
a007292937 core: move VPN active connection creation to the manager
Eventually the manager will create both NMActRequest and
NMVPNConnection subclasses directly, instead of leaving
NMVPNConnection creation to the VPN manager.

This also ensures that VPN connections get their user_requested
attribute set correctly, which wasn't happening before in the
case of secondary VPN connections.
2013-10-31 14:15:07 -05:00
Dan Williams
3660a80c29 core: export new active connection from the manager
When we eventually do authorization in the ActiveConnection itself,
we want to make sure the AC doesn't get exported until everything
is authorized.  Thus let the manager handle exporting the objects
since it knows when the AC will be authorized or not.
2013-10-31 14:15:07 -05:00
Dan Williams
f6f626de34 core: ensure active connection has a device before exporting it 2013-10-31 14:15:07 -05:00
Dan Williams
428ebf42b0 core: simplify NMActRequest
The 'connection' and 'device' private variables aren't needed since
they will always be available through the NMActiveConnection
superclass.
2013-10-31 14:15:07 -05:00
Dan Williams
6413241ff2 core: handle NULL object paths in NMActiveConnection
NM uses "/" to mean a NULL object path, since you can't pass
NULL object paths through D-Bus.  The AC code didn't handle that
and we'll soon be passing object paths from D-Bus into it.
2013-10-31 14:15:07 -05:00
Dan Williams
4e4e14e65c core: more flattening of PendingActivation objects
Do less authentication in the PA and make the DBusGMethodInvocation
opaque to the PA.  This pushes the responsibility for replying to
the D-Bus method call closer to the D-Bus method handler instead
of stuffing it all into the PA.  This does mean we need to get
the D-Bus sender name and the sender UID and pass that into the
pending_activation_new(), but we'll clean that up in a bit.
2013-10-31 14:15:07 -05:00