Commit graph

25646 commits

Author SHA1 Message Date
Thomas Haller
a75ec12d8b
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_MEMBERSHIP_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
ec9e58ee01
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_LAST_MEMBER_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
769b176263
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_LAST_MEMBER_COUNT_* 2020-05-08 08:02:50 +02:00
Thomas Haller
4c3691e52e
libnm: adjust bridge defines NM_BRIDGE_PORT_PATH_COST_* 2020-05-08 08:02:49 +02:00
Thomas Haller
a7421f8bf2
libnm: adjust bridge defines NM_BRIDGE_PORT_PRIORITY_* 2020-05-08 08:02:49 +02:00
Thomas Haller
a690cedcba
libnm: adjust bridge defines NM_BRIDGE_PRIORITY_* 2020-05-08 08:02:49 +02:00
Thomas Haller
e2cb0837cc
libnm: adjust bridge defines NM_BRIDGE_MAX_AGE_* 2020-05-08 08:02:49 +02:00
Thomas Haller
d7dd4c70d0
libnm: adjust bridge defines NM_BRIDGE_HELLO_TIME_* 2020-05-08 08:02:49 +02:00
Thomas Haller
696fae40b7
libnm: adjust bridge defines NM_BRIDGE_STP_DEF 2020-05-08 08:02:49 +02:00
Thomas Haller
8ee4dbf709
libnm: adjust bridge defines NM_BRIDGE_FORWARD_DELAY_* 2020-05-08 08:02:49 +02:00
Thomas Haller
f61e354cfa
libnm: adjust bridge defines NM_BRIDGE_AGEING_TIME_* 2020-05-08 08:02:48 +02:00
Thomas Haller
f5527ecc5a
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_HASH_MAX_* 2020-05-08 08:02:48 +02:00
Thomas Haller
adf377c2c0
libnm: move defines for bridge defaults to "nm-core-internal.h" header 2020-05-08 08:02:48 +02:00
Thomas Haller
4338cf3800
ifcfg-rh/trivial: rename variable i in write_bridge_*setting() to indicate integer type 2020-05-08 08:02:48 +02:00
Thomas Haller
9996597666
ifcfg: refactor GObject accessors in write_bridge_setting() 2020-05-08 08:02:48 +02:00
Thomas Haller
83830badda
device: use NM_G_PARAM_SPEC_GET_DEFAULT_*() in NMDeviceBridge's commit_option() 2020-05-08 08:02:48 +02:00
Thomas Haller
0b2ecf5e35
shared: add NM_G_PARAM_SPEC_GET_DEFAULT_*() helper macros 2020-05-08 08:02:48 +02:00
Thomas Haller
a0b2955907
shared: add NM_ENSURE_NOT_NULL() macro 2020-05-08 08:00:41 +02:00
Thomas Haller
6e9967939b
acd: fix char buffer argument to _acd_event_to_string_buf() 2020-05-08 07:43:27 +02:00
Thomas Haller
bdac27eb28
config: merge branch 'th/config-fix-subtract-plugins'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/491
2020-05-07 14:15:28 +02:00
Thomas Haller
85fa23a6b5
config: minor cleanup in _sort_groups_cmp() and _intern_config_write_sort_fcn() 2020-05-07 14:08:34 +02:00
Thomas Haller
9ea7bf0da7
config: use nm_streq() and NM_STR_HAS_PREFIX() in "nm-config.c"
- nm_streq() is easier to read.

- NM_STR_HAS_PREFIX() works only with string literals, and gets
  inlined up to one strncmp() call. There is no need to call glib,
  to determine strlen(prefix) (that we already know), and then to
  call strncmp().
2020-05-07 14:08:34 +02:00
Thomas Haller
ff321e250e
config: use NM_STR_HAS_PREFIX_WITH_MORE() instead of duplicate implementation 2020-05-07 14:08:33 +02:00
Thomas Haller
3201b06925
config: use cleanup attribute in read_config() 2020-05-07 14:08:33 +02:00
Thomas Haller
f588dabb4f
settings: ensure that "plugins-=ifcfg-rh" works with the default plugins
On Fedora/RHEL, the default for main.plugins is "ifcfg-rh". You would
expect that a single configuration file

  [main]
  plugins-=ifcfg-rh

would result in an empty list of plugins (which subsequently gets
completed with "keyfile").

That didn't happen due to a bug. Fix it.
2020-05-07 14:08:33 +02:00
Thomas Haller
5cdb636301
keyfile: use nm_g_error_matches() in g_error_matches()
nm_g_error_matches() can be inlined and first checks whether the error
argument is not NULL. At least from the keyfile accessor functions, use
this macro, as they are called many times.
2020-05-07 14:08:32 +02:00
Thomas Haller
e08bb66b34
keyfile,config: use nm_keyfile_error_is_not_found() helper 2020-05-07 14:08:32 +02:00
Thomas Haller
df27164d5e
shared: add nm_keyfile_error_is_not_found() helper 2020-05-07 14:08:32 +02:00
Thomas Haller
e31b31e5e5
shared: add nm_g_error_matches() helper 2020-05-07 14:08:31 +02:00
Thomas Haller
a617177070
shared: add NM_STR_HAS_PREFIX_WITH_MORE() helper 2020-05-07 14:08:31 +02:00
Thomas Haller
5a09292f1f
shared: fix accessing "str" argument to NM_STR_HAS_PREFIX() macro twice
Macros preferably behave function-like, for example in that they evaluate
arguments exactly ones. Sometimes, we want to evaluate arguments
lazily, like in NM_IN_SET() or nm_g_set_error_take_lazy(). But it
is almost always undesirable to evaluate an argument more than once.

Fix NM_STR_HAS_PREFIX() for that.

Also, rename the local variable to not use the name "_str",
which may be a common name that the caller would like to use.
2020-05-07 14:08:31 +02:00
Thomas Haller
6325297367
all: merge branch 'th/lgtm-com-fixes-1'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/494
2020-05-07 14:01:14 +02:00
Thomas Haller
64331d6085
examples: remove unused code from "examples/python/dbus/vpn.py"
lgtm.com says "The value assigned to local variable all_connections is never used".
Just drop the entire statement. It's not right there.
2020-05-07 13:58:16 +02:00
Thomas Haller
8ad448444a
examples: avoid "x == None" checks in python examples
lgmt.com says "Testing for None should use the is operator".
2020-05-07 13:58:15 +02:00
Thomas Haller
c7d0a86050
examples: avoid "except" for BaseException in examples
lgtm.com flags this as "Except block directly handles BaseException".
2020-05-07 13:58:14 +02:00
Thomas Haller
5c08981356
examples: avoid non-thread-safe localtime() function example
Just to silence the warning on lgtm.com.
2020-05-07 13:58:13 +02:00
Thomas Haller
41a7a26259
examples: remove unused imports from python examples 2020-05-07 13:58:13 +02:00
Thomas Haller
a5614dc469
examples: remove unused assignment in "examples/python/gi/wifi-p2p.py"
lgtm.com warns about this.
2020-05-07 13:58:12 +02:00
Thomas Haller
cc1c2c9fc9
libnm: remove unused import from "generate-setting-docs.py" 2020-05-07 13:58:11 +02:00
Thomas Haller
0258616bd8
libnm: fix redundant line constructing dbus_type_name_map in "generate-setting-docs.py" 2020-05-07 13:58:10 +02:00
Thomas Haller
9e6d6191d1
tests: add include guard to "nm-test-libnm-utils.h" header
It causes a warning on lgtm.com.
2020-05-07 13:58:10 +02:00
Thomas Haller
9acf32a7a8
config: avoid lgtm.com warning about int bitfield for NMConfigDeviceStateData.nm_owned
lgtm.com warns:

  int nm_owned:3;
  >> Bit field nm_owned of type int should have explicitly unsigned integral, explicitly signed integral, or enumeration type.

So make it a NMTernary instead. It's nicer anyway.
2020-05-07 13:58:09 +02:00
Thomas Haller
3a1273f777
cli: avoid empty if block without a comment
lgtm.com flags this as "Empty block without comment".
Avoid it.

This code is of course ugly. Much work was already done to
port such occurrences, and more is needed. I won't add a FIXME
comment, because lgtm.com flags those too. :)
2020-05-07 13:58:09 +02:00
Thomas Haller
b93e12cb43
cli: avoid redundant "if" check that is always TRUE in nmcli_editor_tab_completion() 2020-05-07 13:58:09 +02:00
Thomas Haller
6f0dadabd7
cli: avoid non-thread-safe localtime() function in nmcli
Static analysis tools flag the use of localtime() because it is not
thread safe. Of course, that was no problem here, but avoiding the
warning is simple.

Also, if we allocate 128 bytes, let strftime use it.
2020-05-07 13:58:08 +02:00
Thomas Haller
53b2297701
ndisc: avoid static analysis complaining about overflow check in receive_ra()
lgtm.com flags this. The check was there to be better safe than sorry.
Also, it seems better to have code that shows what happens instead
of a verbose code comment (or no comment at all). Anyway, avoid the
false positive.
2020-05-07 13:58:08 +02:00
Thomas Haller
b447c80ad8
acd: avoid alloca() inside an unbounded loop 2020-05-07 13:58:08 +02:00
Thomas Haller
d170f8b7f2
device: fix compilation error "--without-more-asserts"
Defining the name "dispose" breaks

   object_class->dispose = dispose;

below.

Fixes: fdba9200c0 ('device: avoid coverity warning about unused variable')
2020-05-07 11:15:22 +02:00
Beniamino Galvani
be3549abbd merge: branch 'bg/coverity'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/495
2020-05-07 10:37:56 +02:00
Beniamino Galvani
a29b13c7f1 libnm: remove early return statement in test_nm_auth_permissions()
Reported by coverity:

>>> CID 210230: Control flow issues (UNREACHABLE)
>>> This code cannot be reached: "i = 0;".

Fixes: 09e17888f7 ('libnm: add mapping functions between string and NMClientPermission enum')
2020-05-07 10:01:59 +02:00