Commit Graph

15047 Commits

Author SHA1 Message Date
Beniamino Galvani
fbd3286955 core,libnm: use nm_clear_g_source() where possible
Replacement was done with commands:

spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir src
spatch --sp-file nm_clear_g_source.cocci --in-place --smpl-spacing --dir libnm

where nm_clear_g_source.cocci contains:

@@
expression e;
@@
- if (e) {
-    g_source_remove (e);
-    e = 0;
- }
+ nm_clear_g_source (&e);
2016-01-06 21:25:55 +01:00
Beniamino Galvani
205ae642f9 core: fix signedness of NMPolicyPrivate.reset_retries_id 2016-01-06 21:25:55 +01:00
Beniamino Galvani
272098e48b ifcfg-rh: fix utils_detect_ifcfg_path() argument
Fixes: 39e97c9339
2016-01-06 21:19:45 +01:00
Thomas Haller
39e97c9339 ifcfg-rh: only accept ifcfg base paths in impl_ifcfgrh_get_ifcfg_details()
Previously, we directly passed the @in_ifcfg path to find_by_path().
That means, @in_ifcfg must be the path to the base "ifcfg-" file,
not an alias or route file.

Add an additional pre-check, that the provided file name is really a
ifcfg base file.

This results in a more detailed error message when calling
GetIfcfgDetails not on the ifcfg base file. It's not that previously
the lookup would have succeeded.
2016-01-06 12:06:44 +01:00
Beniamino Galvani
5bf0697f65 device/infiniband: take interface down to set transport mode
With some drivers it is necessary to take the interface down to set
the transport mode.

https://bugzilla.redhat.com/show_bug.cgi?id=1281301
2016-01-05 18:53:22 +01:00
Beniamino Galvani
e72b8aa923 core: merge branch 'bg/ppp-device-fixes-rh1268617'
https://bugzilla.redhat.com/show_bug.cgi?id=1268617
2016-01-05 18:37:07 +01:00
Beniamino Galvani
ed536998f9 device: update @ip_iface only if IP interface exists
If @ip_ifindex is zero, the IP interface has disappeared and
there's no point in updating @ip_iface.

Actually, unconditionally updating @ip_iface is dangerous because it
breaks the assumption used by other functions (as
nm_device_get_ip_ifindex()) that a non-NULL @ip_iface implies a valid
@ip_ifindex. This was causing the scary failure:

  devices/nm-device.c:666:get_ip_iface_identifier: assertion failed: (ifindex)

https://bugzilla.redhat.com/show_bug.cgi?id=1268617
2016-01-05 18:36:46 +01:00
Beniamino Galvani
5f93f01015 ppp-manager: clear @ppp_watch_id upon pppd termination
Set @ppp_watch_id to zero upon pppd termination, otherwise the call to
g_source_remove(priv->ppp_watch_id) in dispose() could trigger a failed
assertion.
2016-01-05 18:36:46 +01:00
Thomas Haller
0e164ac607 platform: ensure _nl_send_auto_with_seq() returns 0 on success
Just for consistency reason.
2016-01-04 18:15:17 +01:00
Thomas Haller
7102cde1ff platform/trivial: remove extra indention in constructed() 2016-01-04 18:08:04 +01:00
Beniamino Galvani
986cf3a887 ppp-manager: initialize MTU to zero when not specified
When the MTU was not specified in PPP setting, it got the value of a
previous option.

Fixes: 8f36727ac8
2016-01-04 17:10:43 +01:00
Thomas Haller
ac7a6d0206 systemd: merge branch 'systemd' into master 2016-01-04 17:03:11 +01:00
Thomas Haller
4b5352057a platform/tests: avoid test failure in test_ip6_address_general()
# Start of ipv6 tests
  # NetworkManager-FATAL-ERROR: NMPlatformSignalAssert: ../../../../../src/platform/tests/test-address.c:154, test_ip6_address_general(): failure to free non-accepted signal: ip6-address-changed-changed ifindex 11 (1 times received)
2016-01-04 17:01:18 +01:00
Thomas Haller
606ad7e62b systemd: update code from upstream
This is a direct dump from systemd git on 2016-01-04, git commit
993898a2af5bc34e600b81aafec055cc93be0b02.

======

SYSTEMD_DIR=../systemd
COMMIT=993898a2af5bc34e600b81aafec055cc93be0b02

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-port.c"
nm_copy_sd "src/libsystemd-network/lldp-port.h"
nm_copy_sd "src/libsystemd-network/lldp-tlv.c"
nm_copy_sd "src/libsystemd-network/lldp-tlv.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2016-01-04 15:21:19 +01:00
Lubomir Rintel
da1abaa1db device: reset the capabilities to class defaults when reseting them
Otherwise the lacking IS_SOFTWARE capability may cuase the connections not to
be available on software devices and the devices would get garbage-collected at
the end of unrealize().
2016-01-04 12:09:55 +01:00
Lubomir Rintel
48695df023 vlan: make connection available if the device is not real
Otherwise NMDevice would do and always fail a carrier check, making it
impossible to ever manually activate a vlan connection.
2016-01-04 11:57:22 +01:00
Thomas Haller
d1bd8c7132 libnm: merge branch 'th/libnm-test-invalid-connection' 2015-12-26 19:09:30 +01:00
Thomas Haller
92f122525d libnm/tests: add tests for libnm handling invalid connections
Add test showing how libnm/libnm-glib handles invalid connections,
i.e. connections that fail nm_connection_verify(). libnm implements
settings a static types (via different NMSetting types). This makes
it unavoidable that eventually a newer server version will
expose connections that fail verification in the client.

For example, master added a new base type NMSettingTun. This setting type
was not backported to legacy libnm-glib, thus such connection will not verify.
Also, we want that newer server versions are backward compatible with older
library versions. Thus also a pre-NMSettingTun libnm version has the same
problem.

The test shows that libnm is agnostic to whether the connection verifies.
That is consistent behavior, but possibly problematic because most
accessors to connections assert against a valid connection. Thus using
the common nm_connection*() functions on an invalid connection can lead
to problems.
Also, due to the static nature of our NMSetting types, some properties
can be silently dropped and thus mangling the connection without the
library user noticing.

libnm-glib prints a g_warning() whenever parsing an invalid connection.
When an invalid connection is added initially, it is exposed to the library
user. When a connection gets later invalidated due to an update, the
connection disappears and it stays missing even if a subsequent update
makes the connection valid again.

libnm-glib's behavior indicates that we might wanted to hide invalid
connections from the user. But it's very broken there.
2015-12-26 19:09:11 +01:00
Thomas Haller
212e1c3a84 libnm-glib: avoid use-after-free when replace_settings() fails
When replace_settings() fails, it emits the REMOVED signal. That
in turn can free the self instance. Ensure to keep the instance alive
long enough.
2015-12-26 19:09:04 +01:00
Thomas Haller
142ea41cae libnm/tests: add test code driving python test service 2015-12-26 16:43:49 +01:00
Thomas Haller
8859cd0738 libnm/tests: extend handling connections in python test service 2015-12-26 16:43:49 +01:00
Thomas Haller
570d24b88c libnm/tests: add dbus-glib support to "nm-test-libnm-utils" 2015-12-26 16:43:49 +01:00
Thomas Haller
c0af56ac7a libnm/tests: use nmtstc_nm_remote_settings_new() 2015-12-26 16:43:49 +01:00
Thomas Haller
5edd265c0b libnm/tests: add nmtstc_nm_remote_settings_new() 2015-12-26 16:43:49 +01:00
Thomas Haller
d90525ebfc libnm/tests: use nmtstc_nm_client_new() 2015-12-26 16:43:49 +01:00
Thomas Haller
56880fbe69 libnm/tests: add nmtstc_nm_client_new() 2015-12-26 16:43:49 +01:00
Thomas Haller
bdfcf02da3 libnm/tests: add NMTSTC_SERVICE_INFO_SETUP() macro 2015-12-26 16:43:49 +01:00
Thomas Haller
f354d5f0fc nmtst: enable connection utility functions for libnm-glib/libnm-utils library 2015-12-25 20:36:43 +01:00
Thomas Haller
9a11577e63 nmtst: add nmtst_uuid_generate() 2015-12-25 20:36:43 +01:00
Thomas Haller
c2bafa6153 nmtst: add nmtst_find_all_indexes() 2015-12-25 20:36:43 +01:00
Thomas Haller
766f31507b nmtst: add nmtst_main_loop_run() 2015-12-25 20:36:43 +01:00
Thomas Haller
c7d4d67d53 include: remove trailing semicolon from _Pragma() call 2015-12-24 11:42:37 +01:00
Thomas Haller
db80ec05ab build: rename directory "include" to "shared"
Up to now, the "include" directory contained (only) header files that were
used project-wide by libs, core, clients, et al.

Since the directory now also contains a non-header file, the "include"
name is misleading. Instead of adding yet another directory that is
project-wide, with non-header-only content, rename the "include"
directory to "shared".
2015-12-24 11:42:37 +01:00
Thomas Haller
bc06dd9332 libnm/tests: rename test functions to follow common pattern
Like the test utility functions in nm-test-utils.h and
platform's common.h, rename the helper functions to have
a nmtst(c) prefix.
2015-12-24 11:42:37 +01:00
Thomas Haller
fa3093e167 libnm/tests: move common testing code to nm-test-libnm-utils
The unit tests for libnm and libnm-glib use a NetworkManager stub
service written in Python (test-networkmanager-service.py). As they
share the same server, it makes sense to also share the same utility
code to drive the stub.

Move the common code to include/.

Note that contrary to "nm-test-utils.h", "nm-test-libnm-utils.h" is not
a header-only file. Instead its implementation is in "nm-test-utils-impl.c".
The reason for that this split is, if we later have yet another non-header-only
test-utility, then all the implementations are in "nm-test-utils-impl.c", requiring
the tests to link only one object file.
2015-12-24 11:42:37 +01:00
Thomas Haller
70713ee197 libnm/tests: unify common test code for libnm and libnm-glib
Unify the common test code to drive the D-Bus stub service
test-networkmanager-service.py. They will be merged in the next
commit.
2015-12-24 11:42:36 +01:00
Thomas Haller
45951bca50 build: separate compilation macro for libnm-util and libnm-glib
Set different defines for building libnm and legacy libnm-glib.
2015-12-24 11:42:36 +01:00
Beniamino Galvani
2ef3c1047d man: fix typos 2015-12-24 09:48:20 +01:00
Lubomir Rintel
dff1829c99 po: fix some typos in Galician translation 2015-12-23 14:40:47 +01:00
Lubomir Rintel
aa10b4233f po: update Brazilian Portuguese translation
https://bugzilla.gnome.org/show_bug.cgi?id=759747
2015-12-23 14:38:54 +01:00
Lubomir Rintel
6e98dab526 po: merge in nm-1-0 translations 2015-12-23 14:38:54 +01:00
Lubomir Rintel
7015932e90 po: update-po 2015-12-23 14:38:53 +01:00
Yuri Chornoivan
37cc168a5b po: update Ukrainian translation
https://bugzilla.gnome.org/show_bug.cgi?id=759659
2015-12-23 14:38:40 +01:00
Lubomir Rintel
93f1a1d461 platform: fix 32-bit build
Fixes: 6d67e6e9c4
2015-12-23 12:35:15 +01:00
Beniamino Galvani
e1d06d7a0b device/vlan: fix failed assertion in parent_hwaddr_changed()
Parent MAC can be NULL if the interface has gone, fix the following
failed assertion:

  [devices/nm-device-vlan.c:107] parent_hwaddr_changed(): (vlan1): parent hardware address changed
  nm_device_set_hw_addr: assertion 'addr != NULL' failed

While at it, improve logging by printing the new MAC address.

Fixes: e6d7fee5a6
2015-12-22 10:51:26 +01:00
Beniamino Galvani
9dffc0228b merge: support for changing MTU of software devices (bgo #759549)
https://bugzilla.gnome.org/show_bug.cgi?id=759549
2015-12-19 12:21:06 +01:00
Beniamino Galvani
29b93602fc tun: add support for MTU and cloned-mac-address properties
Make it possible to change ethernet.mtu and
ethernet.cloned-mac-address properties of tun/tap devices
(cloned-mac-address is meaningful only for taps).
2015-12-19 12:06:33 +01:00
Beniamino Galvani
9c837e95a3 vxlan: add support for MTU and cloned-mac-address properties
Make it possible to change ethernet.mtu and
ethernet.cloned-mac-address properties of vxlan devices.
2015-12-19 12:06:33 +01:00
Beniamino Galvani
1ff712d5d0 ip-tunnel: add a MTU property
Add a new ip-tunnel.mtu property which can be used to change the MTU
of the tunnel interface.
2015-12-19 12:06:33 +01:00
Thomas Haller
8c27a370ff libnm-util: allow unknown setting types in nm_connection_get_virtual_iface_name()
Allow calling nm_connection_get_virtual_iface_name() on a non-verified
connection by not asserting asserting against a valid base-setting.

On nma-1-0 branch, nm-applet can crash with:

    #3  0x00007ffff2993a7a in g_assertion_message_expr (domain=0x7ffff51fad86 "libnm-util", file=0x7ffff51fb728 "nm-connection.c", line=320, func=0x7ffff51fc028 "_get_type_setting", expr=<optimized out>) at gtestutils.c:2444
    #4  0x00007ffff51ac52f in _get_type_setting (connection=0xa3c160 [NMRemoteConnection]) at nm-connection.c:320
    #5  0x00007ffff51ac341 in nm_connection_get_virtual_iface_name (connection=0xa3c160 [NMRemoteConnection]) at nm-connection.c:1436
    #6  0x0000000000415bdc in add_virtual_items (type=type@entry=0x43c11d "bridge", all_devices=all_devices@entry=0x7f6580, all_connections=all_connections@entry=0x9354a0, menu=menu@entry=0x922990 [GtkMenu], applet=applet@entry=0x6cc000 [NMApplet]) at applet.c:1640
    #7  0x00000000004176f6 in nma_menu_add_devices (menu=menu@entry=0x922990 [GtkMenu], applet=applet@entry=0x6cc000 [NMApplet]) at applet.c:1713
    #8  0x0000000000418315 in nma_menu_show_cb (menu=0x922990 [GtkMenu], applet=0x6cc000 [NMApplet]) at applet.c:1974

where the connection type is "tun".

Note that libnm accepts invalid connections and exposes them to the
user (albeit issuing a warning). Later on there are many places where
that can lead to further g_return*(), which is ugly indeed.
At least, we should not assert against valid connections (because that
crashes the user) and there is a well known fact that the base setting
will be missing for tun settings. No need to even warn about that in
nm_connection_get_virtual_iface_name() (we already got the warning
during replace_settings).
2015-12-18 14:50:00 +01:00