Commit graph

12475 commits

Author SHA1 Message Date
Thomas Haller
4e0882e923 device: assert that master-ready handler is not scheduled in schedule_stage2_device_config()
(cherry picked from commit c41be469ab)
2015-10-06 17:41:31 +02:00
Thomas Haller
7828003bf8 device: handle master-ready before scheduling stage2
Don't handle master-ready at the beginning of stage2, but instead while
scheduling (and then possibly delaying the scheduling of stage2).

This seems more idiomatic:

  When inside a stage and your part is done: call schedule-next-stage.
  That is, always schedule the next stage, not the current one.
  schedule-next-stage then might delay to really scheduling until the
  device is ready for the next state.

Fixes: 85ac903bb8
(cherry picked from commit 7bbc090387)
2015-10-06 17:41:30 +02:00
Thomas Haller
5c20dd9ea3 device: fix activating master/slave devices during stage2
During stage2, if the slave detected that it would need to wait for
the master, it would return FALSE (which removes the g-idle-handler).

However, it would not clear the activation-source, so later, when
the master becomes ready, its attempt to schedule stage2 again would
result in an error-log and the idle-handler would not be scheduled
again.

Fixes: 85ac903bb8
https://bugzilla.redhat.com/show_bug.cgi?id=1268797
https://bugzilla.redhat.com/show_bug.cgi?id=1183444
(cherry picked from commit c5210b322d)
2015-10-06 17:41:27 +02:00
Thomas Haller
9796eace51 code: merge branch 'th/enslave-team-rh1183444'
https://bugzilla.redhat.com/show_bug.cgi?id=1183444

(cherry picked from commit 18b20c4f6f)
2015-10-02 18:52:37 +02:00
Thomas Haller
5f8aa51e63 device: fix activating slave device when stage1 delays action
When activating for example a team device which is to be enslaved to a
bridge, nm_device_activate_stage1_device_prepare() will postpone
stage 2.

In that case, we didn't register the "master-ready" of the team
device and thus never progressed the slave from stage2.

Reproduce:

  # nmcli connection delete t-br0
  # nmcli connection delete t-team0
  nmcli connection add type bridge con-name t-br0   autoconnect no ifname i-br0 ip4 192.168.177.100/24 gw4 192.168.177.1
  nmcli connection add type team   con-name t-team0 autoconnect no ifname i-team0
  nmcli connection modify id t-team0 connection.master i-br0 connection.slave-type bridge
  nmcli connection up t-team0
2015-10-02 18:51:15 +02:00
Thomas Haller
86b6b6ed32 device: use nm_clear_g_signal_handler() to clear master-ready signal handler 2015-10-02 18:51:15 +02:00
Thomas Haller
720c53f9f1 macros: add nm_clear_g_signal_handler() helper 2015-10-02 18:51:15 +02:00
Jiří Klimeš
1649fb2928 wifi: emit NEW_BSS on ScanDone to update APs in Wi-Fi device (rh #1267327)
When a Wi-Fi is switched to AP mode, NMDeviceWifi forgets the AP scan list.
Later, when the device goes back to normal managed mode, the device was not
able to acquire the AP list again (for a long time), because the list is only
populated when a new BSS is signalled. And that could take very long or never
happen as the supplicant would have to lost the BSS and announce it later.

Fix the problem by announcing known BSSs as a response to ScanDone signal.

Testcase:
$ nmcli con add type wifi ifname wlan0 con-name my-wifi-ap autoconnect off ssid MYSSID
$ nmcli con modify my-wifi-ap wifi.mode ap ipv4.method shared
$ nmcli con up my-wifi-ap
$ nmcli con down my-wifi-ap
$ nmcli device wifi list

https://bugzilla.redhat.com/show_bug.cgi?id=1267327
2015-10-02 09:16:00 +02:00
Jiří Klimeš
4b9b3d02c9 supplicant: fix BSSs property type
BSSs property is an array of object paths, not strings.
2015-10-02 09:16:00 +02:00
Lubomir Rintel
f7617511bb nm-vpn-service-plugin: increase the quit timer
We now (since 3272ff6 libnm/libnm-glib: don't quit in the middle of asking for
secrets) always hook on the quit timer when NM asks the plugin if it needs
secrets. The timer is 20 seconds, which seems too short.

Let's make it three minutes. Don't bother adding another timer or using a
distinct timeout: it does no harm for the plugin to remain unused for three
minutes on a bus.

Another option would be to completely unhook it; however the plugin wouldn't
learn if the user cancelled the NM's secrets request and would remain unused
on the bus forever.

(cherry picked from commit b1512221bc)
2015-10-01 17:38:21 +02:00
Thomas Haller
e0ca2bdb63 build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h"
For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus
paths of NetworkManager. It is desirable to have this header usable without
having a dependency on "glib.h", for example for a QT application. For that,
commit c0852964a8 removed that dependancy.

For libnm-glib library, the analog to "nm-dbus-interface.h" is
"NetworkManager.h", and the same applies there. Commit
159e827a72 removed that include.
However, that broke build on PackageKit [1] which expected to get the
version macros by including "NetworkManager.h". So at least for libnm-glib,
we need to preserve old behavior so that a user including
"NetworkManager.h" gets the version macros, but not "glib.h".

Extract the version macros to a new header file "nm-version-macros.h".
This header doesn't include "glib.h" and can be included from
"NetworkManager.h". This gives as previous behavior and a glib-free
include.

For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h".
Very few users will actually need the version macros, but not using
libnm.
Users that use libnm, should just include (libnm's) "NetworkManager.h" to
get all headers.
As a special case, a user who doesn't want to use glib/libnm, but still
needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include
them both separately.

[1] https://github.com/hughsie/PackageKit/issues/85

Fixes: 4545a7fe96
(cherry picked from commit 7bf10a75db)
2015-09-30 23:35:52 +02:00
Lubomir Rintel
e19d5519ca dnsmasq-manager: forget the watch when the callback hits
It removes the source, we shouldn't try to remove it on dispose() then.

(cherry picked from commit 4fe86b0031)
2015-09-30 23:13:10 +02:00
Lubomir Rintel
e88161172e tui: add a missing include to fix build
Fixes: 269a4483be
2015-09-30 19:37:10 +02:00
Thomas Haller
269a4483be tui: fix crash during activation when failed to create secret-agent
NetworkManager only allows one 'client:user-id' to register as secret
agent. Thus, when starting nmtui in two terminals, creating the secret
agent can fail.

This can lead to a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=755883
(cherry picked from commit b861900d45)
2015-09-30 17:38:04 +02:00
Lubomir Rintel
3f08333847 build: add .travis.yml
(cherry picked from commit df27e6d5fd)
2015-09-30 13:53:24 +02:00
Lubomir Rintel
e69924235d 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]

(cherry picked from commit b38bc15747)
2015-09-30 10:58:56 +02:00
Lubomir Rintel
105e30efba 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: 9b79e6c732

https://bugzilla.gnome.org/show_bug.cgi?id=754781
(cherry picked from commit e0fa48f224)
2015-09-29 18:25:54 +02:00
Jiří Klimeš
9736327b26 wifi: fix a crash in on_bss_proxy_acquired() (rh #1266003)
g_dbus_proxy_get_cached_property_names() function can return NULL.

 Program received signal SIGSEGV, Segmentation fault.
 on_bss_proxy_acquired (proxy=0x7fffe4003880 [GDBusProxy], result=0x895490, user_data=<optimized out>) at supplicant-manager/nm-supplicant-interface.c:159
 159		while (*iter) {
 (gdb) bt
 #0  0x000000000048fac7 in on_bss_proxy_acquired (proxy=0x7fffe4003880 [GDBusProxy], result=0x895490, user_data=<optimized out>)
     at supplicant-manager/nm-supplicant-interface.c:159
 #1  0x0000003bf84728b7 in g_simple_async_result_complete (simple=0x895490 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
 #2  0x0000003bf8472919 in complete_in_idle_cb (data=<optimized out>) at gsimpleasyncresult.c:775
 #3  0x0000003bf5c497fb in g_main_context_dispatch (context=0x7d6420) at gmain.c:3111
 #4  0x0000003bf5c497fb in g_main_context_dispatch (context=context@entry=0x7d6420) at gmain.c:3710
 #5  0x0000003bf5c49b98 in g_main_context_iterate (context=0x7d6420, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
 #6  0x0000003bf5c49ec2 in g_main_loop_run (loop=0x7d64e0) at gmain.c:3975
 #7  0x00000000004349d6 in main (argc=1, argv=0x7fffffffe598) at main.c:486

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

(cherry picked from commit 33527341b1)
2015-09-29 12:49:35 +02:00
Lubomir Rintel
f909ce18dc 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
(cherry picked from commit 8e6a839d93)
2015-09-28 19:50:58 +02:00
Thomas Haller
f7234f11ad 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
(cherry picked from commit 4545a7fe96)
2015-09-26 13:38:36 +02:00
Dan Williams
af9383c6d2 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
(cherry picked from commit 5b374a4a9f)
2015-09-25 11:28:09 -05:00
Thomas Haller
e002b6a4fe libnm: add NM_AVAILABLE_IN_1_0_6 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_0_6 macro.

(cherry picked from commit c60ff9e7e0)
2015-09-25 16:23:48 +02:00
Jiří Klimeš
b1dffe1391 libnm-core/libnm-util: fix an erroneous error message
ipv6.dns: 'this property is not allowed for '%s=%s'' not allowed for method=ignore

(cherry picked from commit 12e6cf1f20)
2015-09-25 16:15:38 +02:00
Jiří Klimeš
1b253ee722 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

(cherry picked from commit ecf0849355)
2015-09-25 16:15:29 +02:00
Thomas Haller
d0e367aeb7 libnm-util: don't include "nm-version.h" in "NetworkManager.h"
We want "NetworkManager.h" to have no dependancy on libnm and glib.

(cherry picked from commit 159e827a72)
2015-09-25 15:56:48 +02:00
Thomas Haller
ea8e3b88d1 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".

(cherry picked from commit c0852964a8)
2015-09-25 15:51:36 +02:00
Jiří Klimeš
f9757b7d5b man: fix in nm-settings-ifcfg-rh description
(cherry picked from commit 66b7e45708)
2015-09-25 13:26:02 +02:00
Jiří Klimeš
a0ffb5ad19 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

(cherry picked from commit eecb4c46cc)
2015-09-25 10:20:56 +02:00
Quentin Glidic
4971ce9a12 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>
(cherry picked from commit 2a4a222d95)
2015-09-24 16:33:12 +02:00
Thomas Haller
2eeadb977f systemd: merge branch 'th/systemd-dhcp-timer-rh1260727'
https://bugzilla.redhat.com/show_bug.cgi?id=1260727

(cherry picked from commit 1b7196ec51)
2015-09-24 11:00:05 +02:00
Thomas Haller
fe70a87f94 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
(cherry picked from commit 401a2eb834)
2015-09-24 10:57:41 +02:00
Thomas Haller
0e6a13bccc 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.

(cherry picked from commit 2d2d742cf1)
2015-09-24 10:56:04 +02:00
Thomas Haller
11237a0a66 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.

(cherry picked from commit 02c51d4231)
2015-09-24 10:56:02 +02:00
Thomas Haller
55e46923c0 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.

(cherry picked from commit 9901047ae3)
2015-09-24 10:56:01 +02:00
Thomas Haller
8c08014f47 systemd/adapt: use slice-allocator for struct sd_event_source
(cherry picked from commit fb0e87be39)
2015-09-24 10:56:00 +02:00
Thomas Haller
436ed50f4a systemd/adapt: refactor creation of struct sd_event_source
(cherry picked from commit 41917a52c0)
2015-09-24 10:55:53 +02:00
Thomas Haller
972865bc4e 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.

(cherry picked from commit d6370d09e6)
2015-09-24 10:55:37 +02:00
Jiří Klimeš
e6160d3bc4 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

(cherry picked from commit 94bbe7465f)
2015-09-23 13:01:25 +02:00
Jiří Klimeš
19bcc95d48 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

(cherry picked from commit 2318c0de92)
2015-09-22 13:05:37 +02:00
Jiří Klimeš
b010870d84 manager: cleanup NMRfkillManager in dispose()
Fixes: b15fb8641e

(cherry picked from commit 85d7dc1a0f)
2015-09-22 08:29:50 +02:00
Jiří Klimeš
117fd7ef51 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

(cherry picked from commit dd8c3ef3a0)
2015-09-22 08:29:50 +02:00
Jiří Klimeš
3e26774e06 merge: fix ADSL in nmcli and libnm-core/libnm-utils (rh #1264089)
- implements 'nmcli connection add type adsl'
- initializes adsl.protocol for 'nmcli con edit type adsl'
- fixes errors in adsl properties in libnm-core/libnm-util

(cherry picked from commit e9f9f4ecb9)
2015-09-21 15:50:45 +02:00
Jiří Klimeš
b590a31839 cli: allow creating ADSL connections with 'nmcli connection add' (rh #1264089)
https://bugzilla.redhat.com/show_bug.cgi?id=1264089

(cherry picked from commit 290c1626b9)
2015-09-21 15:49:38 +02:00
Jiří Klimeš
9bca3b7a37 cli: initialize adsl.protocol in editor when creating a new connection
The protocol is required and it is nice to have a valid initial value for
the property.

(cherry picked from commit 5502d8691a)
2015-09-21 15:49:20 +02:00
Jiří Klimeš
1f7be49519 libnm-core/libnm-util: fix an assertion in adsl setting
(process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed

(cherry picked from commit 3d64d45d16)
2015-09-21 15:48:44 +02:00
Jiří Klimeš
890b27adc6 device: remove unused ip_iface
(cherry picked from commit 73d2bd53c5)
2015-09-21 09:19:13 +02:00
Jiří Klimeš
e8bf4bed02 wifi: remove unused variables
(cherry picked from commit 3b11b85753)
2015-09-21 09:18:19 +02:00
Thomas Haller
52923b6c73 platform: merge branch 'th/platform-permanent-hwaddr-rh1264024'
https://bugzilla.redhat.com/show_bug.cgi?id=1264024
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1256430

(cherry picked from commit b6459ace2f)
2015-09-18 13:41:53 +02:00
Thomas Haller
0f18a2ed23 platform: don't accept 00:00:00:00:00:00 as valid permanent address
In nmp_utils_ethtool_get_permanent_address(), don' accept a permanent
address of all zeros.

https://bugzilla.redhat.com/show_bug.cgi?id=1264024
(cherry picked from commit 2733aacd64)
2015-09-18 13:34:03 +02:00
Thomas Haller
6839a5f9e3 platform: stack-allocate request data for nmp_utils_ethtool_get_permanent_address()
(cherry picked from commit 2e66aea123)
2015-09-18 13:33:59 +02:00