Commit Graph

8762 Commits

Author SHA1 Message Date
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
jvoisin
00ffb78c8d core: add support for EAP-PWD authentication 2013-10-23 21:07:30 -05:00
Jiří Klimeš
ecd49fb435 cli: add IPv{4,6} setting for all new non-slave connections in editor 2013-10-23 16:22:18 +02:00
Jiří Klimeš
3d14d52325 cli: copy remote connection to local one on 'save' (rh #997958)
Plugins may have problems with preserving some properties on write/read cycle,
may add ipv{4,6} settings when they are not present in the connection, etc.
That makes local and remote connection differ.
So we copy remote connection into the local to get rid of such problems.

Note:
68f12b4e9c and
f03635e5ac
commits ensure that all connection (except slaves) have IPv{4,6} settings.

https://bugzilla.redhat.com/show_bug.cgi?id=997958
2013-10-23 16:22:18 +02:00
Thomas Haller
3eb1d5e902 core: cleanup freeing of glib collections of pointers
When freeing one of the collections such as GArray, GPtrArray, GSList,
etc. it is common that the items inside the connections must be
freed/unrefed too.

The previous code often iterated over the collection first with
e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument.
For one, this has the problem, that g_free has a different signature
GDestroyNotify then the expected GFunc. Moreover, this can be
simplified either by setting a clear function
(g_ptr_array_set_clear_func) or by passing the destroy function to the
free function (g_slist_free_full).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:53:57 +02:00
Thomas Haller
1c93b24829 core: fix memory leak in nm-agent-manager
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:53:57 +02:00
Thomas Haller
35b19dcfc3 core: fix memory leak in nm-dhcp-dhclient
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:53:57 +02:00
Thomas Haller
e670528778 dispatcher: fix memory leak in nm-dispatcher-action
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:53:46 +02:00
Thomas Haller
5a0d3c724d libnm-glib: fix use proper unref function in libnm-glib/nm-ip4-config.c
NMIP4Address and NMIP4Route instances must be released
with a special nm_ip4_*_unref function.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:22:59 +02:00
Thomas Haller
94bcecdb14 keyfile: always chain-up parent constructor in keyfile dispose method
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 19:22:59 +02:00
Thomas Haller
c38be4ef4b core: keep nm_connection_provider_get_connections in private instead of static data
nm_connection_provider_get_connections returns an internally kept
constant list to simplify handling for the users. Do not cache this
list in a static variable, instead put it in a private field.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 18:45:22 +02:00
Thomas Haller
c67f978df0 core: fix compiler warnings -Werror=shadow by trivial renaming of variables
https://bugzilla.gnome.org/show_bug.cgi?id=710497

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 18:45:22 +02:00