Commit Graph

13873 Commits

Author SHA1 Message Date
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
Jiří Klimeš
a9ea67185e libnm-util: validate "primary" bonding option as an interface name
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller
0c6a98df78 libnm-util: do not g_warn when trying to set invalid bond option
nm_setting_bond_add_option returns TRUE or FALSE indicating, whether
the bond option was properly set. So, the API already kind of expects
invalid values, so there is no reason to warn about it.

Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller
df4e159728 libnm-util: expose nm_setting_bond_validate_option as public API
Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller
3f3f2a82d0 bond: use platform functions for writing sysfs
Refactor writing the bonding options, to use again the platform
function for the sysfs options.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Thomas Haller
4b85408e34 bond: handle bond options more gracefully
Support new bonding options and set them carefully. The options cannot
be set arbitrarily because they interfere with each other.

This commit is forward-ported from rhel-6.5, see patch
rh901662-bond-more-options.patch, originally written by Dan Williams.

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

Co-Authored-By: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Jiří Klimeš
a4004fd2e9 cli: fix new connection initialization in the editor
This fixes a regression caused by ecd49fb435

In addition, initialize Wi-Fi mode to "infrastructure".
2013-10-25 14:26:00 +02:00
Jiří Klimeš
75723221f2 wifi: use NM_SETTING_WIRELESS_MODE_* constants for mode property
and thus fix "infra" -> "infractructure"
2013-10-25 13:46:42 +02:00
Dan Winship
0a557ac01d core: fix crash when activating a never-default IPv4 connection 2013-10-24 15:15:02 -04:00
Dan Winship
3b97185ff8 libnm-util: fix slave IP config checking
NMSettingConnection was making sure that bond slaves didn't have an IP
configuration, but it should have been making that check for bridge
and team slaves too.
2013-10-24 12:25:08 -04:00
Dan Winship
f4c3e2f643 libnm-util: centralize find_setting_by_name code
Several settings types' verify() functions need to find a particular
setting from the all_settings list that NMConnection passes them. Add
a convenience function for this.
2013-10-24 12:25:08 -04:00
Dan Winship
83c5a69126 libnm-util: fix a leak in NMSettingIP6Config 2013-10-24 12:25:08 -04:00
Enrico Nicoletto
b7e1a39521 po: updated Brazilian Portuguese (pt_BR) translation (bgo #710815)
https://bugzilla.gnome.org/show_bug.cgi?id=710815

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-24 17:27:36 +02:00
Thomas Haller
2a7c976539 cli: show property names in bash completion for nmcli connection modify
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-24 14:52:08 +02:00
Jiří Klimeš
5bbde1b87e core: fix an error message - connection ID vs. interface name 2013-10-24 12:19:20 +02:00
Jiří Klimeš
f4dbf27410 core: track autoconnect for removed software devices (rh #1005913)
When an interface is manually disconnected NM remembers that, and prevents
automatic activation of the device.
However, software devices are removed when they are disconnected, and thus
the state of the device is lost. We need to track autoconnect outside the
device - hash table of interface names not allowed to activate automatically.

Without that the device would be auto-activated again and again, even if
explicitly disconnected.
Test case:
$ nmcli con add type bond ifname bb con-name bb-con
$ nmcli con add type bond-slave ifname em1 con-name b1-con master bb
$ nmcli dev disconnect bb

https://bugzilla.redhat.com/show_bug.cgi?id=1005913
2013-10-24 11:58:18 +02:00
Jiří Klimeš
1a67f8df03 ifcfg-rh: always read (and write) static IP addresses (rh #998135)
Static IP addresses were only read from ifcfg-* file when IP method was
'manual' (BOOTPROTO=none|static). This was to match the legacy initscripts
behaviour. However, NetworkManager supports using additional static IPs in
addition to automatically obtained (DHCP, etc.) addresses. So we now read
static IPs even for automatic methods to be able to use this feature.

https://bugzilla.redhat.com/show_bug.cgi?id=998135
2013-10-24 10:09:57 +02:00
Jiří Klimeš
9ca6fa71f1 cli: do not pass con_type to callbacks, get the type from device
This simplifies the code.

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
2013-10-23 22:22:35 -04:00
Dan Winship
0221971da5 nmcli: fix some leaks found by valgrind
https://bugzilla.gnome.org/show_bug.cgi?id=709369
2013-10-23 22:22:35 -04:00