Commit graph

14 commits

Author SHA1 Message Date
Thomas Haller
101a7cb56d
tests: improve documentation how to generate files for "/test-client.py" 2021-08-26 13:47:04 +02:00
Thomas Haller
56707a09ae
client/tests: check output of plain nmcli in "test-client.py" 2021-07-29 13:25:59 +02:00
Ana Cabral
34b499f1ef nmcli: include 'searches' field for nmcli device show
Merge Request !919
2021-07-09 15:21:08 -03:00
Beniamino Galvani
cb5960cef7 all: add a new ipv{4,6}.required-timeout property
Add a new property to specify the minimum time interval in
milliseconds for which dynamic IP configuration should be tried before
the connection succeeds.

This property is useful for example if both IPv4 and IPv6 are enabled
and are allowed to fail. Normally the connection succeeds as soon as
one of the two address families completes; by setting a required
timeout for e.g. IPv4, one can ensure that even if IP6 succeeds
earlier than IPv4, NetworkManager waits some time for IPv4 before the
connection becomes active.
2021-07-05 15:15:44 +02:00
Thomas Haller
ea67f48050
cli: handle empty/unset values for "gsm.apn" property
Most string properties can be either %NULL (unset) or a non-empty
string.

For a few properties, like "gsm.apn", also the empty word is a valid
value. That makes it problematic to use from nmcli, because

  nmcli connection modify "$PROFILE" gsm.apn ""

means to reset the default (NULL). How to configure the empty word?
For the APN, "" has a specific meaning, distinct from NULL, so we
need to be able to represent that.

The other problem with nmcli is that

  nmcli -g gsm.apn connection show "$PROFILE"

is supposed to give you a value that you an set again, like

  X="$(nmcli -g gsm.apn connection show "$PROFILE"; echo x)"
  nmcli connection modify "$PROFILE2" gsm.apn "${X%$'\n'x}"

but for %NULL and "" the output would be the same.

The "solution" to that is interpreting "" as NULL (like we always did)
and a non-empty string that contains all whitespace, like a string with
one whitespace less. This way, all values can be expressed.

Note that in case of "gsm.apn", the string is anyway internally
normalized with g_strstrip(), so a string with all whitespace was
not expressable.
2021-05-03 10:11:25 +02:00
Thomas Haller
10567386f0
cli/tests: add unit test for checking setting/getting of "gsm.apn"
"gsm.apn" is special, because it can both be %NULL and "".

Add a test for how we handle that.
2021-05-03 10:11:24 +02:00
Fernando Fernandez Mancera
d946aa0c50 wired-setting: add support to accept-all-mac-addresses
This patch is introducing the wired setting accept-all-mac-addresses
property. The value corresponds to the kernel flag IFF_PROMISC.

When accept-all-mac-address is enabled, the interface will accept all
the packets without checking the destination mac address.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2021-04-22 18:57:30 +00:00
Fernando Fernandez Mancera
1dfe536386 platform: introduce nm_platform_link_change_flags()
Having two functions like link_set_x() and link_set_nox() it is not a
good idea. This patch is introducing nm_platform_link_change_flags().

This allow flag modification directly, so the developer does not need to
define the virtual functions all the time everywhere.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
2021-04-22 18:57:30 +00:00
Thomas Haller
571fdaafac
tests/client: rework error handling in "test-client.sh" script
The script runs with "set -e", as such `cmd && r=ok` seems wrong.
It worked apparently, but I don't understand why. Anyway, change
it.

Fixes: e643703418 ('tests/client: run "test-client.py" also for meson')
2021-03-19 11:43:19 +01:00
Thomas Haller
c2265dd8a9
Revert "tests/client: increase timeout to wait for process"
This didn't help and was not necessary. Instead, there was an issue
that is fixed now.

This reverts commit b4c25f9131.
2021-03-19 11:35:18 +01:00
Thomas Haller
489c5f8cd8
tests/client: ensure that we run nmcli before client tests for LTO (again)
See also commit 00e3fc036a ('clients/tests: ensure that we run nmcli
before client tests for LTO').

With the latest rework that code was dropped and tests (with LTO) are
broken as they hit a timeout (aside taking much longer).

Fixes: e643703418 ('tests/client: run "test-client.py" also for meson')
2021-03-19 11:35:18 +01:00
Thomas Haller
b4c25f9131
tests/client: increase timeout to wait for process
We now get unit test failures hitting this timeout. That is
likely a new bug introduced somewhere, but to rule out that
the timeout is simply too short, increase it.
2021-03-17 10:57:52 +01:00
Thomas Haller
e643703418
tests/client: run "test-client.py" also for meson 2021-03-15 17:10:56 +01:00
Thomas Haller
019bc3233a
client/tests: move "clients/tests/test-client.py" to "src/tests/client/"
Note that "test-client.py" currently only tests nmcli. But what it does
is to spawn test-networkmanager-service.py and run nmcli against it.

As such, it could really be used to test any NetworkManager client
against the stub service. Hence this test is not under
"src/nmcli/tests", but under "src/tests/client/" where it is more
general.
2021-03-15 17:10:55 +01:00