Commit graph

98 commits

Author SHA1 Message Date
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
Thomas Haller
a1b575b07b libnm/trivial: rename _properties_override_add_*() to _nm_properties_override_*()
These macros/functions are in a header file. Everything in a header file
should have an "nm" prefix. Rename.
2019-09-30 08:23:19 +02:00
Thomas Haller
d534b6d07a libnm: deduplicate NMSettInfoPropertType instances
There is no need to keep duplicate instances.

Before we had 89 distinct property types, now there are 49.
2019-09-30 08:23:19 +02:00
Thomas Haller
3f36f69156 libnm: refactor NMSettInfoProperty to save memory for simple properties
In total, we register 447 property informations. Out of these,
326 are plain, GObject property based without special implementations.

The NMSettInfoProperty had all function pointers directly embedded,
currently this amounts to 5 function pointers and the "dbus_type" field.

That means, at runtime we have 326 times trivial implementations with
waste 326*6*8 bytes of NULL pointers. We can compact these by moving
them to a separate structure.

Before:

    447 * 5 function pointers
    447 * "dbus_type" pointer
    = 2682 pointers

After:

    447 * 1 pointers (for NMSettInfoProperty.property_type)
     89 * 6 pointers (for the distinct NMSettInfoPropertType data)
    = 981 pointers

So, in total this saves 13608 byes of runtime memory (on 64 bit arch).

The 89 NMSettInfoPropertType instances are the remaining distinct instances.
Note that every NMSettInfoProperty has a "property_type" pointer, but most of them are
shared. That is because the underlying type and the operations are the same.

Also nice is that the NMSettInfoPropertType are actually constant,
static fields and initialized very early.

This change also makes sense form a design point of view. Previously,
NMSettInfoProperty contained both per-property data (the "name") but
also the behavior. Now, the "behavioral" part is moved to a separate
structure (where it is also shared). That means, the parts that are
concerned with the type of the property (the behavior) are separate
from the actual data of the property.
2019-09-30 08:23:19 +02:00
Lubomir Rintel
24028a2246 all: SPDX header conversion
$ find * -type f |xargs perl contrib/scripts/spdx.pl
  $ git rm contrib/scripts/spdx.pl
2019-09-10 11:19:56 +02:00
Thomas Haller
87a73df959 all: drop empty first line from sources
git ls-files -z -- ':(exclude)src/settings/plugins/keyfile/tests/keyfiles' | xargs -0 -n1 sed -i '1 { /^$/d }'
2019-06-11 10:15:06 +02:00
Thomas Haller
c0e075c902 all: drop emacs file variables from source files
We no longer add these. If you use Emacs, configure it yourself.

Also, due to our "smart-tab" usage the editor anyway does a subpar
job handling our tabs. However, on the upside every user can choose
whatever tab-width he/she prefers. If "smart-tabs" are used properly
(like we do), every tab-width will work.

No manual changes, just ran commands:

    F=($(git grep -l -e '-\*-'))
    sed '1 { /\/\* *-\*-  *[mM]ode.*\*\/$/d }'     -i "${F[@]}"
    sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}"

Check remaining lines with:

    git grep -e '-\*-'

The ultimate purpose of this is to cleanup our files and eventually use
SPDX license identifiers. For that, first get rid of the boilerplate lines.
2019-06-11 10:04:00 +02:00