Commit graph

12466 commits

Author SHA1 Message Date
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
Thomas Haller
e8f5005d3d platform: merge branch 'th/platform-refresh-link-bgo754996'
https://bugzilla.gnome.org/show_bug.cgi?id=754996

(cherry picked from commit 54afd0400b)
2015-09-18 11:31:37 +02:00
Thomas Haller
91c00072f2 platform: cancel delayed action REFRESH_LINK when receiving an update
When we receive an update for a link, cancel a scheduled
REFRESH_LINK delayed-action for that ifindex. At the point when we
scheduled refrehing the link, we only cared about receiving a
notification that was newer then the current state.

We scheduled requesting this new notification to resync the cache.
It is not necessary to actually request a new update, any update we
receive *after* requesting a new update will suffice.

This potentially saves extra round-trips re-requesting the link.

(cherry picked from commit f4f4e1cf09)
2015-09-18 11:30:53 +02:00
Thomas Haller
e79caf9b4a platform: refresh links when parent gets removed
When moving a link to another netns, it gets removed from
NMPlatform's view.

Currently kernel does not sent a notification to inform about
that change (see related bug rh#1262908).

Ensure that we reload all linked interfaces which now might
have an invisible parent.

(cherry picked from commit 2cd6aaa918)
2015-09-18 11:30:52 +02:00
Thomas Haller
bdbc3bbb7b platform: fix handling refresh-link delayed actions
Due to a bug, we would only handle one REFRESH_LINK delayed action
and ignore the ones queued afterwards.

Fixes: 051cf8bbde
(cherry picked from commit eee240ffe8)
2015-09-18 11:30:51 +02:00
Jiří Klimeš
3543cbdfc2 coverity: calm coverity for clock_gettime() return value check
Defect type: CHECKED_RETURN
3. NetworkManager-1.0.6/src/platform/nm-linux-platform.c:1145: check_return: Calling "clock_gettime" without checking return value (as is done elsewhere 6 out of 7 times).

(cherry picked from commit 0f694f1a9a)
2015-09-18 08:46:27 +02:00
Thomas Haller
f05b42e6df dhcp/systemd: fix leaking leases after dhcp_lease_load()
Fixes: d2dd3b2c90
(cherry picked from commit 9e52613612)
2015-09-17 18:15:50 +02:00
Jiří Klimeš
0aa99069ed ifcfg-rh: ignore GATEWAY from network file for DHCP connections (rh #1262972)
The GATEWAY from /etc/sysconfig/network file is used as a default value when
no GATEWAY is in ifcfg file. However, we have to ignore that GATEWAY for
connections without static addresses. Otherwise such connections would be
invalid and would disappear after restart/reaload.

Some notes:
Putting GATEWAY into /etc/sysconfig/network is not recommended, because it
inherently belongs to the ifcfg file as it is a per-interface property.
The recommended practice is to specify GATEWAY in individual ifcfg files and
define DEFROUTE=no if the interface should not get the default route.
But we continue to read GATEWAY from /etc/sysconfig/network for compatibility
reasons.
See also
https://bugzilla.redhat.com/show_bug.cgi?id=896198#c25
https://bugzilla.redhat.com/show_bug.cgi?id=896198#c27

Fixes: f17699f4e3

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

(cherry picked from commit ed85fcc711)
2015-09-17 15:09:51 +02:00
Jiří Klimeš
827b49f089 ifcfg-rh: (trivial) remove unused network_file parameter
(cherry picked from commit 64e3873faf)
2015-09-17 15:09:01 +02:00
Thomas Haller
1bc3e1d513 systemd: fix systemd logging statements to show "file:line (func)" properly
Previously, we would stringify the arguments, resulting in logging
lines like
    "__FILE__:__LINE__(__PRETTY_FUNCTION__): assert return: ..."
2015-09-16 18:09:25 +02:00