Commit graph

26197 commits

Author SHA1 Message Date
Thomas Haller
befd971b45
cloud-setup: assert that NMHttpClient returns NUL terminated buffer
The behavior is documented at various places, so this assert is less
to actually assert it, but as making this condition obvious to the
reader of the code.
2020-07-03 10:34:26 +02:00
Thomas Haller
e3bbd267c3
cloud-setup: add gtk-doc comment for nm_http_client_get_finish()
NMHttpClient guarantees that the returned response is %NUL terminated after the
returned length of the buffer. That guarantee is important and should be documented.
2020-07-03 10:34:26 +02:00
Thomas Haller
460afe6d50
cloud-setup: fix allocating buffer for GetConfigMetadataMac in _get_config_metadata_ready_check()
It's not a severe issue, because the GetConfigMetadataData struct is
larger than GetConfigMetadataMac.

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
2020-07-03 10:34:26 +02:00
Thomas Haller
8209095ee1
ndisc/tests: relax the assertion in "test-ndisc-fake.c"
test:ERROR:../src/ndisc/tests/test-ndisc-fake.c:373:test_preference_changed_cb: assertion failed (_a->timestamp == (data->timestamp1 + 3)): (9 == 10)
2020-07-03 10:34:15 +02:00
Beniamino Galvani
2c50438987 device: restart DHCP only for devices that are active or activating
do_sleep_wake() tries to restart DHCP for all devices, even ones that
are disconnecting. When a device is disconnecting, it still has a DHCP
client instance but we shouldn't restart it because it makes no sense;
and especially, the device could be already removed.

https://bugzilla.redhat.com/show_bug.cgi?id=1852612
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/561
2020-07-03 09:31:35 +02:00
Thomas Haller
9fa59c156b
gitlab-ci: check "examples/python/gi/nm-wg-set" with black 2020-07-02 17:44:29 +02:00
Thomas Haller
38b7556c65
build: check "examples/python/gi/nm-wg-set" with black 2020-07-02 17:44:21 +02:00
Thomas Haller
1acd64b7a2
examples: run python black on "examples/python/gi/nm-wg-set"
black by default only considers files that have a ".py" extension.
2020-07-02 17:37:12 +02:00
Thomas Haller
3b896cc642
ndisc/tests: make assertion checks a macro and not a function in test-ndisc-fake
By having it a function, the assertion failure does not show the line
number of the origin. Make them a macro, so that we see where exactly it
failed.
2020-07-02 16:28:49 +02:00
Beniamino Galvani
76baf6e0ba wifi: merge branch 'bg/ap-isolation'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/469
2020-07-01 17:47:53 +02:00
Beniamino Galvani
4db4801038 supplicant,device: support AP isolation
Support setting the ApIsolate property of the supplicant interface
during association and resetting it to zero during disconnection.
2020-07-01 17:36:20 +02:00
Beniamino Galvani
dbfe219d5b all: add ap-isolation property to wifi setting
Add a new 'ap-isolation' property to the wifi setting, useful to
prevent communication between wireless clients.
2020-07-01 17:36:20 +02:00
Beniamino Galvani
47817a576c ifcfg-rh: add generic shvar getter and setter for ternary variables 2020-07-01 17:36:20 +02:00
Thomas Haller
1cf11ccbca
libnm: fix leak in nm_utils_is_json_object()
Fixes: 32f78ae6c3 ('libnm: expose nm_utils_is_json_object() utility function')
2020-07-01 15:42:06 +02:00
Thomas Haller
03dc759026
modem: suppress deprecated warning from libmm for MM_MODEM_CAPABILITY_LTE_ADVANCED
On Ubuntu 20.10, we build against ModemManager 1.14.0 and get a compiler warning:

  ../src/devices/wwan/nm-modem-broadband.c: In function 'try_create_connect_properties':
  ../src/devices/wwan/nm-modem-broadband.c:492:2: error: 'MMModemCapabilityDeprecated' is deprecated [-Werror=deprecated-declarations]
    492 |  if (MODEM_CAPS_3GPP (ctx->caps)) {
        |  ^~

Suppress it.

An alternative would be to drop the flag entirely. It seems the flag
was never used (and never will be used). But if that's true, there is
little harm done checking it. If it's not true, we better keep checking
for older versions.

0cd76bf1c4
2020-06-30 18:00:33 +02:00
Thomas Haller
3d542b55ed
platform/tests: avoid test failures accepting route added signals
/route/ip6: NMPlatformSignalAssert: ../src/platform/tests/test-route.c:331, test_ip6_route(): failure to accept signal [0,2] times: ip6-route-changed-added ifindex 0 (3 times received)
2020-06-30 17:23:45 +02:00
Beniamino Galvani
5423a92b0f wifi: renew dynamic IP configuration after roaming
There are some APs that require a DHCP transaction before allowing
other traffic. This is meant to improve security by preventing the use
of static addresses. Currently we don't renew DHCP after roaming to a
new AP and this can lead to broken connectivity with APs that
implement the check described above. Also, even if unlikely, the new
AP could be in a different layer 3 network and so the old address
could be no longer valid.

Renew dynamic IP configuration after we detect the supplicant decided
to roam to a new AP. Note that we only trigger a DHCP client restart;
the DHCP client already implements the logic to renew the previous
address and fall back to a full request in case of NAK or timeout.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/449
2020-06-30 17:08:56 +02:00
Thomas Haller
f1af22452d
ifcfg-rh,libnm: merge branch 'th/ifcfg-bridge-writer'
https://bugzilla.redhat.com/show_bug.cgi?id=1845608

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/554
2020-06-30 16:31:47 +02:00
Thomas Haller
b9aa7ef81c
libnm/doc: clarify values for "bridge.multicast-router"
Kernel (sysfs) and iproute2 only use numbers for the multicast_router
option. It's confusing that we name the options differently. Anyway,
that cannot be changed anymore. Clarify the meanings in the
documentation.

https://bugzilla.redhat.com/show_bug.cgi?id=1845608
2020-06-30 16:30:38 +02:00
Thomas Haller
13327555d6
ifcfg-rh: hard code the defaults for bridge settings in write_bridge_setting()
Code like "get_setting_default_uint (s_bridge, NM_SETTING_BRIDGE_FORWARD_DELAY)" looks
up the default value of the GObject property. That default value is
known at build type. Looking it up is an unnecessary overhead, for
something that is already known.

Also, the code isn't generic (meaning, it doesn't iterate of a set of
properties names and treats them without explicitly naming each
property). If we already name the property for which we want the default
value, we can just as well name the default value.

Additionally, add an assertion that what we would look up matches
to what we think is the default.
2020-06-30 16:30:38 +02:00
Thomas Haller
58d193432d
ifcfg-rh: use guint type for handling nm_setting_bridge_get_ageing_time() return value
It returns guint, not guint32. Use the appropriate type.
2020-06-30 16:30:37 +02:00
Thomas Haller
15ec888597
ifcfg-rh: use nm_gstring_add_space_delimiter() in write_bridge_setting() 2020-06-30 16:30:34 +02:00
Thomas Haller
ae626ade0f
contrib: consistency check meson.build in release script 2020-06-30 13:57:15 +02:00
Thomas Haller
66651d5660
contrib: improve release script with howto comments and help option 2020-06-30 13:36:42 +02:00
Beniamino Galvani
edf7003660
version: add 1.28 macros 2020-06-30 11:29:04 +02:00
Thomas Haller
53bb23b403
build: for signing use key from git's user.signingkey 2020-06-29 09:08:04 +02:00
Thomas Haller
0748bd989d
release: cleanup temporary release-branch and avoid prompt for ftpadmin install 2020-06-28 19:16:20 +02:00
Thomas Haller
99f834842a
release: fix "rc" release build and add option to suppress check for local branches 2020-06-28 19:02:07 +02:00
Thomas Haller
7f93fd8e7b
release: fix RC_VERSION for release script
The release candidate -rc1 has version "1.y.90", -rc2 has "1.y.91", and so
on. Fix the script.
2020-06-28 18:35:03 +02:00
Thomas Haller
8e9e6fd024
release: fix release script for "rc" 2020-06-28 18:06:17 +02:00
Beniamino Galvani
071104124b device: clean up exported IP6 config when flushing addresses
After flushing addresses and routes, it's also necessary to update the
exported IP6 configuration.

https://bugzilla.redhat.com/show_bug.cgi?id=1848888
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/551

Fixes: e302f5ff77 ('device: flush IP configuration of slaves during activation')
2020-06-28 16:57:38 +02:00
Antonio Cardace
cfe349b971
NEWS: update 2020-06-26 16:59:23 +02:00
Antonio Cardace
ccbae2422e
nmcs-gcp: merge branch 'ac/gcp_cloud_support'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/546
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-26 16:54:16 +02:00
Antonio Cardace
a2b699f40f
nmcs-gcp: add support for Google Cloud Platform load balancers
This add a provider implementation for GCP that when detected fetches
the ip addresses of configured internal load balancers.

Once this information is fetched from the metadata server it instructs
NetworkManager to add local routes for each found forwarded-ip.

https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-26 16:47:56 +02:00
Antonio Cardace
75a84677ca
nmcs-main: support adding additional routes
This allows a provider to only add additional routes to the applied profile

https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-26 16:47:56 +02:00
Antonio Cardace
053bce438b
nmcs-http: add param to GET API to set custom HTTP headers
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-26 16:47:56 +02:00
Antonio Cardace
1095cef9a1
main: remove unused argument 2020-06-26 16:47:56 +02:00
Antonio Cardace
d46da9072a
nmcs: fix indentation 2020-06-26 16:47:56 +02:00
Antonio Cardace
aa5959a595
nm-shared-utils: add util to parse out lines from a string
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-26 16:47:56 +02:00
Antonio Cardace
3bd30f6064
nmcs: add error message when a HTTP request times out
https://bugzilla.redhat.com/show_bug.cgi?id=1821787
2020-06-26 16:47:55 +02:00
Antonio Cardace
e09bd2339a
nmcs-http: remove the timeout once expired
libcurl's documentation for CURLMOPT_TIMERFUNCTION requires the
application to install a non-repeating timer.

https://curl.haxx.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html

So let's remove the GSource once expired.

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
2020-06-26 16:47:55 +02:00
Antonio Cardace
427fbc85f0
nmcs-http: fix multiple HTTP request bug
Since just a single pointer is used to store the socket's GSource
if more than 1 consecutive request was done through the same
HTTP provider the 2nd request would clear the GSource associated to
the second request causing the 1st HTTP request to never complete
and end up in a expired timeout.

Use a hashtable instead so we can correctly track all requests.

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

Fixes: 69f048bf0c ('cloud-setup: add tool for automatic IP configuration in cloud')
2020-06-26 16:47:52 +02:00
Thomas Haller
d18d75f89c
core,libnm: merge branch 'th/kernel-cmdline-match'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/550
2020-06-26 13:32:31 +02:00
Thomas Haller
824ad6275d
libnm/match: extend syntax for match patterns with '|', '&', '!' and '\\'
For simple matches like match.interface-name, match.driver, and
match.path, arguably what we had was fine. There each element
(like "eth*") is a wildcard for a single name (like "eth1").

However, for match.kernel-command-line, the elements match individual
command line options, so we should have more flexibility of whether
a parameter is optional or mandatory. Extend the syntax for that.

- the elements can now be prefixed by either '|' or '&'. This makes
  optional or mandatory elements, respectively. The entire match
  evaluates to true if all mandatory elements match (if any) and
  at least one of the optional elements (if any).
  As before, if neither '|' nor '&' is specified, then the element
  is optional (that means, "foo" is the same as "|foo").

- the exclamation mark is still used to invert the match. If used
  alone (like "!foo") it is a shortcut for defining a mandatory match
  ("&!foo").

- the backslash can now be used to escape the special characters
  above. Basically, the special characters ('|', '&', '!') are
  stripped from the start of the element. If what is left afterwards
  is a backslash, it also gets stripped and the remainder is the
  pattern. For example, "\\&foo" has the pattern "&foo" where
  '&' is no longer treated specially. This special handling of
  the backslash is only done at the beginning of the element (after
  the optional special characters). The remaining string is part
  of the pattern, where backslashes might have their own meaning.

This change is mostly backward compatible, except for existing matches
that started with one of the special characters '|', '&', '!', and '\\'.
2020-06-26 13:29:01 +02:00
Thomas Haller
fa56e52a4f
core/tests: add unit test for nm_utils_kernel_cmdline_match_check() 2020-06-26 13:22:05 +02:00
Thomas Haller
e0f4817148
core: move matching of kernel command line to separate function 2020-06-26 13:22:04 +02:00
Thomas Haller
1641cc1d03
docs: fix escaping XML in "tools/generate-docs-nm-settings-docs-gir.py"
The gtk-doc text that the tool receives is not XML, it's a plain text.
When setting the plain text as XML attribute, we need to properly escape
it. The previous XML escape code was naive, and didn't cover for a
plain ampersand.
2020-06-26 13:22:04 +02:00
Thomas Haller
62747bb076
all: merge branch 'th/strbuf-uses'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/547
2020-06-26 09:36:18 +02:00
Thomas Haller
3b4a4bef7b
supplicant: use NMStrBuf in wifi_freqs_to_string()
And don't access global data without atomic operations.
2020-06-26 09:29:58 +02:00
Thomas Haller
652e0c843b
supplicant: use nm_streq() in "nm-supplicant-config.c" 2020-06-26 09:29:58 +02:00