Commit graph

21106 commits

Author SHA1 Message Date
Thomas Haller 0dda7586e4 travis: enabling building more optional components during CI with meson
After fixing meson build for these components, enable them for
build in travis.
2018-09-13 11:49:25 +02:00
Beniamino Galvani 8e776955ee build: rename DNSSEC_TRIGGER_SCRIPT to DNSSEC_TRIGGER_PATH
Rename the define for consistency, since the configure option is named
'dnssec-trigger'.
2018-09-13 11:49:25 +02:00
Beniamino Galvani ff837b2686 build: print both pppd path and plugins path in configure summary
Reported-by: Michael Biebl <biebl@debian.org>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/25
2018-09-13 11:53:35 +02:00
Beniamino Galvani 8c77ca1a6d build: meson: fix NMSTATEDIR path
Reported-by: Michael Biebl <biebl@debian.org>
2018-09-13 11:49:25 +02:00
Beniamino Galvani e2522c8c2d build: meson: add missing libnm-core header file
Reported-by: Michael Biebl <biebl@debian.org>
Fixes: df30651b89
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/31
2018-09-13 11:51:13 +02:00
Beniamino Galvani dfa2a2b40c build: meson: generate and use a linker script for NM binary
Generate the NetworkManager.ver link script to link the NM binary so
that unneeded symbol are unexported and can be dropped, reducing the
binary size.

Reported-by: Michael Biebl <biebl@debian.org>
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/33
2018-09-13 11:50:45 +02:00
Beniamino Galvani 9b4bc0824c build: support meson builds in create-exports script 2018-09-13 11:49:25 +02:00
Beniamino Galvani 5ebe5efa7a build: add config-extra.h.meson to EXTRA_DIST
Reported-by: Michael Biebl <biebl@debian.org>
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/22
2018-09-13 11:50:39 +02:00
Beniamino Galvani bd556c8937 ifcfg-rh: fix build with meson
The shared object was missing some files.
2018-09-13 11:49:25 +02:00
Beniamino Galvani 8b313d4c54 build: autotools: remove unused defines
Remove AC_DEFINE()s that add unused entries to config.h.
2018-09-13 11:49:25 +02:00
Beniamino Galvani 2fd7559819 build: meson: uniform handling of rc managers
Handle all rc managers paths through the same code.
2018-09-13 11:49:25 +02:00
Beniamino Galvani 36b0e46146 build: meson: uniform handling of dhcp client paths
Handle all dhcp client paths through the same code.
2018-09-13 11:49:25 +02:00
Beniamino Galvani 087c367d62 build: move paths of dhcp clients from config-extra.h to config.h
Some path variable like $(bindir), $(datadir), etc. are special for
autotools and must be handled separately through config-extra.h.

But dhcp path variables are just normal variables defined through
the configure script and should go into config.h.
2018-09-13 11:50:32 +02:00
Beniamino Galvani e0c49d7341 build: remove check on dhcpcd version number
dhcpcd version 6, the first supporting IPv6, was released more than 5
years ago. Remove all checks on version number and IPv6 support.
2018-09-13 11:49:25 +02:00
Beniamino Galvani 9e61ea7040 build: remove check on dhclient version
dhclient 4.0 was released more than 10 years ago. I think it is
reasonable to expect that nobody is using an older version today.

https://source.isc.org/cgi-bin/gitweb.cgi?p=dhcp.git;a=shortlog;h=refs/tags/v4_0_0
2018-09-13 11:49:25 +02:00
Beniamino Galvani 794e499ab8 build: meson: fix pppd path
Allow specifying a non-existent path.
2018-09-13 11:49:25 +02:00
Beniamino Galvani 220dea0948 build: meson: fix setting iptables/dnsmasq/dnssec-trigger paths
Handle the iptables, dnsmasq and dnssec-trigger paths in the same way
through common code.

The path set by user must be accepted as is, even if does not exist,
because this is a requirement for cross-compilation. When user does
not specify a path, search a predefined set of paths and fall back to
an hardcoded one.
2018-09-13 11:49:25 +02:00
Beniamino Galvani d8a972c575 contrib/rpm: fix mode of ghost ifup/ifdown files
Set the execution bit on /usr/sbin/{ifup,ifdown} ghost files to match
the mode of same files installed by initscripts.

Otherwise, they will appear as changed according to rpm verify:

 .M.......  g /usr/sbin/ifdown
 .M.......  g /usr/sbin/ifup

when the alternatives mechanism is not in place.

 # ll /usr/sbin/if{up,down}
 -rwxr-xr-x. 1 root root 1651 Aug 24 06:23 /usr/sbin/ifdown
 -rwxr-xr-x. 1 root root 5010 Aug 24 06:23 /usr/sbin/ifup

https://bugzilla.redhat.com/show_bug.cgi?id=1626517
2018-09-13 10:13:52 +02:00
Thomas Haller e893405927 travis: enabling building more optional components during CI
A few components are still disabled. Most notably, team support
which is not available on Ubuntu 14.04 (trusty).

All other components which are disabled are bugs in our build tools.
It should be possible to enable them, but currently breaks on travis.
Those needs additional fixes.

In particular, the DHCP plugins and ifcfg-rh plugin with meson.

Also, netconfig plugin with autotools requires that the path exists.
2018-09-12 15:33:46 +02:00
Thomas Haller 08d19df209 build/meson: merge branch 'heftig/pr/12'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/12
2018-09-12 12:55:44 +02:00
Jan Alexander Steffens (heftig) 44f14e969b meson: Fix vapi build
Apparently vapigen can't find the NetworkManager-1.0.gir belonging to
libnm-util.vapi.
2018-09-12 12:04:30 +02:00
Jan Alexander Steffens (heftig) 4bfd0bab0d meson: Fix libnm-util build
This was broken by e01f7f2c6d.
Port the commit's changes from libnm to libnm-util.
2018-09-12 12:04:30 +02:00
Jan Alexander Steffens (heftig) 5b042b16ca meson: Use libexecdir for dnssec-trigger-script fallback
Use an `if` to keep line length down.
2018-09-12 12:04:30 +02:00
Jan Alexander Steffens (heftig) 1fad494c34 gitignore: Fix *.stamp ignore
ripgrep complains about the invalid `**`.
2018-09-12 12:04:30 +02:00
Thomas Haller f4de941d98 platform/netlink: cleanup error number handling
Rename variables for the error number. Commonly the naming
is:

  - errno: the error number from <errno.h> itself
  - errsv: a copy of errno
  - nlerr: a netlink error number
  - err: an error code, but not a errno/errsv and not
      a netlink error number.
2018-09-12 11:17:53 +02:00
Thomas Haller ac73c6f019 platform/trivial: adjust coding style in nm-netlink.c 2018-09-12 11:17:53 +02:00
Thomas Haller a83aa2dada device: merge branch 'th/dhcp-error-reason'
https://github.com/NetworkManager/NetworkManager/pull/199
2018-09-12 10:33:19 +02:00
Thomas Haller e8fa75ce06 dhcp: abort DHCP on devices without MAC address early
Internal DHCPv4 client requires a valid MAC address for functioning.
Just always require a MAC address to start DHCP, both v4 and v6.

We have no MAC address for example on Layer3 devices like tun or wireguard.

Also, before "34af574d58 systemd/dhcp: fix assertion starting DHCP
client without MAC address", if we tired to start sd_dhcp_client without
setting a MAC address, an assertion was triggered.
2018-09-12 10:33:02 +02:00
Thomas Haller 34af574d58 systemd/dhcp: fix assertion starting DHCP client without MAC address
An assertion in dhcp_network_bind_raw_socket() is triggered when
starting an sd_dhcp_client without setting setting a MAC address
first.

  - sd_dhcp_client_start()
    - client_start()
      - client_start_delayed()
        - dhcp_network_bind_raw_socket()

In that case, the arp-type and MAC address is still unset. Note that
dhcp_network_bind_raw_socket() already checks for a valid arp-type
and MAC address below, so we should just gracefully return -EINVAL.

Maybe sd_dhcp_client_start() should fail earlier when starting without
MAC address. But the failure here will be correctly propagated and
the start aborted.

See-also: https://github.com/systemd/systemd/pull/10054
2018-09-12 10:32:45 +02:00
Thomas Haller 1a4fe308e8 dhcp: return error reason from DHCP client start 2018-09-12 10:32:45 +02:00
Thomas Haller 4186ddb58b shared: add nm_errno() and nm_utils_error_set_errno() helper 2018-09-12 10:13:11 +02:00
Thomas Haller 2a45c32e8c ppp: cleanup logging in impl_ppp_manager_set_ifindex()
It's enough that all code paths in impl_ppp_manager_set_ifindex() log exactly
one message. Also, give all messages the same prefix, so that it's clear where
they come from.
2018-09-11 22:05:45 +02:00
Thomas Haller 4a4439835d ppp: downgrade warning about repeated SetIfindex calls from ppp plugin
In src/ppp/nm-pppd-plugin.c, it seems that pppd can invoke
phasechange(PHASE_RUNNING:) multiple times. Hence, the plugin
calls SetIfindex multiple times too. In nm-ppp-manager.c, we
want to make sure that the ifindex does not change after it
was set once. However, calling SetIfindex with the same ifindex
is not something worth warning. Just log a debug message and nothing.

Maybe the plugin should remember that it already set the ifindex,
and avoid multiple D-Bus calls. But it's unclear that that is desired.
For now, just downgrade the warning.
2018-09-11 21:55:11 +02:00
Thomas Haller 4d11eba8c5 ppp: avoid strncpy() in ppp plugin nm_phasechange()
strncpy() is deemed insecure, and it raises at least an eyebrow.
While it's save in this case, just avoid it.
2018-09-11 21:53:04 +02:00
Thomas Haller 30a469e0bb ppp-manager: avoid crash with nonexisting link in impl_ppp_manager_set_ifindex()
Fixes: dd98ada33f
2018-09-11 21:30:14 +02:00
Frederic Danis e66e4d0e71 ppp-manager: fix pppd not exiting correctly on modem hangup
When unplugging an USB 3G modem device, pppd does not exit correctly and
we have the following traces:

Sep 10 07:58:24.616465 ModemManager[1158]: <info>  (tty/ttyUSB0): released by device '/sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb4/4-1'
Sep 10 07:58:24.620314 pppd[2292]: Modem hangup
Sep 10 07:58:24.621368 ModemManager[1158]: <info>  (tty/ttyUSB1): released by device '/sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb4/4-1'
Sep 10 07:58:24.621835 ModemManager[1158]: <warn>  (ttyUSB1): could not re-acquire serial port lock: (5) Input/output error
Sep 10 07:58:24.621358 NetworkManager[1871]: <debug> ppp-manager: set-ifindex 4
Sep 10 07:58:24.621369 NetworkManager[1871]: <warn>  ppp-manager: can't change the ifindex from 4 to 4
Sep 10 07:58:24.623982 NetworkManager[1871]: <info>  device (ttyUSB0): state change: activated -> unmanaged (reason 'removed', sys-iface-state: 'removed')
Sep 10 07:58:24.624411 NetworkManager[1871]: <debug> kill child process 'pppd' (2292): wait for process to terminate after sending SIGTERM (15) (send SIGKILL in 1500 milliseconds)...
Sep 10 07:58:24.624440 NetworkManager[1871]: <debug> modem-broadband[ttyUSB0]: notifying ModemManager about the modem disconnection
Sep 10 07:58:24.626591 NetworkManager[1871]: <debug> modem-broadband[ttyUSB0]: notifying ModemManager about the modem disconnection
Sep 10 07:58:24.681016 NetworkManager[1871]: <warn>  modem-broadband[ttyUSB0]: failed to disconnect modem: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.ModemManager1.Modem.Simple' on object at path /org/freedesktop/ModemManager1/Modem/0
Sep 10 07:58:26.126817 NetworkManager[1871]: <debug> kill child process 'pppd' (2292): process not terminated after 1502368 usec. Sending SIGKILL signal
Sep 10 07:58:26.128121 NetworkManager[1871]: <info>  device (ppp0): state change: disconnected -> unmanaged (reason 'unmanaged', sys-iface-state: 'removed')
Sep 10 07:58:26.135571 NetworkManager[1871]: <debug> kill child process 'pppd' (2292): terminated by signal 9 (1511158 usec elapsed)

This is due to nm-ppp-plugin waiting on SetIfIndex call until timeout,
which is longer than termination process timeout.

Calling g_dbus_method_invocation_return_value() on error fixes this.

Fixes: dd98ada33f

https://mail.gnome.org/archives/networkmanager-list/2018-September/msg00010.html
2018-09-11 21:22:37 +02:00
Andrew Zaborowski 32506c8788 wifi/iwd: handle new GetOrderedNetworks() return type
The Station.GetOrderedNetworks dbus method's return type has changed in
IWD commit 0a42f63d42be903a46c595693884772c1c84d39f as the last incompatible
API change before IWD 0.8 (docs change was made earlier in
0453308134a3aadb6a2ec6a78ea642e19427704c) so that network names and
types are no longer included in the reply.  Expect this new reply
signature although still handle the old signature if we're using the
Device interface for IWD <= 0.7 compatibility.

It may be good idea to eventually pass the object manager instance from
nm-iwd-manager.c to nm-device-iwd.c to avoid using g_dbus_proxy_new_sync
and g_dbus_proxy_new_for_bus_sync in act_stage2_config, which possibly
generates a lot of DBus property queries.

https://github.com/NetworkManager/NetworkManager/pull/197
2018-09-11 14:10:30 +02:00
Thomas Haller c87faf07a1 dhcp: fix leak in dhclient's dhclient_start()
Fixes: 5d6d5cd136
2018-09-10 14:32:14 +02:00
Thomas Haller e3bd482329 device: mark wireguard devices as unmanaged
Later we want to fully support wireguard devices. Also,
possibly activating a generic profile in a wireguard device
would make sense.

Anyway, for the moment, just prevent that from happening
by explicitly marking the device as unmanaged.
2018-09-10 11:12:39 +02:00
Thomas Haller 045a36b33b device: rename NM_UNMANAGED_LOOPBACK to NM_UNMANAGED_BY_TYPE
It is generally useful, not only for loopback. Rename.
2018-09-10 11:11:40 +02:00
Thomas Haller 3635f462b0 device: detect loopback device explicitly
Don't use NM_UNMANAGED_LOOPBACK for that.
2018-09-10 11:11:40 +02:00
Thomas Haller baa0008313 device: make device incompatible with profiles by default
Currently, NMDeviceWireguard does neither set connection_type_check_compatible
nor implement check_connection_compatible. That means, it appears to be compatible
with every connection profile, which is obviously wrong.

Allow devices not to implement check_connection_compatible() and avoid the issue
by rejecting profiles by default.
2018-09-10 11:11:40 +02:00
Thomas Haller 57cfc6f19d release: bump version to 1.15.0 (development) 2018-09-08 10:24:20 +02:00
Thomas Haller 16ad82f967 release: bump version to 1.13.90 (1.14-rc1) 2018-09-08 10:24:16 +02:00
Thomas Haller 9d50d981c3 wifi/iwd: merge branch 'balrog-kun/iwd-fixes' (part 2)
https://github.com/NetworkManager/NetworkManager/pull/194
2018-09-08 10:10:44 +02:00
Andrew Zaborowski 7308ba2cb8 wifi/iwd: use the new 'Station' DBus interface
The following commit between IWD 0.7 and 0.8 splits the previous Device
interface into two interfaces with no functional changes:
https://git.kernel.org/pub/scm/network/wireless/iwd.git/commit/doc?id=0453308134a3aadb6a2ec6a78ea642e19427704c

Try using this new API but fall back to the old one if the State
property is found still on the Device interface.
2018-09-08 02:31:57 +02:00
Thomas Haller c3808550eb shared: change nm_utils_strbuf_seek_end() handling truncated strings
Ok, I changed my mind.

The new behavior seems to make more sense to me. Not that it matters,
because we always use nm_utils_strbuf*() API with buffers that we expect
to be large enough to contain the result. And when truncation occurs,
we usually don't care much about it. That is, there is no code that
uses nm_utils_strbuf*() API and handles string truncation in particular.
2018-09-07 18:13:10 +02:00
Thomas Haller d45e0b6558 wifi/iwd: merge branch 'balrog-kun/iwd-fixes' (partial)
https://github.com/NetworkManager/NetworkManager/pull/194
2018-09-07 15:19:52 +02:00
Andrew Zaborowski 618568366d wifi/iwd: add new DBus interface name defines
New IWD DBus interfaces added before 0.4 and before 0.8
2018-09-07 15:18:56 +02:00
Andrew Zaborowski 436c2a1c8b wifi/iwd: use NM_IN_STRSET for strings
NM_IN_SET will only compare string pointers and isn't useful for
checking if nm_setting_wireless_get_mode (s_wifi) is infrastructure.

Fixes: 570e1fa75b
2018-09-07 15:18:56 +02:00