Commit Graph

15047 Commits

Author SHA1 Message Date
Lubomir Rintel
36e5c0a821 all: g_hash_table_add doesn't return a value before 2.40 2015-09-30 13:43:03 +02:00
Lubomir Rintel
3227778d89 manager: fix a reversed conditional
find_ac_for_connection() needs the uuid when the connection is not a
NMSettingConnection.

Fixes: 06da353242
2015-09-30 12:14:02 +02:00
Lubomir Rintel
e0fa48f224 vpn-connection: set the MTU for the VPN IP interface
The 9b79e6c73 commit moved setting of the MTU from IP4Config to NMDevice, but
VPN connections don't have a NMDevice instance (yet). Set the MTU also from the
VPN connection. Also, copying of the MTU to the IP4Config is no longer needed
as the ip4_config_commit no longer sets the MTU.

Fixes: 9b79e6c732ffb2fb105647c1465070d36a6cc180

https://bugzilla.gnome.org/show_bug.cgi?id=754781
2015-09-29 18:24:48 +02:00
Lubomir Rintel
8b0bb7a022 firewall-manager: avoid leaving dangling request if firewalld is not running
Unhook it prior to deallocation. Fixes an assertion on daemon shutdown:

  NetworkManager[30037]: <info>  exiting (success)
  **
  NetworkManager:ERROR:nm-firewall-manager.c:489:dispose: assertion failed: (g_hash_table_size (priv->pending_calls) == 0)
  Aborted (core dumped)

Fixes: 94f888a262
2015-09-29 14:10:47 +02:00
Lubomir Rintel
b38bc15747 build: set -Werror when checking whether a -W<warning> option works
Otherwise the check is effectively a no-op and unknown options still get
turned on. This results in unknown warnings when build without
--with-extra-warnings=error:

  warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
2015-09-29 14:08:14 +02:00
Jiří Klimeš
edec77fba4 merge: S390 subchannels improvements (bgo #755610)
- export device's S390 subchannels on D-Bus
- update 390 subchannels comparison for connection vs.device compatibility
- support s390 subchannels in libnm and nmcli

https://bugzilla.gnome.org/show_bug.cgi?id=755610
2015-09-29 09:41:45 +02:00
Jiří Klimeš
82e4364480 tests: add a test for connection_compatible() for wired devices
Allow setting MAC address and S390 subchannels for ethernet devices in
testing NM service.
2015-09-29 09:31:41 +02:00
Jiří Klimeš
e7ed259fdc cli: print s390 subchannels for devices that have that 2015-09-29 09:31:41 +02:00
Jiří Klimeš
9abe74d98e libnm: match s390 subchannels and MAC blacklist in connection_compatible()
Basically, make it the same as check_connection_compatible()
in src/devices/nm-device-ethernet.c
2015-09-29 09:31:25 +02:00
Jiří Klimeš
bbaca1b24e libnm: add 390-subchannels property to NMDeviceEthernet 2015-09-29 09:31:25 +02:00
Jiří Klimeš
4219aa9a56 device: export S390Subchannels property on Ethernet device
and update match_subchans() to compare number of subchannels too.
2015-09-29 09:30:01 +02:00
Lubomir Rintel
8e6a839d93 contrib/rpm: regenerate automake with locally present version
The modification of po/Makefile.in.in may trigger re-run of autotools and it
would fail if the versions differ.

Fixes: 2318c0de92
2015-09-28 19:50:09 +02:00
Thomas Haller
4545a7fe96 Revert "libnm-util: don't include "nm-version.h" in "NetworkManager.h""
This breaks build of PackageKit. Revert the patch.

This reverts commit 159e827a72.

https://bugzilla.gnome.org/show_bug.cgi?id=755660
2015-09-26 13:15:58 +02:00
Beniamino Galvani
7cf5c326bc device: ensure firewall zone is set on the actual IP interface
For certain types of connection as PPP and WWAN the IP interface is
created during stage3 (IP config) but we are setting the firewall zone
at the beginning of stage3 and thus the zone is only set on the
underlying interface.

Add a check at the start of IP check phase to ensure that the firewall
zone is set again if the device interface is different from IP
interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1110465
2015-09-26 09:47:21 +02:00
Dan Williams
5b374a4a9f device: increase IPv6LL DAD timeout (rh #1101809)
Depending on the network and the values of the 'dad_transmits' and
'retrans_timeout_ms' sysctls, DAD for the IPv6LL address can take
quite a while.  Obviously there must be some upper bound on the
timeout, but 5 seconds seems a bit low.  In this case it was observed
to be ~12 seconds but the sysctl values are unknown.  In any case,
we can't predict the network/config so being a bit more lenient here
makes sense.

https://bugzilla.redhat.com/show_bug.cgi?id=1101809
2015-09-25 11:27:46 -05:00
Thomas Haller
c60ff9e7e0 libnm: add NM_AVAILABLE_IN_1_2 to "nm-dbus-interface.h"
"nm-dbus-interface.h" can be used without glib/libnm, hence we must
workaround a missing NM_AVAILABLE_IN_1_2 macro.
2015-09-25 16:22:47 +02:00
Jiří Klimeš
12e6cf1f20 libnm-core/libnm-util: fix an erroneous error message
ipv6.dns: 'this property is not allowed for '%s=%s'' not allowed for method=ignore
2015-09-25 16:11:24 +02:00
Jiří Klimeš
ecf0849355 cli: allow 'ipv6' and 'ppp' settings for GSM and CDMA connections (rh #1265993)
Otherwise the settings cannot be changed.

https://bugzilla.redhat.com/show_bug.cgi?id=1265993
2015-09-25 15:50:22 +02:00
Jiří Klimeš
0c1124b903 cli: fix error string format
clients/cli/.libs/nmcli con mod profile con.zone
Error: Error: value for 'con.zone' is missing..

Fixes: 15149d915f
2015-09-25 15:50:22 +02:00
Thomas Haller
0e223d4961 libnm: include "glib.h" in "nm-version.h"
This is a forward port of commit 6f616d4c4b04d5478f60d0311317bc84c5459ea4
which added this patch on nm-1-0 branch.

However, the reason stated there is wrong because we don't need this
to fix Qt examples. Building Qt examples was fixed in that "nm-dbus-interface.h"
no longer drags in "nm-version.h".

On the other hand, we still want "nm-version.h" to be self-contained,
and include "glib.h" as it needs it.
2015-09-25 15:48:09 +02:00
Thomas Haller
159e827a72 libnm-util: don't include "nm-version.h" in "NetworkManager.h"
We want "NetworkManager.h" to have no dependancy on libnm and glib.
2015-09-25 15:42:15 +02:00
Thomas Haller
c0852964a8 libnm: don't include "nm-version.h" in "nm-dbus-interface.h"
We want "nm-dbus-interface.h" to have no dependancy on libnm and glib.
That way, it is usable for example in the QT examples without dragging
in dependencies to glib.

Also drop all the unneccessary include to "nm-dbus-interface.h", which
we already get by directly or indirectly including "nm-core-types.h".
2015-09-25 15:42:15 +02:00
Jiří Klimeš
66b7e45708 man: fix in nm-settings-ifcfg-rh description 2015-09-25 13:23:44 +02:00
Jiří Klimeš
9294962cc4 cli: remove static width parameter from fields definition
The width is no longer needed because the actual field's width is computed
dynamically just before printing.
(as of commit e6870789b5)
2015-09-25 12:09:51 +02:00
Thomas Haller
19dd0574a7 firewall: merge branch 'th/firewall-callback-bgo755539'
https://bugzilla.gnome.org/show_bug.cgi?id=755539
2015-09-25 10:34:03 +02:00
Thomas Haller
bb7e6c2cd4 firewall: always take a reference to NMFirewallManager during asynchronous operations
Always take a reference to the manager when scheaduling an asynchronous
operations. In fact, all callers want to keep the manager alive as long
as there are operations in progress.
2015-09-25 10:34:03 +02:00
Thomas Haller
94f888a262 firewall: refactor callback handling in NMFirewallManager
Refactor NMFirewallManager to have consistent semantics about
asynchronous calls.

  - the callback is always invoked exactly once, but never
    synchronously when starting the operation.
  - while cancelling the request, the callback is invoked
    synchronously with respect to the cancel operation.
  - you can cancel a request once (and once only).
  - you cannot cancel the request once the callback is invoked.
  - when disposing the object with requests pending, the
    callbacks are invoked synchronously.

- Add a callback argument to nm_firewall_manager_remove_from_zone().
  Otherwise, the user never knows whether a call is still pending and
  cancellable (as complete operations cannot be cancelled).
  In fact, it makes no sense trying to cancel a call if you don't care
  about when it completes.

- get rid of PENDING_CALL_DUMMY. The dummy callback allows cancellation
  any number of times. We want to catch wrong usage by asserting that an
  operation is only cancelled once.

- nm_firewall_manager_cancel_call() doesn't need the manager argument.
  Either the call-id is valid (and has a valid pointer to the manager),
  or there is a bug and it is a dangling pointer.
2015-09-25 10:34:02 +02:00
Thomas Haller
5bc4d7f0f9 firewall: add arguments to NMFirewallManagerAddRemoveCallback
We should return the target object and the call_id.
2015-09-25 10:34:02 +02:00
Thomas Haller
d3a8254681 firewall/trivial: rename FwAddToZoneFunc to NMFirewallManagerAddRemoveCallback
Give it a proper NMFirewallManager* prefix to make it clear where the type belongs.
Also, we will add a similar callback for nm_firewall_manager_remove_from_zone(),
so reflect that in the name.
2015-09-25 10:34:02 +02:00
Thomas Haller
0d33b73e42 firewall/trivial: rename NMFirewallPendingCall to NMFirewallManagerCallId
Matches the naming scheme for other call-ids.
2015-09-25 10:34:02 +02:00
Thomas Haller
320f454e9f core: use NM_UTILS_ERROR_CANCELLED_DISPOSING error reason 2015-09-25 10:34:02 +02:00
Thomas Haller
44f3f18797 core: add NM_UTILS_ERROR 2015-09-25 10:34:02 +02:00
Jiří Klimeš
eecb4c46cc modem-broadband: update modem's supported-ip-families (rh #1263959)
If SIM in a modem is locked, ModemManager can't initialize SupportedIpFamilies
and NetworkManager will set the property to 0. ModemManager then updates the
property after the modem is unlocked, but NetworkManager did not watch changes
to the property. And that resulted in a connection failure:
(ttyUSB1): Failed to connect 'O2 Internet': Connection requested IPv4 but IPv4 is unsuported by the modem.
(ttyUSB1): device state change: prepare -> failed (reason 'modem-init-failed') [40 120 28]

https://bugzilla.redhat.com/show_bug.cgi?id=1263959
2015-09-25 10:18:38 +02:00
Quentin Glidic
2a4a222d95 tools/check-exports.sh: use ${NM} when available
This way you can export NM to use a prefixed tool

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

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2015-09-24 16:28:15 +02:00
Thomas Haller
1b7196ec51 systemd: merge branch 'th/systemd-dhcp-timer-rh1260727'
https://bugzilla.redhat.com/show_bug.cgi?id=1260727
2015-09-24 10:52:09 +02:00
Thomas Haller
401a2eb834 systemd: avoid potential crash due to uncanceled timers in client_receive_advertise()
Got a crash with unknown reason on nm-1-0 branch. It's unclear why,
but the reason could be that a lease in client_receive_advertise()
was cleared, but not its timers.

Backtrace from nm-1-0 branch (note that the systemd code where the crash
happend is different, but similar):

    #0  sd_event_source_unref (s=0xf5c007e8fb894853) at dhcp-manager/systemd-dhcp/nm-sd-adapt.c:53
    #1  0x0000555555682340 in client_timeout_t1 (s=<optimized out>, usec=<optimized out>, userdata=0x5555559f5240)
        at dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c:451
    #2  0x00005555556a078f in time_ready (source=0x5555559f3c20) at dhcp-manager/systemd-dhcp/nm-sd-adapt.c:146
    #3  0x00007ffff4a481b3 in g_timeout_dispatch () from /lib64/libglib-2.0.so.0
    #4  0x00007ffff4a4779a in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
    #5  0x00007ffff4a47ae8 in g_main_context_iterate.isra.24 () from /lib64/libglib-2.0.so.0
    #6  0x00007ffff4a47dba in g_main_loop_run () from /lib64/libglib-2.0.so.0
    #7  0x0000555555597073 in main (argc=1, argv=0x7fffffffe2b8) at main.c:512

Equivalent upstream systemd patch:
  https://github.com/systemd/systemd/pull/1332
  f89087272b

https://bugzilla.redhat.com/show_bug.cgi?id=1260727
2015-09-24 10:50:54 +02:00
Thomas Haller
ca00c146d4 systemd/adapt: update logging prefix for systemd log_internal()
We used to prefix messages from systemd with "sd-dhcp". Since we no
longer use the systemd code only for DHCP, change the prefix to
"libsystemd".
2015-09-23 16:09:43 +02:00
Thomas Haller
2d2d742cf1 systemd/adapt: refactor sd_event_source to use a union for holding mutually exclusive fields
sd_event_source is either used for sd_event_add_io() or sd_event_add_time().
Depending on the use, different fields of the struct are relevant. Refactor
the struct to have a union.

This reduces the size of the struct, but more importantly, it makes it
clear which fields are used in which context.
2015-09-23 16:09:43 +02:00
Thomas Haller
02c51d4231 systemd/adapt: assert that a @source argument is passed to sd_event_add_time()
Systemd supports omitting the output source argument. In this case,
the created event source is floating and the reference count
is handled properly.

We have however no callers that make use of that functionality, so
instead of implementing floating references, assert that we don't
need it.

This isn't a change in behavior, because previously the could would just
SEGFAULT if a caller didn't want to take ownership of the created event.
2015-09-23 16:09:43 +02:00
Thomas Haller
9901047ae3 systemd/adapt: fix potential crash invoking sd_event_source callbacks
It is common that the callbacks unref the event source. Hence we must
ensure that the @source stays alive until the callback returns.
2015-09-23 16:09:43 +02:00
Thomas Haller
fb0e87be39 systemd/adapt: use slice-allocator for struct sd_event_source 2015-09-23 16:09:43 +02:00
Thomas Haller
41917a52c0 systemd/adapt: refactor creation of struct sd_event_source 2015-09-23 16:09:43 +02:00
Thomas Haller
d6370d09e6 logging: coerce negative error values to positive errno
Especially systemd, which makes use of the error argument for logging, likes
to represent errors as negative numbers. We hence must invert a negative error
code to get the real errno.
2015-09-23 16:09:43 +02:00
Jiří Klimeš
94bbe7465f supplicant: adjust fragment_size according to MTU (bgo #755145)
NetworkManager set wpa_supplicant's fragment_size option to 1300. But if MTU
was lower, wpa_supplicant failed with "l2_packet_send - sendto: Message too
long" due to fragmentation of EAP-TLS or EAP-PEAP packets.

Actually, MTU has to be 14 bytes bigger than the "fragment_size" parameter.

Ideally, wpa_supplicant would take MTU in the account and adjust the
fragmentation limit accordingly. See discussion in
http://lists.shmoo.com/pipermail/hostap/2015-August/033546.html

https://bugzilla.gnome.org/show_bug.cgi?id=755145
2015-09-23 12:41:11 +02:00
Beniamino Galvani
d7b72b2a3e dns-manager: fix DNS options syntax in resolv.conf
Fixes: e7ff906f91
2015-09-22 20:43:08 +02:00
Jiří Klimeš
2318c0de92 contrib/rpm: fix creating proper po/Makefile.in.in (rh #1265117)
Without that DATADIRNAME was not present in po/Makefile.in.in
and it resulted in /usr/\@DATADIRNAME\@/locale/cs/LC_MESSAGES/ path instead of
/usr/share/locale/cs/LC_MESSAGES/.

https://bugzilla.redhat.com/show_bug.cgi?id=1265117
2015-09-22 12:50:55 +02:00
Jiří Klimeš
85d7dc1a0f manager: cleanup NMRfkillManager in dispose()
Fixes: b15fb8641e
2015-09-22 08:21:54 +02:00
Jiří Klimeš
dd8c3ef3a0 manager: disconnect signal handlers on 'settings' in dispose() (rh #1264676)
Otherwise a crash can occur when shutting down.

https://bugzilla.redhat.com/show_bug.cgi?id=1264676
2015-09-22 08:21:54 +02:00
Thomas Haller
f0ea0cd402 device: refactor beginning of _set_state_full()
- Reorder statements, to first g_return_if_fail() and log state-change.

- Also log a message when leaving _set_state_full() early due to missing firmware.
2015-09-21 18:25:50 +02:00
Thomas Haller
4cb0ab5d29 cli: fix type on printed nmcli error message
Fixes: 4dffbf8f6a
2015-09-21 18:25:50 +02:00