Commit graph

12910 commits

Author SHA1 Message Date
Thomas Haller
b533bef8cd
ovs: enable trace logging not only with NM_MORE_LOGGING
The logging is useful. Always compile it in.
2020-05-08 14:24:14 +02:00
Thomas Haller
2929392855
all: use "int/char" instead of "gint/gchar" typedefs
This is also recommended by our checkpatch.pl script.
2020-05-08 12:56:29 +02:00
Thomas Haller
6044fce960
bridge: refactor definition of options array to use a macro and C99 designated initializer
Yes, it's a macro and it's more lines of code.

But I think this is much easier to read and to maintain.
2020-05-08 08:02:51 +02:00
Thomas Haller
7c22710c17
libnm: use boolean values for range of NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE in slave_options 2020-05-08 08:02:51 +02:00
Thomas Haller
bfcfdc2955
libnm: adjust bridge defines NM_BRIDGE_VLAN_STATS_ENABLED_DEF 2020-05-08 08:02:51 +02:00
Thomas Haller
f34144f70b
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_STARTUP_QUERY_INTERVAL_* 2020-05-08 08:02:51 +02:00
Thomas Haller
55311c6a6a
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_STARTUP_QUERY_COUNT_* 2020-05-08 08:02:51 +02:00
Thomas Haller
433bb1fbe4
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_SNOOPING_DEF 2020-05-08 08:02:50 +02:00
Thomas Haller
96bb90a1ef
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERY_USE_IFADDR_DEF 2020-05-08 08:02:50 +02:00
Thomas Haller
0db1d28e6d
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERY_RESPONSE_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
58001f70e8
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERY_INTERVAL_* 2020-05-08 08:02:50 +02:00
Thomas Haller
08cfe812ec
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERIER_DEF 2020-05-08 08:02:50 +02:00
Thomas Haller
da6bbd73aa
libnm: adjust bridge defines NM_BRIDGE_MULTICAST_QUERIER_INTERVAL_* 2020-05-08 08:02:50 +02:00
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
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
6e9967939b
acd: fix char buffer argument to _acd_event_to_string_buf() 2020-05-08 07:43:27 +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
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
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
581aa981c2 ifcfg-rh: check return value of fdopen()
Reported by coverity:

>>> CID 210222: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a pointer that might be "NULL" "f" when calling
    "fseek".

Fixes: ac5206aa9c ('2007-11-21')
2020-05-07 10:01:57 +02:00
Thomas Haller
5beb42b942
device: style fixes 2020-05-06 17:10:31 +02:00
Thomas Haller
bdd0e89b9a
device: handle match.driver also with unknown device driver
If the driver is unknown, that doesn't necessarily mean that the match
passes. Instead, the match passes if there is no positive match that
asks for the driver name.
2020-05-06 16:20:11 +02:00
Thomas Haller
623cf7c9a3
core: accept %NULL argument to nm_wildcard_match_check()
%NULL means that the string is unknown. The pattern should still match
if there are no positive matches that want to match against the string.

For example, the nm_device_get_driver() might return NULL. If we have
a match.driver setting, we still need to handle that somehow that it
makes sense.
2020-05-06 16:14:16 +02:00
Thomas Haller
ace437338d
ifcfg-rh: minor cleanup of make_match_setting() 2020-05-06 16:01:13 +02:00
Thomas Haller
cf546ee789
ifcfg-rh: refactor write_match_setting()
- write_match_setting() never fails. Don't let it return a boolean
  error result.

- drop "if (!name || !name[0])" checks. It's not possibly to configure
  a name %NULL in NMSettingMatch (without triggering assertions). Also,
  an empty name "" is not valid, so we wouldn't expect it. There is one
  problem with the way how we concatenate the string list: it uses
  spaces as separator, while stripping spaces. That means, in the
  currenty format, an empty token "" cannot be expressed. On the other
  hand, serializing it would lead to duplicate spaces, that get dropped
  during re-read. So the empty name wasn't valid from the start, but it
  also cannot be encoded.

- use nm_gstring_add_space_delimiter() and nm_gstring_prepare().
2020-05-06 15:58:43 +02:00
Adrian Freihofer
369d858525
ifcfg-rh: support new match filters 2020-05-06 15:05:21 +02:00
Adrian Freihofer
d8a7f65ef4
ifcfg-rh-reader: match refactoring 2020-05-06 15:05:21 +02:00
Adrian Freihofer
214b31dcbc
settings: add match for driver
Add a new "driver" match option to nm-settings. It allows to disable a
network connection configuration if a pattern is found or is not found
in the device driver name.
2020-05-06 15:05:21 +02:00
Adrian Freihofer
3a8e46f2a5
settings: add match for proc cmdline
Add a new "kernel-command-line" match option to nm-settings. It allows
to disable a network connection configuration if a pattern is found or
is not found in /proc/cmdline.
2020-05-06 15:05:20 +02:00
Thomas Haller
fdba9200c0
device: avoid coverity warning about unused variable
This warning is from coverity against 1.18.6. But it applies
in a similar manner here.

  1. NetworkManager-1.18.6/src/devices/nm-device-macsec.c:811:25: warning: Value stored to 'priv' during its initialization is never read
  #         NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self);
  #                                ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. NetworkManager-1.18.6/src/devices/nm-device-macsec.c:811:25: note: Value stored to 'priv' during its initialization is never read
  #         NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self);
  #                                ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #   809|   {
  #   810|   	NMDeviceMacsec *self = NM_DEVICE_MACSEC (object);
  #   811|-> 	NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self);
  #   812|
  #   813|   	macsec_secrets_cancel (self);
2020-05-06 11:50:15 +02:00
Beniamino Galvani
fbf54ab182 initrd: parse 'rd.net.timeout.dhcp' option 2020-05-06 10:32:25 +02:00