Commit graph

19314 commits

Author SHA1 Message Date
Thomas Haller
a0e4dd7ade core: reorder code in "src/dns/nm-dns-manager.c"
Just moving code around, no other changes.

Follow a certain prefered order of declarations
in source files.

(cherry picked from commit 3d86429c9d)
2018-10-19 18:39:31 +02:00
Beniamino Galvani
2da1366905 core: drop unused macro argument
(cherry picked from commit 057744b722)
2018-10-19 18:39:31 +02:00
Thomas Haller
cca492af14 ifcfg: fix crash parsing more than 10 DNS settings in make_ip6_setting()
On master, commit [1] added a double-free error. This was
unintentionally fixed later in commit [2].

Commit [1] was backported to nm-1-10 branch in 1.10.10.

Fix it.

[1] a9b5079324, 1.11.2-dev
[2] e9321713a9, 1.12-rc1

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

Fixes: b2a9e2f326
2018-10-19 18:07:04 +02:00
Thomas Haller
5afec82a5c ndisc: merge branch 'th/ndisc-addr-lifetime'
https://github.com/NetworkManager/NetworkManager/pull/228

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/57
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1796622

(cherry picked from commit 3baa016f89)
(cherry picked from commit 8c24119859)
(cherry picked from commit c7d8f17094)
2018-10-13 20:50:44 +02:00
Thomas Haller
2c47cf51b1 ndisc: don't update dad_counter for addresses in router config
I am not sure, we ever call complete_address() for router-configurations.
Maybe not, so the dad-counter is never incremented and does not matter either.

If we however do, then we certainly want to preserve the DAD counter
when the address is already tracked.

(cherry picked from commit 8c6629b356)
(cherry picked from commit 036d1f56ea)
(cherry picked from commit 148c9d9b0c)
2018-10-13 20:50:18 +02:00
Thomas Haller
cc16d89395 ndisc: fix updating address lifetime on Router Announcement according to RFC4862
This is a denial-of-service protection, where a malicious router
advertisement can expire the addresses.

See-also: 6554550f35
See-also: https://tools.ietf.org/search/rfc4862#section-5.5.3

https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1796622
(cherry picked from commit 27be3e0338)
(cherry picked from commit 8e2ccd3921)
(cherry picked from commit 451bf6e275)
2018-10-13 20:50:18 +02:00
Thomas Haller
2e365f638b ndisc: handle integer overflows better for lifetime handling
we use get_expiry() to compare two lifetimes. Note, that previously,
it would correctly truncate the calculated expiry at G_MAXINT32-1.

However, that means, that two different lifetimes that both lie
more than 68 years in the future would compare equal.

Fix that, but extending the range to int64, so that no overflow
can happen.

(cherry picked from commit b086535cb7)
(cherry picked from commit fe60843232)
(cherry picked from commit 42e61a8cc8)
2018-10-13 20:50:18 +02:00
Thomas Haller
3d99992593 ndisc: minor refactoring loop in nm_ndisc_add_address()
No change in behavior. Just don't do so much work inside
the deeper nesting of the loop.

(cherry picked from commit 9d0a138ef0)
(cherry picked from commit 3cecb4d018)
(cherry picked from commit 669e004299)
2018-10-13 20:50:18 +02:00
Thomas Haller
d4b67b9441 ndisc: only generate address interface identifer after checking existing prefix
RFC4862 5.5.3, points d) and e) make it clear, that the list of
addresses should be compared based on the prefix.

  d)  If the prefix advertised is not equal to the prefix of an
    address configured by stateless autoconfiguration already in the
    list of addresses associated with the interface (where "equal"
    means the two prefix lengths are the same and the first prefix-
    length bits of the prefixes are identical), and if the Valid
    Lifetime is not 0, form an address (and add it to the list) by
    combining the advertised prefix with an interface identifier of
    the link as follows:

That means, we should not initialize the interface identifier first
(via complete_address()) and then search for the full address.

See-also: https://tools.ietf.org/search/rfc4862#section-5.5.3
(cherry picked from commit 23c417854a)
(cherry picked from commit ac5669633c)
(cherry picked from commit b2f084a8ae)
2018-10-13 20:50:18 +02:00
Thomas Haller
aeca2fb4b1 ndisc: ensure we skip unspecified IPv6 address in ndisc_set_router_config()
Later, nm_ndisc_add_address() asserts that the address is not an
unspecified address. Skip it, just to be sure.

(cherry picked from commit 700b04d0de)
(cherry picked from commit e0e698e463)
(cherry picked from commit 547dcacbfb)
2018-10-13 20:50:18 +02:00
Thomas Haller
8177b0c397 ndisc: ignore addresses with preferred lifetime larger than lifetime
Previously, we would coerce the value so that preferred is the same
as lifetime. However, RFC4862 5.5.3.c) says:

  c)  If the preferred lifetime is greater than the valid lifetime,
    silently ignore the Prefix Information option.  A node MAY wish to
    log a system management error in this case.

See-also: https://tools.ietf.org/search/rfc4862#section-5.5.3
(cherry picked from commit 43c3c259c8)
(cherry picked from commit eff9e161cb)
(cherry picked from commit dbfa7950cf)
2018-10-13 20:50:18 +02:00
Thomas Haller
f231b2b9b7 ndisc: merge branch 'th/ndisc-fixes'
https://github.com/NetworkManager/NetworkManager/pull/219

(cherry picked from commit 6e41d79067)
(cherry picked from commit 8ee0ca8cce)
(cherry picked from commit 685573e049)
2018-10-13 20:49:37 +02:00
Thomas Haller
fc9ad78f3a ndisc: always emit changed signal if an ndisc parameter changes
Note how the nm_ndisc_add_*() return a boolean to indicate whether
anything changes. That is taken to decide whether to emit a changed
signal.

Previously, we would not consider all fields which are exposed
as public API.

Note that nm-ip6-config.c would care about the lifetime of NMNDiscAddress.
For that, nm_ndisc_add_address() would correctly consider a change of
the lifetime as relevant. So, this was for the most part not broken.
However, for example nm_ndisc_add_route() would ignore changes to the
gateway.

Always signal changes if anything changes at all. It's more correct
and robust.

(cherry picked from commit 98ec56c670)
(cherry picked from commit 2e12660dd4)
(cherry picked from commit 9f6a654999)
2018-10-13 20:48:53 +02:00
Thomas Haller
3a2e6c5172 ndisc/trivial: move code
(cherry picked from commit 4f78d82fcd)
(cherry picked from commit bd41719f95)
(cherry picked from commit cdc5848be7)
2018-10-13 20:48:53 +02:00
Thomas Haller
ba6490e00e ndisc: abort handling IO in event_ready() if we are unable to switch namespace
It should never happen that we are unable to switch the namespace.
However, in case it does, we cannot just return G_SOURCE_CONTINUE,
because we will just endlessly trying to process IO without actually
reading from the socket.

This shouldn't happen, but the instance is hosed and something is
very wrong. No longer handle the socket to avoid an endless loop.

(cherry picked from commit d444fcde34)
(cherry picked from commit 6631debaa3)
(cherry picked from commit 5c56404dfc)
2018-10-13 20:48:53 +02:00
Thomas Haller
9a06bb2b7b ndisc: keep NMNDisc instance alive while processing IO in event_ready()
event_ready() calls ndp_callall_eventfd_handler(), which invokes
our own callback, which may invoke change notification.

At that point, it's not guaranteed that the signal handler won't
destroy the ndisc instance, which means, the "struct ndp" gets destroyed
while invoking callbacks. That's bad, because libndp is not robust
against that.

Ensure the object stays alive long enough.

(cherry picked from commit 9aa628cedb)
(cherry picked from commit efb9e2bc6b)
(cherry picked from commit 2ba6d74bca)
2018-10-13 20:48:53 +02:00
Thomas Haller
391587731c ndisc: first reschedule timeout before invoking change event in check_timestamps()
It's just ugly to invoke external code in the middel of an operation.
You never know, whether the handler won' unref the ndisc instance.

(cherry picked from commit 1f856b7cb3)
(cherry picked from commit a3c73e783b)
(cherry picked from commit 6858e794f3)
2018-10-13 20:48:49 +02:00
Thomas Haller
deedb10600 ndisc/trivial: indentation and add "const" to auto variable
(cherry picked from commit 9ff6134814)
2018-10-13 20:46:53 +02:00
Thomas Haller
eca12c2ee1 device/ndisc: skip link-local addresses from NDisc
(cherry picked from commit fa09e7eb53)
2018-10-13 20:28:26 +02:00
Thomas Haller
cb5a47a4db ndisc/trivial: rename name for internal signal enum to match signal name
(cherry picked from commit ede4dd70f3)
2018-10-13 20:28:08 +02:00
Thomas Haller
8389888e08 ndisc: ensure proper lifetime of NMNDiscAddress in ndisc_set_router_config()
In ndisc_set_router_config(), we initialize NMNDiscAddress based on
NMPlatformIP6Address instances. Note that their handling of timestamps
is not entirely identical.

For convenience of the user, NMPlatformIP6Address allows to not specify
any timestamp. On the contrary, for convenience of implementation does
NMNDiscAddress always require fully specified timestamps.

Properly convert one representation into the other.

(cherry picked from commit 5c4f4b3540)
2018-10-13 20:27:20 +02:00
Thomas Haller
2ff8ece27e device: add const specifier to nm_ndisc_dad_failed() argument
(cherry picked from commit cd6cf0ea36)
2018-10-13 20:26:14 +02:00
Thomas Haller
b9dace0aa3 ndisc: adjust logging of timeouts for NDisc result
Previously, we would directly log get_expiry(), which is the absolute timestamp
inn nm_utils_get_monotonic_timestamp_s() scale. This time scale starts counting
somewhere around the time when the NetworkManager process starts, hence it is not
very intuitive to look at.

Instead, print the remaining time that is left counting from now. Since
we anyway only track timeouts with a granularity of whole seconds,
printing up to 4 decimal places is sufficiently precise.

(cherry picked from commit b680cdd063)
2018-10-13 20:25:37 +02:00
Thomas Haller
e3e86af74e wwan: don't assume DNS info is always available for IPv6
See also "5df024f57a wwan: don't assume DNS info is always available"
which does the same for IPv4.

(cherry picked from commit cec7ade86c)
(cherry picked from commit 00f14736e6)
(cherry picked from commit 7c09527d5e)
2018-10-12 00:19:20 +02:00
Lubomir Rintel
00bc0ae30c devices/olpc: correct the signal handler arguments
Commit 631ca806 ("devices/wifi: flip meaning of scanning allowed
signal") added a "periodic" argument, but the OLPC companion handler was
not adjusted. Fix it now.

https://github.com/NetworkManager/NetworkManager/pull/222

Fixes: 631ca80692
(cherry picked from commit aa0e395530)
2018-10-09 20:27:05 +02:00
Beniamino Galvani
12e2d62673 wifi: support hidden ssid in AP mode
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/48
(cherry picked from commit 5d97e76c7d)
(cherry picked from commit f235d57a3a)
(cherry picked from commit 6f6a810189)
2018-09-27 14:21:14 +02:00
Thomas Haller
b02000a2f3 libnm/doc: explicitly point out privacy issue of setting wifi.hidden
(cherry picked from commit bca28c8c0c)
2018-09-27 14:21:10 +02:00
Thomas Haller
e74f310d30 release: bump version to 1.10.13 (development) 2018-09-18 15:21:37 +02:00
Thomas Haller
912548d37a release: bump version to 1.10.12 2018-09-18 15:21:37 +02:00
Thomas Haller
b74cd2a2b3 release: update NEWS 2018-09-18 15:21:37 +02:00
Thomas Haller
f4af4e1d5a vpn: disconnect signal handlers from proxy in NMVpnConnection::dispose()
We cannot be sure who holds a reference to the proxy, and
who is gonna call us back after the VPN connection instance
is destroyed.

(cherry picked from commit 6ebb9091d2)
(cherry picked from commit f71f9b54a8)
(cherry picked from commit 6c1cbe4d61)
2018-09-14 15:25:53 +02:00
Thomas Haller
6fd26b6a46 vpn: fix assertion during "SecretsRequired" in unexpected state
Got this assertion:

    NetworkManager[12939]: <debug> [1536917977.4868] active-connection[0x563d8fd34540]: set state deactivated (was deactivating)
    ...
    NetworkManager[12939]: nm-openvpn[1106] <info>  openvpn[1132]: send SIGTERM
    NetworkManager[12939]: nm-openvpn[1106] <info>  wait for 1 openvpn processes to terminate...
    NetworkManager[12939]: nm-openvpn[1106] <warn>  openvpn[1132] exited with error code 1
    NetworkManager[12939]: <info>  [1536917977.5035] vpn-connection[0x563d8fd34540,2fdeaea3-975f-4325-8305-83ebca5eaa26,"my-openvpn-Red-Hat",0]: VPN plugin: requested secrets; state disconnected (9)
    NetworkManager[12939]: plugin_interactive_secrets_required: assertion 'priv->vpn_state == STATE_CONNECT || priv->vpn_state == STATE_NEED_AUTH' failed

Meaning. We should either ensure that secrets_required_cb() signal callback
is disconnected from proxy's signal, or we gracefully handle callbacks at
unexpected moments. Do the latter.

(cherry picked from commit 92344dd084)
(cherry picked from commit 011dd919fa)
(cherry picked from commit 0e633c232d)
2018-09-14 15:25:52 +02:00
Thomas Haller
4a345b2e78 wifi: fix leaking fake AP in NMDeviceWifi's act_stage1_prepare()
Fixes: 96f40dcdcd
(cherry picked from commit ef61d7909f)
(cherry picked from commit d08530ac4b)
(cherry picked from commit 6c4c12c796)
2018-09-13 16:30:14 +02:00
Aleksander Morgado
eebaf181d5 policy: don't block connection if device is gone
If the active connection is deactivated because the device is gone,
don't block autoconnection. Otherwise, whenever the device comes
back (e.g. maybe it was reset in the middle of a connection attempt),
the autoconnection logic won't be triggered, as the settings are still
blocked.

I'm able to reproduce this by performing a WWAN modem reset in the
middle of a connection attempt.

https://github.com/NetworkManager/NetworkManager/pull/121
(cherry picked from commit d97eab6c5a)
2018-09-13 15:16:02 +02:00
Thomas Haller
0a69572cae dhcp: fix leak in dhclient's dhclient_start()
Fixes: 5d6d5cd136
(cherry picked from commit c87faf07a1)
(cherry picked from commit 8f9240de96)
(cherry picked from commit c740726b57)
2018-09-10 14:39:12 +02:00
Thomas Haller
71e2a25a0d libnm/keyfile: fix double free in keyfile's get_bytes()
Fixes: 5e7b14af03
(cherry picked from commit fcf254c03a)
(cherry picked from commit 1c56be4090)
2018-09-04 07:49:23 +02:00
Beniamino Galvani
9b46af1a62 libnm-core: support private keys encrypted with AES-{192,256}-CBC
https://github.com/NetworkManager/NetworkManager/pull/189
(cherry picked from commit 93f85edcce)
(cherry picked from commit 74fc6f30b2)
2018-08-30 10:09:17 +02:00
Thomas Haller
7689b9b73b wifi: don't use :1 bitfield for gboolean type
gboolean is a typedef for "int".

While older compilers might treat such bitfields as unsigned ([1]),
commonly such a bitfield is signed and can only contain the values 0
and -1.

We only want to use numeric 1 for TRUE, hence, creating such bitfields
is wrong, or at least error prone.

In fact, in this case it's a bug, because later we compare
it with a regular gboolean

  if (priv->scanning != new_scanning)

[1] https://lgtm.com/rules/1506024027114/

Fixes: e0f9677018
(cherry picked from commit 610ca87016)
(cherry picked from commit f326feaba3)
2018-08-26 18:34:06 +02:00
Rodrigo
38d8d10249 po: update Spanish (es) translation (bgo #796849)
https://bugzilla.gnome.org/show_bug.cgi?id=796849
2018-08-01 15:07:55 +02:00
Beniamino Galvani
cd6c17cb21 libnm: add (allow-none) annotations to nm_device_reapply()
The @connection argument can be NULL; add the (allow-none) annotation
otherwise calling the API with a NULL argument through GObject
introspection fails with:

 Argument 1 does not allow None as a value

Fixes: 278fd4fb0f
(cherry picked from commit f396826466)
(cherry picked from commit a03b867ba4)
2018-07-04 14:15:33 +02:00
Lubomir Rintel
00bdd67e08 ovs: only finish waiting for a link when we actually got one
https://bugzilla.redhat.com/show_bug.cgi?id=1546659
(cherry picked from commit 7af1bc7cf0)
2018-06-19 10:12:38 +02:00
Thomas Haller
ce5b8ac8a4 release: bump version to 1.10.11 (development) 2018-06-16 08:48:38 +02:00
Thomas Haller
25c3239d04 release: bump version to 1.10.10 2018-06-16 08:48:38 +02:00
Thomas Haller
8d4d3f8246 release: update NEWS 2018-06-16 08:48:38 +02:00
Thomas Haller
dccc449522 ifnet: avoid compiler warning about casting function pointers
../../src/settings/plugins/ifnet/nms-ifnet-plugin.c: In function ‘monitor_file_changes’:
  ../../src/settings/plugins/ifnet/nms-ifnet-plugin.c:140:42: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, GObject *)’ {aka ‘void (*)(void *, struct _GObject *)’} [-Werror=cast-function-type]
     g_object_weak_ref (G_OBJECT (monitor), (GWeakNotify) g_free,
                                            ^
2018-06-16 08:48:38 +02:00
Thomas Haller
28cf2ecd0d device: fix crash during reapply
Fixes: bf3b3d444c
(cherry picked from commit fe1f5871c8)
2018-06-15 09:13:49 +02:00
Lubomir Rintel
66b35bc5a2 Revert "platform/wifi: do not double-free nl_msg"
I've applied this without much thinking. Despite applying cleanly it
doesn't do the right thing before nm_auto_nlmsg was introduced.
Whoops.

This reverts commit bc41a9ba75.
2018-06-01 12:08:14 +02:00
Lubomir Rintel
783093f04f ifnet: add dependency on nm-core-enum-types.h
Fixes parallel build:

  In file included from src/settings/plugins/ifnet/nms-ifnet-connection.c:22:
  In file included from ./shared/nm-default.h:203:
  In file included from ./src/nm-logging.h:25:
  ./libnm-core/nm-core-types.h:28:10: fatal error: 'nm-core-enum-types.h' file not found
  #include "nm-core-enum-types.h"
           ^~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  make[2]: *** [Makefile:13628: src/settings/plugins/ifnet/src_settings_plugins_ifnet_libnm_settings_plugin_ifnet_la-nms-ifnet-connection.lo] Error 1
2018-06-01 11:04:12 +02:00
Lubomir Rintel
520542fc45 ppp-manager: fix build with GCC 8
src/ppp/nm-ppp-manager.c: In function ‘monitor_cb’:
src/ppp/nm-ppp-manager.c:184:2: error: ‘strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
  strncpy (req.ifr_name, priv->ip_iface, sizeof (req.ifr_name));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-06-01 10:58:46 +02:00
Lubomir Rintel
5052c8793d build: add a missing dependency
Parallel make failed for me:

  /usr/bin/xsltproc --output man/nm-settings-keyfile.xml ...
    ... man/nm-settings-keyfile.xsl libnm/nm-settings-keyfile-docs.xml
  man/nm-settings-keyfile.xsl:4: warning: failed to load external entity "man/common.ent"
  %entities;
            ^
  man/nm-settings-keyfile.xsl:26: parser error : Entity 'NM_VERSION' not defined
          <refmiscinfo class="version">&NM_VERSION;</refmiscinfo>
                                                   ^
  cannot parse man/nm-settings-keyfile.xsl
  make[2]: *** [Makefile:18130: man/nm-settings-keyfile.xml] Error 4

(cherry picked from commit 43e3ebfaa2)
2018-06-01 10:55:13 +02:00