Commit Graph

108 Commits

Author SHA1 Message Date
Thomas Haller
78629830c8 all: add "libnm-core/nm-default-libnm-core.h" as replacement for "nm-default.h" 2021-02-09 12:38:18 +01:00
Thomas Haller
977ea352a0 all: update deprecated SPDX license identifiers
These SPDX license identifiers are deprecated ([1]). Update them.

[1] https://spdx.org/licenses/

  sed \
     -e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \
     -e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \
     -i \
     $(git grep -l SPDX-License-Identifier -- \
         ':(exclude)shared/c-*/' \
         ':(exclude)shared/n-*/' \
         ':(exclude)shared/systemd/src' \
         ':(exclude)src/systemd/src')
2021-01-05 09:46:21 +01:00
Thomas Haller
0fca809bfd all: explicit include <linux/if_{ether,infiniband,vlan}.h> as needed
Currently libnm headers include <linux/if_{ether,infiniband,vlan}.h>.
These are public headers, that means we drag in the linux header to all
users of <NetworkManager.h>.

Often the linux headers work badly together with certain headers from libc.
Depending on the libc version, you have to order linux headers in the right
order with respect to libc headers.

We should do better about libnm headers. As a first step, assume that
the linux headers don't get included by libnm, and explicitly include
them where they are needed.
2020-12-22 16:33:33 +01:00
Thomas Haller
a2b5e22f82 all: drop unnecessary cast for return value of g_object_new()
C casts unconditionally force the type, and as such they don't
necessarily improve type safety, but rather overcome restrictions
from the compiler when necessary.

Casting a void pointer is unnecessary (in C), it does not make the
code more readable nor more safe. In particular for g_object_new(),
which is known to return a void pointer of the right type.

Drop such casts.

  sed 's/([A-Za-z_0-9]\+ *\* *) *g_object_new/g_object_new/g' $(git grep -l g_object_new) -i
  ./contrib/scripts/nm-code-format-container.sh
2020-11-12 16:03:09 +01:00
Thomas Haller
88071abb43 all: unify comment style for SPDX-License-Identifier tag
Our coding style recommends C style comments (/* */) instead of C++
(//). Also, systemd (which we partly fork) uses C style comments for
the SPDX-License-Identifier.

Unify the style.

  $ sed -i '1 s#// SPDX-License-Identifier: \([^ ]\+\)$#/* SPDX-License-Identifier: \1 */#' -- $(git ls-files -- '*.[hc]' '*.[hc]pp')
2020-09-29 16:50:53 +02:00
Thomas Haller
740b092fda format: replace tabs for indentation in code comments
sed -i \
     -e 's/^'$'\t'' \*/     */g' \
     -e 's/^'$'\t\t'' \*/         */g' \
     -e 's/^'$'\t\t\t'' \*/             */g' \
     -e 's/^'$'\t\t\t\t'' \*/                 */g' \
     -e 's/^'$'\t\t\t\t\t'' \*/                     */g' \
     -e 's/^'$'\t\t\t\t\t\t'' \*/                         */g' \
     -e 's/^'$'\t\t\t\t\t\t\t'' \*/                             */g' \
     $(git ls-files -- '*.[hc]')
2020-09-28 16:07:52 +02:00
Antonio Cardace
328fb90f3e all: reformat all with new clang-format style
Run:

    ./contrib/scripts/nm-code-format.sh -i
    ./contrib/scripts/nm-code-format.sh -i

Yes, it needs to run twice because the first run doesn't yet produce the
final result.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-09-28 16:07:51 +02:00
Thomas Haller
70971d1141 all: avoid wrong compiler warning about uninitalized variables with LTO
Seems with LTO the compiler can sometimes think that thes variables are
uninitialized. Usually those code paths are only after an assertion was
hit (g_return*()), but we still need to workaround the warning.
2020-08-17 15:18:02 +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
f7715c6680 libnm: use NMStrBuf in "nm-setting-bridge.c" 2020-06-26 09:29:53 +02:00
Thomas Haller
f9721385ce libnm: don't require birdge multicast_snooping with multicast_router auto,enabled
This does not match kernel behavior. You seem to be able to configure
multicast_snooping=auto,enabled with multicast_snooping off just fine.

Possibly this constrained was inspired by `ip link`, which says:

  mcast_router MULTICAST_ROUTER - set bridge's multicast router if IGMP
  snooping is enabled.

But kernel doesn't enforce this:

  ip link delete br0 2>/dev/null; \
  ip link add br0 type bridge mcast_router 1 mcast_snooping 0; \
  grep ^ /sys/devices/virtual/net/br0/bridge/{multicast_router,multicast_snooping}

gives:

    /sys/devices/virtual/net/br0/bridge/multicast_router:1
    /sys/devices/virtual/net/br0/bridge/multicast_snooping:0

We probably should not implement additional constrains on top of what
kernel does, if the conditions are that obscure.

Fixes: e01d3b4c2b ('nm-setting-bridge: add 'multicast-router' bridge option')
2020-06-11 18:35:36 +02:00
Thomas Haller
42288df043 libnm: adjust bridge defines NM_BRIDGE_VLAN_DEFAULT_PVID_DEF 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
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
Antonio Cardace
05d9381060 nm-setting-bridge: add 'multicast-startup-query-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:01 +02:00
Antonio Cardace
abe660f780 nm-setting-bridge: add 'multicast-startup-query-count' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
62facc59e8 nm-setting-bridge: add 'multicast-query-response-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
9842c55503 nm-setting-bridge: add 'multicast-query-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
b9b9a95395 nm-setting-bridge: add 'multicast-querier-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
c1bc1570f3 nm-setting-bridge: add 'multicast-membership-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
1c437090ff nm-setting-bridge: add 'multicast-last-member-interval' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
c49f20887a nm-setting-bridge: add 'multicast-last-member-count' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:33:00 +02:00
Antonio Cardace
673d51bd5c nm-setting-bridge: add 'multicast-hash-max' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:32:59 +02:00
Antonio Cardace
8e945c8967 nm-setting-bridge: add missing 'Since: X.Y' comments to options
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-05-04 17:32:52 +02:00
Antonio Cardace
ad052c3d67 nm-setting-bridge: add 'multicast-querier' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-04-06 09:56:11 +02:00
Antonio Cardace
a685cce70a nm-setting-bridge: add 'multicast-query-use-ifaddr' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-04-06 09:56:11 +02:00
Antonio Cardace
e01d3b4c2b nm-setting-bridge: add 'multicast-router' bridge option
Also add related unit test.

https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-04-06 09:56:11 +02:00
Antonio Cardace
bd30491f42 nm-setting-bridge: add 'vlan-stats-enabled' bridge option
https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-04-06 09:56:11 +02:00
Antonio Cardace
f5352ff656 nm-setting-bridge: add 'vlan-protocol' bridge option
Also add related unit test.

https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-04-06 09:56:11 +02:00
Antonio Cardace
93e38cbe56 nm-setting-bridge: add 'group-address' bridge option
Also add related unit test.

https://bugzilla.redhat.com/show_bug.cgi?id=1755768
2020-04-06 09:56:11 +02:00
Antonio Cardace
d5538efb31 nm-setting-bridge: hide GObject structs from public API and embed private data
Hide the object and class structures from public API.

This is an API and ABI break, but of something that is very likely
unused.

This is mainly done to embed the private structure in the object itself.
This has benefits for performance and debugability.
2020-04-06 09:56:07 +02:00
Antonio Cardace
fc8784a011 libnm-core: fix wording for 'nm_sett_info_propert_type_mac_addrees'
$ sed -i 's/nm_sett_info_propert_type_mac_addrees/nm_sett_info_propert_type_mac_address/' $(git grep -l 'nm_sett_info_propert_type_mac_addrees' | tr '\n' ' ')
2020-03-19 16:59:07 +01:00