Commit Graph

21127 Commits

Author SHA1 Message Date
Thomas Haller
a525b12c5a libnm: add missing NM_AVAILABLE_IN_1_2 macro for nm_connection_get_setting_tun() 2018-09-14 16:54:40 +02:00
Thomas Haller
bbc93a2e30 libnm: add missing NM_AVAILABLE_IN_1_14 macro to new API
Fixes: df30651b89
2018-09-14 16:54:40 +02:00
Thomas Haller
c1b647d54f autoptr: add missing autoptr cleanup functions 2018-09-14 16:54:40 +02:00
Thomas Haller
a10156f516 libnm: drop API nm_connection_get_setting_{6lowpan,sriov,wpan}()
Note that NMSettingEthtool and NMSettingMatch don't have such
functions either.

We have API

  nm_connection_get_setting (NMConnection *, GType)
  nm_connection_get_setting_by_name (NMConnection *, const char *)

which can be used generically, meaning: the requested setting type
is an argument to the function. That is generally more useful and
flexible.

Don't add API which duplicates existing functionality and is (arguably)
inferiour. Drop it now. This is an ABI/API break for the current development
cycle where the 1.14.0 API is still unstable. Indeed it's already after
1.14-rc1, which is ugly. But it's also unlikely that somebody already uses
this API/ABI and is badly impacted by this change.

Note that nm_connection_get_setting() and nm_connection_get_setting_by_name()
are slightly inconvenient in C still, because they usually require a cast.
We should fix that by changing the return type to "void *". Such
a change may be possibly any time without breaking API/ABI (almost, it'd
be an API change when taking a function pointer without casting).
2018-09-14 16:29:31 +02:00
Thomas Haller
6ebb9091d2 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.
2018-09-14 15:23:45 +02:00
Thomas Haller
92344dd084 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.
2018-09-14 15:23:45 +02:00
Thomas Haller
5815ae8c60 cli: fix reading "vpn.secrets.*" from passwd-file
Due to a bug, we required VPN secrets to be prefixed with
"vpn.secret." instead of "vpn.secrets.". This was a change
in behavior with 1.12.0 release.

Fix it, to restore the old behavior. For backward compatibility
to the broken behavior, adjust parse_passwords() to treat accept
that as well.

https://bugzilla.redhat.com/show_bug.cgi?id=1628833
https://github.com/NetworkManager/NetworkManager/pull/201

Fixes: 0601b5d725
2018-09-14 15:17:12 +02:00
Thomas Haller
cc8c207120 contrib/rpm: fix handling of --with test default
Seems rpmbuild does not honor the latest occurance with

  --with test --without test

to disable tests. Work around that.

Fixes: ad850c4f03
2018-09-14 14:51:46 +02:00
Thomas Haller
ad850c4f03 contrib/rpm: disable tests by default and use fatal-warnings with tests
In general, when we build a package, we want no compiler warnings
and all unit tests to pass.

That is in particular true when building a package for the distribution
in koji. When builing in koji, we (rightly) cannot pass rpmbuild options, so
the default whether tests/compiler-warnings are fatal matter very much.

One could argue: let's have the tests/compiler-warnings fatal and fail the build.
During a build in koji for a Fedora release, we want them all pass. And if somebody
does a manual build, the person can patch the spec file (or use rpmbuild
flags).

However, note how commit "f7b5e48cdb contrib/rpm: don't force fatal warnings
with tests" already disabled fatal compiler warnings. Why? It seems
compiler warnings should be even more stable than our unit tests, as long
as you target a particular Fedora release and compiler version. So this
was done to support rebuilding an SRPM for a different Fedora release,
or to be more graceful during early development phase of a Fedora
release, where things are not as stable yet.

The exactly same reasoning applies to treating unit-tests failures as fatal.
For example, a recent iproute2 issue broke unit tests. That meant, with
that iproute2 release in build root, the NetworkManager RPM could not be built.
Very annoying.

Now:

- if "test" is enabled, that means both `make check` and compiler warnings
  are treated fatal. If "test" is disabled, `make check` and compiler
  warnings are still done, just not fatal.

- "test" is now disabled by default via the spec file. They are not fatal
  when building in koji or when rebuilding the package manually.

- tests can be enabled optionally. Note that the "build_clean.sh"
  script enables them by default. So, a user using this script would
  need to explicitly "--without test".
2018-09-14 14:07:36 +02:00
Thomas Haller
58b030f39a contrib/rpm: always run tests and enable more compiler warnings in package build
- always enable more compiler warnings. They are not marked as breaking
  the build anyway.

- also, always build with '--with-tests=yes'. Note that our autotools is
  actually very nice. Even if you build '--with-tests=no', you still can
  run `make check` and the tests are build on demand. The only
  difference here is whether the tests are build during `make` or during
  `make check`. While little difference, build everything during the
  `make` step.

- when running tests, use `make -k check`. Even if they fail, we want to
  run the entire test suite.

- also running tests are disabled, still run them. But don't let them
  fail the build.
2018-09-14 14:07:36 +02:00
Thomas Haller
aa8a7559a3 build: merge branch 'th/check-gtk-doc-behavior'
https://github.com/NetworkManager/NetworkManager/pull/196
2018-09-14 08:59:44 +02:00
Thomas Haller
5894da67dc contrib/rpm: add --release option to build_clean.sh script
The correct way to create a tarball for release is

  ./contrib/fedora/rpm/build_clean.sh -r

Just ensure to issue this from a clean shell environment.
2018-09-14 08:56:43 +02:00
Thomas Haller
02464c052e docs/test: add check that gtk-doc contains patch to generate proper documentation
In libnm, we prefer opaque typedefs. gtk-doc needs to be patched to properly
generate documentation. Add a check for that.

Add a test. By default, this does not fail but just prints a warning. The test
can be made failing by setting NMTST_CHECK_GTK_DOC=1.

See-also: https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/2
2018-09-14 08:56:43 +02:00
Thomas Haller
815834aebc build: fix error message in configure script about gtk-doc 2018-09-14 08:17:32 +02:00
Thomas Haller
b4e2f83403 contrib/rpm: disable --with-more-asserts for devel-builds
The NetworkManager spec file used to determine devel builds as those that
have an odd minor version number. In that case, the built package would
enable more-asserts.
-- By the way, why is '1.13.3-dev' considered a delopment version worthy of more
asserts, but a build from the development phase of the next minor release on
'nm-1-12' branch not?

Note that during the development phase of Fedora (and sometimes even afterwards),
we commonly package development versions from 'master'. For example '1.12.0-0.1',
which is some snapshot with version number '1.11.x-dev' (or '1.12-rc1' in this case),
but before the actual '1.12.0' release.

It's problematic that for part of the devel phase we compile the
package for the distribution with more assertions. This package is
significanly different and rpmdiff and coverity give different results
for them.
For example, the binary size of debug packages is larger, so first
rpmdiff will complain that the binary sized increased (compare to the
previous version) and then later it decreases again.
Likewise, coverity finds significantly different issues on a debug
build. For example, it sees assertions against NULL and takes that
as a hint as to whether the parameter can/shall be NULL. Keeping
coverity warnings low is already high effort to sort out false
positives. We should not invest time in checking debug builds with
coverity, at least not as long as there are more important issues.

But more importantly, the --with-more-asserts configure option governs whether
nm_assert() is enabled. The only point of existance of nm_assert() -- compared to
g_assert(), g_return_*() and assert() -- is that this variant is disabled by default.
It's only used for checks that are really really not supposed to fail and/or
which may be expensive to do. This is useful for developing and CI,
but it's not right to put into the distribution. It really enables
assertions that you don't want in such a scenario. Enabling them even
for distribution builds defeats their purpose. If you care about an
assertion to be usually/always enabled, you should use g_assert() or
g_return_*() instead.

What this changes, that "devel" builds in koji/brew do not have more-asserts
enabled. When manually building the SRPM one still can enable it,
for example via

  $ ./contrib/fedora/rpm/build_clean.sh -w debug

Also our CI has an option to build packages with or without more-asserts
(defaulting to more asserts already).
2018-09-14 08:07:27 +02:00
AsciiWolf
69b4b28bb8 po: update Czech (cz) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/13
2018-09-13 17:06:38 +02:00
Thomas Haller
ef61d7909f wifi: fix leaking fake AP in NMDeviceWifi's act_stage1_prepare()
Fixes: 96f40dcdcd
2018-09-13 16:23:36 +02:00
Thomas Haller
54e1f73e0c libnm: fix memleak in _nm_utils_ssid_to_string_arr()
Fixes: 5cd4e6f3e6
2018-09-13 16:18:11 +02:00
Beniamino Galvani
f0c075f050 dns: dnsmasq: avoid crash when no reverse domains exist
ip_data->domains.reverse can be NULL when the device is being removed
and has no IP configuration for a short moment.

Fixes: 6409e7719c

https://bugzilla.gnome.org/show_bug.cgi?id=797022
2018-09-13 15:05:31 +02:00
Beniamino Galvani
4a1ff8ad8c build: merge branch 'bg/meson-paths'
https://github.com/NetworkManager/NetworkManager/pull/198
2018-09-13 11:54:17 +02:00
Thomas Haller
5b36585a3d build/autotools: fail configure if netconfig/resolveconf tool is not found
If the user explicitly passes --with-netconfig=$PATH or --with-resolvconf=$PATH,
the path is accepted as is. We only do autodetection, if the binary was not found.

In that case, if the binary cannot be found in the common paths fail compilation.
2018-09-13 11:49:25 +02:00
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