Commit Graph

9141 Commits

Author SHA1 Message Date
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
Dan Williams
f94ac164a6 core: make nm_manager_activate_connection() take a Device, not a path
Simpler; everywhere that called it has an NMDevice already anyway.
2013-10-31 14:15:07 -05:00
Dan Williams
a878cd8145 core: move connection completion code closer to callers
Move the connection completion code out of the PendingActivation
object and into the D-Bus method handler for AddAndActivate.  This is
part of simplifying PendingActivation so we can fold its functionality
into NMActiveConnection and use the AC objects to track all activation
requests from start to finish.

This also requires a bit of reorganization since the PA used to handle
some of the request validation but that now needs to be handled by
each DBus method itself.

Previously the PA tracked the connection path, but that's really
quite unecessary, we might as well just track the actual connection
object itself.  This allows us to only validate the path once, instead
of three times like the code did before.  This does require a boolean
"add_and_activate" variable though, because the PA handles the DBus
method return and it needs to know whether the request came from
ActivateConnection or AddAndActivateConnection, which was previously
handled by checking pending->connection, which only AddAndActivate set.
2013-10-31 14:15:07 -05:00
Dan Williams
df406d06b6 dcb: merge DCB/FCoE core functionality (bgo #710422) (rh #799241)
Add DCB setting and associated logic to propagate those settings to
dcbtool.  At the moment we don't use dcbnl to talk directly to the
kernel, because some devices do parts of DCB/LLDP in userland and
thus need lldpad running, which dcbtool talks to.
2013-10-31 13:39:03 -05:00
Dan Williams
2e9fde3c28 core: set up and tear down DCB/FCoE when DCB is enabled 2013-10-31 13:29:22 -05:00
Dan Williams
64a7a045b3 core: add dcbtool manipulation logic 2013-10-31 13:29:22 -05:00
Dan Williams
3e6906e773 logging: add DCB log domain 2013-10-31 13:29:21 -05:00
Dan Williams
a3bd6df05f ifcfg-rh: add DCB setting reader and writer
See 'ifcfg-test-dcb' for details on all supported options.
2013-10-31 13:29:21 -05:00
Dan Williams
77e50740a8 libnm-util: add Data Center Bridging (DCB) setting
Includes various fixes & cleanups from Thomas Haller.
2013-10-31 13:28:42 -05:00
Jiří Klimeš
229e3fbe32 man: typo fix wil -> will 2013-10-31 14:15:21 +01:00
Jiří Klimeš
20a9723c70 man: fix 'nmcli con reload' description in nmcli manual page
Pointed out by swadeley@redhat.com
2013-10-31 14:14:03 +01:00
Stephen Wadeley
52ad4ec577 man: some improvements to language and style in nmcli-examples manual page
Signed-off-by: Stephen Wadeley <swadeley@redhat.com>
2013-10-31 13:24:22 +01:00
Stephen Wadeley
b752252fc4 man: some improvements to language and style in nmcli manual page
Signed-off-by: Stephen Wadeley <swadeley@redhat.com>
2013-10-31 13:19:53 +01:00
Enrico Nicoletto
08d77ad71e po: updated Brazilian Portuguese (pt_BR) translation (bgo #711185)
https://bugzilla.gnome.org/show_bug.cgi?id=711185

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-31 13:17:29 +01:00
Jiří Klimeš
375220cae1 cli: TAB-complete devices for 'activate' command in the editor 2013-10-31 09:00:56 +01:00
Jiří Klimeš
8d9718bd0f cli: add 'activate' menu command for interactive editor (rh #1004883)
This command allows activating the edited connection.

Monitoring the progress of the activation is a bit complicated by the fact
that the callback activate_connection_editor_cb() is invoked in main loop
thread, and not in the editor thread itself.

https://bugzilla.redhat.com/show_bug.cgi?id=1004883
2013-10-31 08:53:56 +01:00
Thomas Haller
19b040236e core: fix segfault in nm-policy when setting default route for vpn
nm_vpn_connection_get_ip6_internal_gateway might return NULL. In this
case, we add a device route (to gateway '::') over the vpn.

Before, in such a case, NM crashed with SEGFAULT.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-30 21:00:40 +01:00
Thomas Haller
d5322239ec core: remove code without effect from nm-policy.c
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-30 20:59:58 +01:00
Jiří Klimeš
26dca13c7e cli: fix VLAN egress priority mapping for 'nmcli connection add'
Found with Coverity.
2013-10-30 17:25:45 +01:00
Thomas Haller
623f8a2be1 cli: fix bash completion for nmcli connection modify
Only complete the setting name if it is at the very first
position after the connection.

e.g. complete the settings name in the case
  $ nmcli connection modify em1 connec<TAB>
but not at
  $ nmcli connection modify em1 connection.autoconnect <TAB>

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-30 13:33:47 +01:00
Dan Winship
ba96409f72 ifcfg-rh: remove a stray reference to bridges and vlans being unsupported 2013-10-29 14:14:26 -04:00
Jiří Klimeš
912152cf85 ifcfg-rh: fix crash when doing managed->unmanaged transition
Testcase:
* add 'NM_CONTROLLED=no' to /etc/sysconfig/network-scripts/ifcfg-ABC
* sudo nmcli con reload
* ... NM asserts ...

We need to ref() 'existing' connection before nm_settings_connection_signal_remove(),
because the function  unref()s ithe connection via connection_removed_cb().

Backtrace:
 ...
 #4  0x00007fbcf0ea0cba in g_assertion_message_expr (domain=domain@entry=0x0,
     file=file@entry=0x7fbcf4e5805d "nm-dbus-manager.c", line=line@entry=848,
     func=func@entry=0x7fbcf4e585e0 <__FUNCTION__.15088> "nm_dbus_manager_unregister_object", expr=expr@entry=0x7fbcf4e5820b "G_IS_OBJECT (object)")
     at gtestutils.c:2293
 #5  0x00007fbcf4de69d9 in nm_dbus_manager_unregister_object (
     self=0x7fbcf6fdc9c0, object=0x7fbcf70235c0) at nm-dbus-manager.c:848
 #6  0x00007fbcf4dd6a23 in nm_settings_connection_signal_remove (
     self=<optimized out>) at settings/nm-settings-connection.c:1541
 #7  0x00007fbce6fee884 in connection_new_or_changed (
     self=self@entry=0x7fbcf7006f80,
     path=path@entry=0x7fbcf70c3f80 "/etc/sysconfig/network-scripts/ifcfg-ABC",
     existing=existing@entry=0x7fbcf70235c0,
     out_old_path=out_old_path@entry=0x7fff2b7b8988) at plugin.c:327
 #8  0x00007fbce6feeca2 in read_connections (plugin=0x7fbcf7006f80)
     at plugin.c:453
 #9  0x00007fbcf4dd8e98 in impl_settings_reload_connections (
     self=0x7fbcf6fd98c0, context=0x7fbcf70bcb30) at settings/nm-settings.c:1262
 ...
2013-10-29 15:21:49 +01:00