Commit Graph

15047 Commits

Author SHA1 Message Date
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
Yuri Chornoivan
ba781ced57 po: updated Ukrainian (uk) translation (bgo #710511)
https://bugzilla.gnome.org/show_bug.cgi?id=710511

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-22 11:35:15 +02:00
Dan Winship
00b29b6c61 core: fix NMManager:primary-connection when a VPN has the default route
If a VPN had the default route, :primary-connection would become NULL,
which is exactly what it's not supposed to do. Fix it to have the
value it's supposed to.

https://bugzilla.gnome.org/show_bug.cgi?id=710207
2013-10-21 16:18:11 -04:00
Jiří Klimeš
6a8fd3f469 cli: properly initialize new team-slave connections in editor 2013-10-21 16:30:04 +02:00
Pavel Šimerda
8e17fc2aa4 device: remove unused 'dev_state' variable
Reported-by: Julien Nabet <serval2412@yahoo.fr>
2013-10-20 18:24:26 +02:00
Pavel Šimerda
f7ff042819 platform: use translated VLAN flags
The internal VLAN flags were translated into the kernel VLAN flags but
finally the internal ones were passed to the kernel instead.

Reported-by: Julien Nabet <serval2412@yahoo.fr>
2013-10-20 18:20:53 +02:00
Yuri Chornoivan
61de24ba35 Fix typos
https://bugzilla.gnome.org/show_bug.cgi?id=710505
2013-10-19 11:49:18 -04:00
Thomas Haller
72da550f68 bluez: remove created NAP connection together with NMBluezDevice
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 20:12:10 +02:00
Thomas Haller
d5bc540150 bluez: merge rework of BlueZ to detect BlueZ 4 vs. 5 at runtime (bgo #709412)
Before, you had to select at compile time to run BlueZ4 or BlueZ5.
Now, both versions are enabled together and NM detects the actual
version at runtime.

The configure option --enable-bluez4 got removed.

The advantage is now, that you can switch between the two versions of
BlueZ without rebuilding NetworkManager. Note however, that you still
must restart NetworkManager, because once a version is detected, it will
not switch again as long as the process runs.

Another advantage is that before not all code was build, and you had
to build two configurations for testing.

https://bugzilla.gnome.org/show_bug.cgi?id=709412

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 20:12:03 +02:00
Thomas Haller
e46722b72b core: make callback argument in nm_settings_connection_commit_changes/_delete optional
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
4ba86e2cc8 bluez: fix calling of bdaddr added/removed signals in nm-bluez4-adapter
Fix several issues with emitting the BDADDR_ADDED/BDADDR_REMOVED
signals:

 - when removing a device, the handlers were never disconnected from
   the device's notify::usable and initialized signals.
 - ensure that the signals BDADDR_ADDED/BDADDR_REMOVED only get emitted
   in a consistent way (toggeling). Before, there was a bug, that the
   signal BDADDR_REMOVED was emitted for devices that were never added
   and never usable.

Co-Authored-By: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
28a6f11b2c bluez: use GDBus instead of dbus-glib in nm-bluez-device.c
Refactor nm-bluez-device.c to use GDBus both to connect to
BlueZ 4 and BlueZ 4.

Also remove the unused property RSSI.

Also prefix every logline with the dbus path of the device.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
bf5a6ad443 bluez: enable both BlueZ4 and 5 and select it dynamically at runtime
NMBluezManager is now a proxy and only delegates to either
NMBluez4Manager or NMBluez5Manager. It detects the running BlueZ
version at runtime, and once it decides for one version, it cannot be
changed anymore as long NetworkManager is running.

This means, when switching from BlueZ4 to BlueZ5 or vice versa you have
to restart NetworkManager. This should be acceptable, because it is
not a common use case (most systems won't have both versions installed
anyway) and it greatly simplifies implementation.

Also note that NMBluez4Manager and NMBluez5Manager do not implement a
common interface. NMBluezManager delegates to the correct manager.
Having them share an common interface or base class would not simplify
the code, because NMBluezManager not only delegates, but it also acts as
a proxy until it is decided which BlueZ version is running. So, this
proxy-like behaviour would still be needed. The alternative would be to
merge the functionality of all three NMBluez*Manager classes into one.

This also removes the --enable-bluez4 configure switch, because both
versions are now always enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=709412

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
3344ce9ff6 bluez: copy bluez-manager file for version 4 and 5
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
ef8501096f bluez: rename BlueZ 4 adapter to make the BlueZ version explicit
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-18 19:56:37 +02:00
Thomas Haller
e8e8031676 bluez: support BlueZ 4 and 5 together in nm-bluez-device.c
Do no longer separate nm-bluez-device at compile time with the
WITH_BLUEZ4 preprocessor flag.

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