Commit Graph

21212 Commits

Author SHA1 Message Date
Beniamino Galvani
691c71a7f2 build: allow disabling eBPF support in n-acd
Add a configure option to disable eBPF support in n-acd.

Note that, even if eBPF is not supported, n-acd requires a kernel >
3.19, which means that the setsockopt(..., SO_ATTACH_BPF) option must
be defined. To allow building on older kernels without modifying the
n-acd code, we inject the SO_ATTACH_BPF value as a preprocessor define
in the compiler the command line.
2018-09-18 15:32:36 +02:00
Beniamino Galvani
d9a4b59c18 acd: adapt NM code and build options
Adapt the nm-acd-manager.c code to the new API and also tweak build
options to the new project structure.
2018-09-18 15:32:36 +02:00
Beniamino Galvani
88072c6621 build: compile the c-rbtree library 2018-09-18 15:15:34 +02:00
Beniamino Galvani
51776b297e build: don't change CFLAGS from configure.ac
If configure.ac automatically adds compiler flags to CFLAGS, it
becomes hard to override one of them for a specific target because
CFLAGS is added last. It is better to use AM_CFLAGS. See [1].

[1] https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
2018-09-18 15:15:31 +02:00
Beniamino Galvani
d0c32a15a5 Merge commit '1361ede099f51cc29b478ebee6a736219ad74b97' into bg/n-acd-update
git subtree pull --prefix shared/n-acd git@github.com:nettools/n-acd.git master --squash
2018-09-18 15:15:02 +02:00
Beniamino Galvani
1361ede099 Squashed 'shared/n-acd/' changes from a68b55992..a40949267
a40949267 build: add CI run without ebpf
044db2056 n-acd: drop redundant headers
6a391cd83 n-acd: fix build without eBPF
bb194cf09 n-acd/config: make transport mandatory
ec2865743 build: drop unused c-sundry
721d9d84f n-acd: inline c_container_of()
1a7ee317c util/timer: fix coding-style
6c96f926b util/timer: fall back to CLOCK_MONOTONIC if necessary
4ea3165fc n-acd: only use CLOCK_BOOTTIME if really necessary
c1b853c6c util/timer: cleanup headers
b1d6ad272 n-acd: add destructors that return void
185be55b6 test-bpf: skip test in case of unsufficient privs
84a40e8fa build: add NEWS file
bf11443ff build: mention mailinglist in readme
e2797984a test-bpf: drop bpf-filter.h
668ed3c82 subprojects: pull in updates
dd8cab3f0 test-veth: reduce parallel execution to 9
68b09ba2b build: update AUTHORS
3f77e3e88 test: make function headers valid C
5275a5120 test: get rid of spurious tab
037df412c n-acd: make struct initializers valid C
346ec0c67 build: upgrade CI
38682a36d n-acd: fix signed vs unsigned comparison
5e7578b33 bpf: properly zero out trailing bpf_attr space
ee1e432ae probe: fix coding-style
a143540f9 build: use lower-case build options
835533e7d build: minor style fixes
2bd6d1d29 build: get rid of tabs
b14979934 eBPF: make compile-time optional
6f13c27ee n-acd: filter out invalid packets
4e6a169a0 build: sync with c-util repositories
6c4a9117b build: document eBPF kernel requirement
3ef08394d n-acd: don't remember dropped defense attempts
4dff8771f n-acd: fix coding-style
b11fb9706 n-acd/config: default to the RFC-specified timeout
d885bb3b7 n-acd/event: don't expose the type of operation that caused a conflict
e2f87e047 TODO: drop remaining items
f06993856 test/veth: reduce the number of probed addresses
8b4f7ed64 test/veth: bump the timeout a bit
14e4606f6 n-acd/probe: don't cap the jitter at 4s
a0247b86f test/veth: fix stackvariable corruption
a64ac8389 n-acd/probe: update comments
aa9c25bc1 n-acd/handle_timeout: update comments
b6c2df3a9 timer: rename timer_pop() to timer_pop_timeout()
47c657a8d test: fix handling of child addresses
27168ba9e timer: move timer_read() from n-acd.c to util/timer.c
21a1e37aa timer: require timer to be explicitly rearmed
ee1080820 bpf/map: make key/value sizes self-documenting
fd444353e test/veth: rework test
ba2bc433c test: rework child_ip() helper
07881b8da test: silence a warning
38da00b0a test/bpf: make tests for map modifications more comprehensive
6a2ffd23a test/timerfd: for documentation purposes verify the kernel API
01a9cf54b probe: move from ms to ns internally
4fe438dd9 n-acd: move to use the Timer utility library
e098cfc79 util: add a timer utility helper
8ea196e5b subprojects: pull in c-sundry
0c0b3c29f acd/probe: do not subscribe to packets in FAILED state
9c922ea3d acd/probe: introduce probe_{un,}link() helpers
024a830e6 acd/probe: use unschedule() helper in free()
b098a3bcc tests/veth: minor fixes to the test
fe3d9578a acd/packet: consider unexpected packets a fatal error
34d7656d7 acd: stop state-machine after USED or CONFLICT events
7d9e5ec6b acd: don't declare iovec entries inline
7afd8d8a3 tests: add veth test
26a737b42 tests/veth: add helper for adding IP addresses to child device
e73a37a11 probe: store a userdata pointer in the probe object
327e82625 test: introduce loopback helper
0682b15f8 acd: reduce default map size
afead881f tests: reinstate loopback test
4527d2f71 BPF: move and document the eBPF helpers
88bacc022 socket filter: move to the new eBPF helpers
245104d5c tests: skip tests if lacking permissions
195d9ff5a n-acd: rework API to support many probes on a context
ab440eb99 eBPF: never return packets that userspace should unconditionally drop
ac933f412 eBPF: add eBPF helper functions

git-subtree-dir: shared/n-acd
git-subtree-split: a40949267923c45cb232fa4c1d60eafacee4b36e
2018-09-18 15:14:49 +02:00
Beniamino Galvani
ba4452fe77 Merge commit '4f4e96655625a0ad8c5fc451c5a3a8dda3bf5456' as 'shared/c-rbtree'
Imported c-rbtree code with command:

  git subtree add --prefix shared/c-rbtree git@github.com:c-util/c-rbtree.git bf627e0c32241915108f66ad9738444e4d045b45 --squash

To update the library use:

  git subtree pull --prefix shared/c-rbtree git@github.com:c-util/c-rbtree.git master --squash
2018-09-18 15:08:46 +02:00
Beniamino Galvani
4f4e966556 Squashed 'shared/c-rbtree/' content from commit bf627e0c3
git-subtree-dir: shared/c-rbtree
git-subtree-split: bf627e0c32241915108f66ad9738444e4d045b45
2018-09-18 15:08:36 +02:00
Thomas Haller
9ad60ad092 shared: relax assertion in nm_utils_parse_inaddr()/nm_utils_parse_inaddr_prefix()
The assertion fails in nmtui's ip_route_transform_from_dest_string(),
which does not initialize the address output argument to %NULL.

There are three possibilities how the API could work:

 - assert/require the user to pass in arguments which pre-initialized
   to NULL or unset.
 - always set the output arguments, even if the function fails.
 - don't bother and leave output values untouched, if function fails.

It's not clear which approach is the best. Not to bother possibliy
leaves uninitialized values, which could be error prone. Still, do
just that.

Fixes: 0b3197a3fd
2018-09-18 08:00:06 +02:00
Thomas Haller
fa40fc6d76 connectivity: fix crash when removing easy-handle from curl callback
libcurl does not allow removing easy-handles from within a curl
callback.

That was already partly avoided for one handle alone. That is, when
a handle completed inside a libcurl callback, it would only invoke the
callback, but not yet delete it. However, that is not enough, because
from within a callback another handle can be cancelled, leading to
the removal of (the other) handle and a crash:

  ==24572==    at 0x40319AB: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==24572==    by 0x52DDAE5: Curl_close (url.c:392)
  ==24572==    by 0x52EC02C: curl_easy_cleanup (easy.c:825)
  ==24572==    by 0x5FDCD2: cb_data_free (nm-connectivity.c:215)
  ==24572==    by 0x5FF6DE: nm_connectivity_check_cancel (nm-connectivity.c:585)
  ==24572==    by 0x55F7F9: concheck_handle_complete (nm-device.c:2601)
  ==24572==    by 0x574C12: concheck_cb (nm-device.c:2725)
  ==24572==    by 0x5FD887: cb_data_invoke_callback (nm-connectivity.c:167)
  ==24572==    by 0x5FD959: easy_header_cb (nm-connectivity.c:435)
  ==24572==    by 0x52D73CB: chop_write (sendf.c:612)
  ==24572==    by 0x52D73CB: Curl_client_write (sendf.c:668)
  ==24572==    by 0x52D54ED: Curl_http_readwrite_headers (http.c:3904)
  ==24572==    by 0x52E9EA7: readwrite_data (transfer.c:548)
  ==24572==    by 0x52E9EA7: Curl_readwrite (transfer.c:1161)
  ==24572==    by 0x52F4193: multi_runsingle (multi.c:1915)
  ==24572==    by 0x52F5531: multi_socket (multi.c:2607)
  ==24572==    by 0x52F5804: curl_multi_socket_action (multi.c:2771)

Fix that, by never invoking any callbacks when we are inside a libcurl
callback. Instead, the handle is marked for completion and queued. Later,
we complete all queue handles separately.

While at it, drop the @error argument from NMConnectivityCheckCallback.
It was only used to signal cancellation. Let's instead signal that via
status NM_CONNECTIVITY_CANCELLED.

https://bugzilla.gnome.org/show_bug.cgi?id=797136
https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1792745
https://bugzilla.opensuse.org/show_bug.cgi?id=1107197
https://github.com/NetworkManager/NetworkManager/pull/207

Fixes: d8a31794c8
2018-09-17 18:21:32 +02:00
Thomas Haller
0b3197a3fd shared: let nm_utils_parse_inaddr_bin() return the detected address family
As we accept addr_family %AF_UNSPEC to detect the address family,
we also need to return it. Just returning the binary address without
the address family makes no sense.
2018-09-17 14:52:54 +02:00
luz.paz
58510ed566 docs: misc. typos pt2
Remainder of typos found using `codespell -q 3 --skip="./shared,./src/systemd,*.po" -I ../NetworkManager-word-whitelist.txt` whereby whitelist consists of:
 ```
ans
busses
cace
cna
conexant
crasher
iff
liftime
creat
nd
sav
technik
uint
```

https://github.com/NetworkManager/NetworkManager/pull/205
2018-09-17 11:26:13 +02:00
luz.paz
f985b6944a docs: misc. typos
Found via `codespell -q 3 --skip="*.po"`

https://github.com/NetworkManager/NetworkManager/pull/203
2018-09-15 09:08:03 +02:00
Thomas Haller
30674675cb release: bump version to 1.15.1-dev after 1.14.0 release
After 1.14.0 is released, merge it back into master so that
1.14.0 is part of the history of master. That means,
  $ git log --first-parent master
will also traverse 1.14.0 and 1.14-rc*.

Also bump the micro version to 1.15.1-dev to indicate that this is
after 1.14.0 is out.
2018-09-14 21:30:15 +02:00
Thomas Haller
2979c891c4 release: bump version to 1.14.0 2018-09-14 21:02:42 +02:00
Thomas Haller
93727f13e8 release: update NEWS 2018-09-14 21:02:31 +02:00
Thomas Haller
ff8777cdde libnm/trivial: whitespace
(cherry picked from commit 3b5912f08d)
2018-09-14 17:29:05 +02:00
Beniamino Galvani
6a9d2740ac clients: fix memory leak when parsing routes
The new hash table should destroy elements stolen from the hash table
returned by nm_utils_parse_variant_attributes().

Fixes: d094914120
(cherry picked from commit 31bda1b837)
2018-09-14 17:29:05 +02:00
Thomas Haller
74a3d184b0 libnm: document nm_utils_parse_variant_attributes() returning floating references
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1594887
(cherry picked from commit e645aeb12c)
2018-09-14 17:29:05 +02:00
Thomas Haller
3b5912f08d libnm/trivial: whitespace 2018-09-14 17:27:44 +02:00
Beniamino Galvani
31bda1b837 clients: fix memory leak when parsing routes
The new hash table should destroy elements stolen from the hash table
returned by nm_utils_parse_variant_attributes().

Fixes: d094914120
2018-09-14 17:21:00 +02:00
Thomas Haller
e645aeb12c libnm: document nm_utils_parse_variant_attributes() returning floating references
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1594887
2018-09-14 17:19:40 +02:00
Thomas Haller
c642f943c9 libnm: add missing NM_AVAILABLE_IN_1_2 macro for nm_connection_get_setting_tun()
(cherry picked from commit a525b12c5a)
2018-09-14 17:07:27 +02:00
Thomas Haller
749ea94902 libnm: add missing NM_AVAILABLE_IN_1_14 macro to new API
Fixes: df30651b89
(cherry picked from commit bbc93a2e30)
2018-09-14 17:07:27 +02:00
Thomas Haller
070e4e392e autoptr: add missing autoptr cleanup functions
(cherry picked from commit c1b647d54f)
2018-09-14 17:07:27 +02:00
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
fe866fbeb3 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).

(cherry picked from commit a10156f516)
2018-09-14 16:30:51 +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
f71f9b54a8 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)
2018-09-14 15:24:31 +02:00
Thomas Haller
011dd919fa 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)
2018-09-14 15:24: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
6bfab6796f 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
(cherry picked from commit 5815ae8c60)
2018-09-14 15:17:53 +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
Beniamino Galvani
63639f338f 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
(cherry picked from commit d8a972c575)
2018-09-14 14:56:09 +02:00
Thomas Haller
d1fecaa2d3 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
(cherry picked from commit cc8c207120)
2018-09-14 14:55:43 +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
fd2e8179d3 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".

(cherry picked from commit ad850c4f03)
2018-09-14 14:08:19 +02:00
Thomas Haller
7e6824f4da 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.

(cherry picked from commit 58b030f39a)
2018-09-14 14:08:18 +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
71d06e23b2 build: merge branch 'th/check-gtk-doc-behavior'
https://github.com/NetworkManager/NetworkManager/pull/196

(cherry picked from commit aa8a7559a3)
2018-09-14 09:04:39 +02:00
Thomas Haller
5f1912f579 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.

(cherry picked from commit 5894da67dc)
2018-09-14 09:04:23 +02:00
Thomas Haller
d29f6e03c8 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
(cherry picked from commit 02464c052e)
2018-09-14 09:04:23 +02:00
Thomas Haller
629dbf66bd build: fix error message in configure script about gtk-doc
(cherry picked from commit 815834aebc)
2018-09-14 09:04:23 +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