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
Thomas Haller
1cab6367b2
libnm: don't have G_PARAM_CONSTRUCT properties in NMSetting instances
...
G_PARAM_CONSTRUCT cause to explicitly initialize the property during
object construction. This is an unnecessary overhead that we can easily
avoid.
The overhead is because G_PARAM_CONSTRUCT parameters are always set with
g_object_set() before calling constructed(). Even if they are not specified
during g_object_new(), in which case it calls set with the property's default
value. This also requires g_object_new() to iterate all properties to
find and sort the construct properties.
NMSetting are supposed to be simple classes. They don't need to have
their properties initialized before object construction completes.
Especially if the default values are NULL or zero, in which case there
is nothing to do. If the default value is not NULL or zero, we need
to initialize the field instead in the nm_setting*_init() function.
2019-12-24 07:47:50 +01:00
Thomas Haller
0de6cd2d68
libnm: sort fields in NMSetting structures by size and alignment
2019-12-24 07:45:24 +01:00
Thomas Haller
c68c199eda
libnm: fix annotation for out arguments of nm_bridge_vlan_get_vid_range()
...
Workaround:
def br_get_vid_range(bridge_vlan):
try:
(is_range, vid_start, vid_end) = bridge_vlan.get_vid_range()
except TypeError as e:
s = bridge_vlan.to_str()
s = s.split(' ', 1)
s = s[0]
s = s.split('-', 2)
vid_start = int(s[0])
if len(s) == 2:
vid_end = int(s[1])
else:
vid_end = vid_start
is_range = (vid_start == vid_end)
return (vid_start, vid_end)
Fixes: da204257b1
('all: support bridge vlan ranges')
2019-11-19 16:12:59 +01:00
Thomas Haller
3b69f02164
all: unify format of our Copyright source code comments
...
```bash
readarray -d '' FILES < <(
git ls-files -z \
':(exclude)po' \
':(exclude)shared/c-rbtree' \
':(exclude)shared/c-list' \
':(exclude)shared/c-siphash' \
':(exclude)shared/c-stdaux' \
':(exclude)shared/n-acd' \
':(exclude)shared/n-dhcp4' \
':(exclude)src/systemd/src' \
':(exclude)shared/systemd/src' \
':(exclude)m4' \
':(exclude)COPYING*'
)
sed \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \
-e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \
-i \
"${FILES[@]}"
echo ">>> untouched Copyright lines"
git grep Copyright "${FILES[@]}"
echo ">>> Copyright lines with unusual extra"
git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved
sed \
-e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \
-i \
"${FILES[@]}"
```
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
2019-10-02 17:03:52 +02:00