The DHCP client likes to order multiple default routes by adding
them with different, increasing metric.
To support that, let "metric_any" not completely disable the "metric"
field, but instead interpret it as an offset that should be added to
the default metric.
It's better to have a well-known, fixed MAC address on our test veth
devices.
Also, because later we will test IPv4 link local addressing, which
generates addresses by hashing the MAC address (among others).
- fix iterating logic in nm_l3cfg_add_config()
- fix preserving order during nm_l3cfg_commit_type_register()
- fix logic in _l3cfg_externally_removed_objs_drop_unused() to handle
all object types and not only routes.
- in nm-l3-config-data.c, fix coercing the route metric from metric_any
to the default metric.
- in _l3cfg_externally_removed_objs_drop_unused() and
_l3cfg_externally_removed_objs_track() ensure that the object is kept
alive long enough. The externally_removed_objs_hash hash keeps a
reference to the object, so when removing it, we either must no longer
access the object, or delay the destruction until later.
nmtst_main_context_iterate_until() is a macro, and we don't want to restrict the
valid integer type (or range) of the "timeout_msec" argument.
In particular, if the user calculates a timeout with "timestamp_msec -
now_msec", the resulting "timeout_msec" might be a negative gint64.
We should handle that gracefully, and not let it be cast to a huge
unsigned int.
nm_auth_chain_new_subject() cannot return %NULL, so these checks are only
noise. Also, there are already calls that correctly rely on the fact that
this function cannot fail.
We use glib, where memory allocation by definition cannot fail. That means,
a lot of functions simply cannot fail in our code base. This is a very nice
property (to have an functions that cannot fail), so don't add error
checking that is not useful.
This results in the args of 'nm_utils_user_data_unpack'
containing random data potentially also from the
previous stack-frame which is really really bad.
Signed-off-by: Antonio Cardace <acardace@redhat.com>
Fixes: b50702775f ('device: implement auth-request as async operation nm_manager_device_auth_request()')
The wifi backends call nm_platform_wifi_get_quality and
nm_platform_wifi_get_rate one after another in periodic_update (every
6s) and the same information is queried twice, synchronously. For the
lack of a better mechanism to decide whether we're still inside the same
periodic_update call, store the timestamp in msecs and reuse the data
for 500ms.
As an optimization, use the NL80211_CMD_GET_STATION dump data instead
of the NL80211_CMD_GET_SCAN dump + GET_STATION command (non-dump) to
implement the following methods:
wifi_nl80211_get_bssid
wifi_nl80211_get_rate
wifi_nl80211_get_qual
GET_STATION records vary in size from a few hundred bytes to a few kB.
GET_SCAN records are usually on the few hundred bytes side, but there
can be many of them. In managed mode there will only be one
GET_STATION record. In AdHoc mode there may be more. These methods are
not used in AP or Mesh mode.
So without that patch we'd have a GET_SCAN dump that could be quite big
and then a GET_STATION with one record. Now it should be a GET_STATION
dump with one record or a few records, in any case fewer synchronous
commands is better. Additionally this should now not depend on the
currently-connected BSS being in the kernel's scan result cache.
The downside is that the signal strength is "optional" in the
GET_STATION records, depends on the driver's capabilities. Most
mainline drivers do seem to include it (the mac80211 based ones and a
few full-mac ones) but I can't know if all of them do.
As an optimization, implement wifi_nl80211_get_freq() using the
GET_INTERFACE nl8022 command instead of the GET_SCAN dump.
The GET_SCAN dump can be over 10kB of data that the kernel has to build
and we have to parse. Additionally the GET_SCAN dump is not guaranteed
to contain the currently-connected BSS if there was no recent scan (30s),
or if the recent scan missed the beacon from the current BSS, or if the
recent scan was for a subset of channels/SSIDs/BSSIDs etc. and the last
full scan was already flushed. Scan results are flushed after (I think)
30 seconds or if a new scan has the flush flag set.
In IWD we do occasionally do partial scans (on a subset of channels or
for a specific SSID) with the flush flag. In that case the previous
wifi_nl80211_get_freq() logic would probably return 0.
We sometimes store pointers to `CRBTree` in `CRBNode*` variables, so we
must make sure CRBTree has matching alignment guarantees. We already
check for that with static-assertions.
This commit aligns CRBTree with CRBNode for 2-byte aligned machines.
While at it, add a short comment explaining what the unions are for.
Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
c795b7657f
On m68k, 32bit integer are aligned to only 2 bytes. This breaks
assumptions and a static assertion of c-rbtree.
Explicitly require that the first field is aligned to at least 4 bytes.
This fixes the build and ensures that all valid pointers to a CRBTree have
the lowest two bits unset (so they can be used for storing 2 additional flags).
Use a union instead of aligning __parent_and_flags itself. That is
because alignas() cannot lower the natural alignment, so if we would
want to align __parent_and_flags, we could only do
alignas(sizeof(unsigned long) > 4 ? sizeof(unsigned long) : 4)
That would not be correct if "long" is 8 bytes long but had a natural
alignment of only 4. The union allows us to specify an alignment
of at least 4, but otherwise follow natural alignment.
10d973a9e6
Historically, keyfile read/write code was part of core, and thus
GPL-2.0+ licensed. Keyfile is the native file format for NetworkManager
connection profiles, and code to handle that should be part of libnm.
This would unlock many interesting features, like tools being able
to import/export connection profiles in the native file format.
However, libnm is LGPL-2.1+ licensed, so this is a problem.
The alternative would be to add a separate, GPL licensed library
(libnm-keyfile.so or libnm-gpl.so). However that also requires a larger
rework, because the current keyfile implementation uses internal API
from libnm-core and it would need to be reworked to only use public
API of libnm.
Relicense the code instead. According to research and "keyfile-history.sh"
script, the following individuals and companies possibly hold copyright
on the code:
<bgalvani(at)redhat.com>
<blueowl(at)centrum.cz>
<daniel(at)gnoutcheff.name>
<danw(at)redhat.com>
<dcantrell(at)redhat.com>
<dcbw(at)redhat.com>
<evan(at)ebroder.net>
<fgiudici(at)redhat.com>
<floe(at)butterbrot.org>
<j(at)bootlab.org>
<kmaraas(at)gnome.org>
<lkundrak(at)v3.sk>
<luzpaz(at)users.noreply.github.com>
<martinpitt(at)gnome.org>
<michael.i.doherty(at)intel.com>
<pavlix(at)pavlix.net>
<pmarti(at)warp.es>
<rafaelff(at)gnome.org>
<rstrode(at)redhat.com>
<tambet(at)gmail.com>
<tgraf(at)redhat.com>
<thaller(at)redhat.com>
<walters(at)verbum.org>
<yurchor(at)ukr.net>
Intel Corporation
Novell, Inc.
Red Hat, Inc.
Ximian, Inc.
Most contributors on this list agreed to relicensing according to RELICENSE.md.
The following copyright holders did not answer the request for agreeing
to relicensing:
- <j(at)bootlab.org>: no contributions were made that are related to
keyfile implementation. The script just gives a false positive.
- <pmarti(at)warp.es>: the contribution is a fix of a spelling error
(commit 6029288ffb).
- <tgraf(at)redhat.com>: the contribution to keyfile code are small
(I only identified commit 5b7503e95e).
Also, Thomas worked for Red Hat at the time.
After research, I think it's fair to conclude that everybody who holds
non-trivial copyright on the keyfile code agreed to the relicensing.
>>>
H0=a3e75f329446a93a61ca4c458a7657bd919f4fe6
commit_has_file() {
git ls-tree -r "$1" | grep -q "\\s$2"\$
}
print_commit_authors() {
git --no-pager log --full-history --follow --no-merges --pretty='format:<%ae>' $H0 -- "$1" | sort | uniq
}
print_blame_authors() {
local LAST_H
if commit_has_file $H0 "$1"; then
LAST_H=$H0
else
LAST_H="$(git log --full-history --no-merges -n1 --pretty='format:%H' $H0 -- "$1")"^1
fi
git blame --no-progress -C -C -C20 -M -M10 -e "$LAST_H" -- "$1" | sed 's/.*\(<[^>]\+@[^>]\+>\).*/\1/' | sort | uniq
}
print_grep() {
git --no-pager log -p --full-history --follow $H0 -- "$1" | grep -i '[a-z0-9]@\|author\|copyright' | sort | uniq
}
prefix() {
sed "s/^/>>>$1 /"
}
collect_all() {
for F; do
print_commit_authors "$F" | prefix 1
echo
print_blame_authors "$F" | prefix 2
echo
print_grep "$F" | prefix 3
done |
sort |
uniq |
sed 's/@/(at)/'
}
collect_all \
include/NetworkManager.h \
libnm-core/NetworkManager.h \
libnm-core/nm-dbus-interface.h \
libnm-util/NetworkManager.h \
NetworkManager.h \
;
<<<
>>>1 <alfonso.sanchez-beato(at)canonical.com>
>>>1 <bberg(at)redhat.com>
>>>1 <bgalvani(at)redhat.com>
>>>1 <caillon(at)redhat.com>
>>>1 <daniel(at)gnoutcheff.name>
>>>1 <danw(at)gnome.org>
>>>1 <dcbw(at)redhat.com>
>>>1 <dsd(at)laptop.org>
>>>1 <gcampagna(at)src.gnome.org>
>>>1 <jarteaga(at)jbeta.is>
>>>1 <jiri(at)resnulli.us>
>>>1 <jklimes(at)redhat.com>
>>>1 <jlu(at)pengutronix.de>
>>>1 <lkundrak(at)v3.sk>
>>>1 <luzpaz(at)users.noreply.github.com>
>>>1 <mvollmer(at)redhat.com>
>>>1 <pktoss(at)gmail.com>
>>>1 <radykal(at)radykal.com>
>>>1 <rml(at)novell.com>
>>>1 <rodrigo(at)gnome-db.org>
>>>1 <tambet(at)gmail.com>
>>>1 <tambet(at)ximian.com>
>>>1 <tgraf(at)redhat.com>
>>>1 <thaller(at)redhat.com>
>>>1 <thomasbechtold(at)jpberlin.de>
>>>1 <tredaelli(at)redhat.com>
>>>2 <bberg(at)redhat.com>
>>>2 <bgalvani(at)redhat.com>
>>>2 <blueowl(at)centrum.cz>
>>>2 <daniel(at)gnoutcheff.name>
>>>2 <danw(at)redhat.com>
>>>2 <dcbw(at)redhat.com>
>>>2 <jarteaga(at)jbeta.is>
>>>2 <jiri(at)resnulli.us>
>>>2 <jlu(at)pengutronix.de>
>>>2 <lkundrak(at)v3.sk>
>>>2 <luzpaz(at)users.noreply.github.com>
>>>2 <mvollmer(at)redhat.com>
>>>2 <pktoss(at)gmail.com>
>>>2 <radykal(at)radykal.com>
>>>2 <rml(at)novell.com>
>>>2 <tambet(at)gmail.com>
>>>2 <tgraf(at)redhat.com>
>>>2 <thaller(at)redhat.com>
>>>2 <thomasbechtold(at)jpberlin.de>
>>>2 <tredaelli(at)redhat.com>
>>>3 [...] Red Hat, Inc.
>>>3 Thiago Bauermann <thiago.bauermann(at)gmail.com>
>>>3 <j(at)bootlab.org>
Most contributors on this list agreed to relicensing according to RELICENSE.md.
The following copyright holders did not answer the request for agreeing to
relicensing:
- <caillon(at)redhat.com>: the only contributions are removing code.
Also, Christopher was working for Red Hat at that time.
- <j(at)bootlab.org>: the patch was trivial, but the relevant code also got
removed by commit f003ba8ef7.
- <jiri(at)resnulli.us>: a trivial contribution to the header. Also,
Jiri was working for Red Hat at that time.
- <radykal(at)radykal.com>: fix spelling error in code comment.
- <rodrigo(at)gnome-db.org>: trivial contribution of adding a #define for
NM_DBUS_PATH_CONNECTION_SETTINGS.
- <tgraf(at)redhat.com>: a trivial contribution to the header. Also,
Thomas was working fro Red Hat at that time.
- <thiago.bauermann(at)gmail.com>: add a define to the header. This
was later removed by commit 7a8f33aa3d.
While not everybody agreed to this relicensing, I think the not covered
contributions are trivial additions to our header file. Also, this file
was always part of libnm. While it had the wrong license comment, it was
never intended to be GPL licensed.