mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 13:08:10 +02:00
release: bump version to 1.43.2 (development)
This commit is contained in:
commit
72c0ae2efa
31 changed files with 1246 additions and 883 deletions
|
|
@ -53,10 +53,10 @@ variables:
|
||||||
#
|
#
|
||||||
# This is done by running `ci-fairy generate-template` and possibly bumping
|
# This is done by running `ci-fairy generate-template` and possibly bumping
|
||||||
# ".default_tag".
|
# ".default_tag".
|
||||||
FEDORA_TAG: '2023-01-18.0-503dba0518ae'
|
FEDORA_TAG: '2023-01-18.0-82ad875db2dc'
|
||||||
UBUNTU_TAG: '2023-01-18.0-1218be1cbc9d'
|
UBUNTU_TAG: '2023-01-18.0-1218be1cbc9d'
|
||||||
DEBIAN_TAG: '2023-01-18.0-1218be1cbc9d'
|
DEBIAN_TAG: '2023-01-18.0-1218be1cbc9d'
|
||||||
CENTOS_TAG: '2023-01-18.0-503dba0518ae'
|
CENTOS_TAG: '2023-01-18.0-82ad875db2dc'
|
||||||
ALPINE_TAG: '2023-01-18.0-14c807942fa4'
|
ALPINE_TAG: '2023-01-18.0-14c807942fa4'
|
||||||
|
|
||||||
FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh'
|
FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh'
|
||||||
|
|
|
||||||
|
|
@ -23,19 +23,21 @@ fi
|
||||||
localedef -c -i pl_PL -f UTF-8 pl_PL.UTF-8
|
localedef -c -i pl_PL -f UTF-8 pl_PL.UTF-8
|
||||||
locale -a
|
locale -a
|
||||||
yum install -y python36-dbus python36-gobject-base
|
yum install -y python36-dbus python36-gobject-base
|
||||||
else
|
elif [ $IS_CENTOS_8 = 1 ]; then
|
||||||
if [ $IS_CENTOS_8 = 1 ]; then
|
# CentOS Linux 8 is now EOF and plain `dnf upgrade` does not work. We need
|
||||||
# CentOS Linux 8 is now EOF and plain `dnf upgrade` does not work. We need
|
# to patch the mirror list.
|
||||||
# to patch the mirror list.
|
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
|
||||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
|
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
|
||||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||||
dnf install -y 'dnf-command(config-manager)'
|
dnf install -y 'dnf-command(config-manager)'
|
||||||
dnf config-manager --set-enabled powertools || \
|
dnf config-manager --set-enabled powertools || \
|
||||||
dnf config-manager --set-enabled PowerTools
|
dnf config-manager --set-enabled PowerTools
|
||||||
curl https://copr.fedorainfracloud.org/coprs/nmstate/nm-build-deps/repo/epel-8/nmstate-nm-build-deps-epel-8.repo > /etc/yum.repos.d/nmstate-nm-build-deps-epel-8.repo
|
curl https://copr.fedorainfracloud.org/coprs/nmstate/nm-build-deps/repo/epel-8/nmstate-nm-build-deps-epel-8.repo > /etc/yum.repos.d/nmstate-nm-build-deps-epel-8.repo
|
||||||
|
else
|
||||||
|
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||||
|
dnf install -y 'dnf-command(config-manager)'
|
||||||
|
curl https://copr.fedorainfracloud.org/coprs/nmstate/nm-build-deps/repo/epel-9/nmstate-nm-build-deps-epel-9.repo > /etc/yum.repos.d/nmstate-nm-build-deps-epel-9.repo
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
5
.mailmap
5
.mailmap
|
|
@ -3,7 +3,8 @@ Adrian Freihofer <adrian.freihofer@siemens.com> <adrian.freihofer@gmail.com>
|
||||||
Aleksander Morgado <aleksander@aleksander.es> <aleksander@lanedo.com>
|
Aleksander Morgado <aleksander@aleksander.es> <aleksander@lanedo.com>
|
||||||
Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
|
Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
|
||||||
Amitakhya Phukan <aphukan@redhat.com> <aphukan@fedoraproject.org>
|
Amitakhya Phukan <aphukan@redhat.com> <aphukan@fedoraproject.org>
|
||||||
Ana Cabral <avelar.analuiza@gmail.com> <avelar.analuiza@gmail.com>
|
Ana Cabral <acabral@redhat.com> <30404-acabral@users.noreply.gitlab.freedesktop.org>
|
||||||
|
Ana Cabral <acabral@redhat.com> <avelar.analuiza@gmail.com>
|
||||||
Antony Mee <antony@onlymee.co.uk> <A.J.Mee@ncl.ac.uk>
|
Antony Mee <antony@onlymee.co.uk> <A.J.Mee@ncl.ac.uk>
|
||||||
Antony Mee <antony@onlymee.co.uk> <eemynotna@gmail.com>
|
Antony Mee <antony@onlymee.co.uk> <eemynotna@gmail.com>
|
||||||
Artur Flinta <aflinta@svn.gnome.org> <aflinta@cvs.gnome.org>
|
Artur Flinta <aflinta@svn.gnome.org> <aflinta@cvs.gnome.org>
|
||||||
|
|
@ -19,6 +20,7 @@ Dan Williams <dcbw@redhat.com> <dcbw@redaht.com>
|
||||||
Dan Winship <danw@redhat.com> <danw@gnome.org>
|
Dan Winship <danw@redhat.com> <danw@gnome.org>
|
||||||
Daniel Nylander <po@danielnylander.se> <Daniel Nylander po@danielnylander.se>
|
Daniel Nylander <po@danielnylander.se> <Daniel Nylander po@danielnylander.se>
|
||||||
David Zeuthen <davidz@redhat.com> <david@fubar.dk>
|
David Zeuthen <davidz@redhat.com> <david@fubar.dk>
|
||||||
|
Fernando Fernandez Mancera <ffmancera@riseup.net> <ffmancera@riseup.net>
|
||||||
Fran Diéguez <frandieguez@gnome.org>
|
Fran Diéguez <frandieguez@gnome.org>
|
||||||
Fran Diéguez <frandieguez@gnome.org> <fran.dieguez@mabishu.com>
|
Fran Diéguez <frandieguez@gnome.org> <fran.dieguez@mabishu.com>
|
||||||
Francisco Javier F. Serrador <serrador@cvs.gnome.org> <serrador@openshine.com>
|
Francisco Javier F. Serrador <serrador@cvs.gnome.org> <serrador@openshine.com>
|
||||||
|
|
@ -80,5 +82,6 @@ Tomasz Dominikowski <dominikowski@gmail.com> <tdominikowski@aviary.pl>
|
||||||
William Jon McCann <william.jon.mccann@gmail.com> <mccann@jhu.edu>
|
William Jon McCann <william.jon.mccann@gmail.com> <mccann@jhu.edu>
|
||||||
Wouter Bolsterlee <wbolster@svn.gnome.org> <uws+gnome@xs4all.nl>
|
Wouter Bolsterlee <wbolster@svn.gnome.org> <uws+gnome@xs4all.nl>
|
||||||
Wouter Bolsterlee <wbolster@svn.gnome.org> <wbolster@gnome.org>
|
Wouter Bolsterlee <wbolster@svn.gnome.org> <wbolster@gnome.org>
|
||||||
|
gaoxingwang <gxw94linux@163.com> <gaoxingwang1@huawei.com>
|
||||||
Øivind Hoel <ohoel@cvs.gnome.org>
|
Øivind Hoel <ohoel@cvs.gnome.org>
|
||||||
Žygimantas Beručka <uid0@akl.lt> <zygis@gnome.org>
|
Žygimantas Beručka <uid0@akl.lt> <zygis@gnome.org>
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ $ git config --add 'notes.displayref' 'refs/notes/bugs'
|
||||||
For example, set notes with
|
For example, set notes with
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git notes --ref refs/notes/bugs add -m "(cherry picked from $COMMIT_SHA)" HEAD
|
$ git notes --ref refs/notes/bugs add -m "(cherry picked from commit $COMMIT_SHA)" HEAD
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see the notes in git-log output as well.
|
You should see the notes in git-log output as well.
|
||||||
|
|
|
||||||
10
NEWS
10
NEWS
|
|
@ -1,3 +1,13 @@
|
||||||
|
=============================================
|
||||||
|
NetworkManager-1.44
|
||||||
|
Overview of changes since NetworkManager-1.42
|
||||||
|
=============================================
|
||||||
|
|
||||||
|
This is a snapshot of NetworkManager development. The API is
|
||||||
|
subject to change and not guaranteed to be compatible with
|
||||||
|
the later release.
|
||||||
|
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
||||||
|
|
||||||
=============================================
|
=============================================
|
||||||
NetworkManager-1.42
|
NetworkManager-1.42
|
||||||
Overview of changes since NetworkManager-1.40
|
Overview of changes since NetworkManager-1.40
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ dnl - add corresponding NM_VERSION_x_y_z macros in
|
||||||
dnl "shared/nm-version-macros.h.in"
|
dnl "shared/nm-version-macros.h.in"
|
||||||
dnl - update number in meson.build
|
dnl - update number in meson.build
|
||||||
m4_define([nm_major_version], [1])
|
m4_define([nm_major_version], [1])
|
||||||
m4_define([nm_minor_version], [42])
|
m4_define([nm_minor_version], [43])
|
||||||
m4_define([nm_micro_version], [0])
|
m4_define([nm_micro_version], [2])
|
||||||
m4_define([nm_version],
|
m4_define([nm_version],
|
||||||
[nm_major_version.nm_minor_version.nm_micro_version])
|
[nm_major_version.nm_minor_version.nm_micro_version])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
%global snapshot __SNAPSHOT__
|
%global snapshot __SNAPSHOT__
|
||||||
%global git_sha __COMMIT__
|
%global git_sha __COMMIT__
|
||||||
%global bcond_default_debug __BCOND_DEFAULT_DEBUG__
|
%global bcond_default_debug __BCOND_DEFAULT_DEBUG__
|
||||||
|
%global bcond_default_lto __BCOND_DEFAULT_LTO__
|
||||||
%global bcond_default_test __BCOND_DEFAULT_TEST__
|
%global bcond_default_test __BCOND_DEFAULT_TEST__
|
||||||
|
|
||||||
%global obsoletes_device_plugins 1:0.9.9.95-1
|
%global obsoletes_device_plugins 1:0.9.9.95-1
|
||||||
|
|
@ -69,11 +70,19 @@
|
||||||
%else
|
%else
|
||||||
%bcond_with test
|
%bcond_with test
|
||||||
%endif
|
%endif
|
||||||
|
%if "%{?bcond_default_lto}" == ""
|
||||||
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
|
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
|
||||||
%bcond_without lto
|
%bcond_without lto
|
||||||
%else
|
%else
|
||||||
%bcond_with lto
|
%bcond_with lto
|
||||||
%endif
|
%endif
|
||||||
|
%else
|
||||||
|
%if %{bcond_default_lto}
|
||||||
|
%bcond_without lto
|
||||||
|
%else
|
||||||
|
%bcond_with lto
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
%bcond_with sanitizer
|
%bcond_with sanitizer
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
%bcond_without connectivity_fedora
|
%bcond_without connectivity_fedora
|
||||||
|
|
@ -297,6 +306,10 @@ BuildRequires: python2
|
||||||
BuildRequires: pygobject3-base
|
BuildRequires: pygobject3-base
|
||||||
BuildRequires: dbus-python
|
BuildRequires: dbus-python
|
||||||
BuildRequires: pexpect
|
BuildRequires: pexpect
|
||||||
|
%if 0%{?rhel} >= 7 && %{with meson}
|
||||||
|
BuildRequires: python36-dbus
|
||||||
|
BuildRequires: python36-gobject
|
||||||
|
%endif
|
||||||
%endif
|
%endif
|
||||||
BuildRequires: libselinux-devel
|
BuildRequires: libselinux-devel
|
||||||
BuildRequires: polkit-devel
|
BuildRequires: polkit-devel
|
||||||
|
|
@ -680,6 +693,7 @@ Preferably use nmcli instead.
|
||||||
%else
|
%else
|
||||||
-Ddocs=false \
|
-Ddocs=false \
|
||||||
%endif
|
%endif
|
||||||
|
-Dqt=false \
|
||||||
%if %{with team}
|
%if %{with team}
|
||||||
-Dteamdctl=true \
|
-Dteamdctl=true \
|
||||||
%else
|
%else
|
||||||
|
|
@ -714,7 +728,8 @@ Preferably use nmcli instead.
|
||||||
-Difcfg_rh=true \
|
-Difcfg_rh=true \
|
||||||
-Difupdown=false \
|
-Difupdown=false \
|
||||||
%if %{with ppp}
|
%if %{with ppp}
|
||||||
-Dpppd_plugin_dir=%{_libdir}/pppd/%{ppp_version} \
|
-Dpppd_plugin_dir="%{_libdir}/pppd/%{ppp_version}" \
|
||||||
|
-Dpppd="%{_sbindir}/pppd" \
|
||||||
-Dppp=true \
|
-Dppp=true \
|
||||||
%endif
|
%endif
|
||||||
%if %{with firewalld_zone}
|
%if %{with firewalld_zone}
|
||||||
|
|
@ -855,8 +870,9 @@ autoreconf --install --force
|
||||||
--enable-ifcfg-rh=yes \
|
--enable-ifcfg-rh=yes \
|
||||||
--enable-ifupdown=no \
|
--enable-ifupdown=no \
|
||||||
%if %{with ppp}
|
%if %{with ppp}
|
||||||
--with-pppd-plugin-dir=%{_libdir}/pppd/%{ppp_version} \
|
|
||||||
--enable-ppp=yes \
|
--enable-ppp=yes \
|
||||||
|
--with-pppd="%{_sbindir}/pppd" \
|
||||||
|
--with-pppd-plugin-dir="%{_libdir}/pppd/%{ppp_version}" \
|
||||||
%endif
|
%endif
|
||||||
%if %{with firewalld_zone}
|
%if %{with firewalld_zone}
|
||||||
--enable-firewalld-zone=yes \
|
--enable-firewalld-zone=yes \
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
# SIGN_SOURCE=
|
# SIGN_SOURCE=
|
||||||
# DO_RELEASE=
|
# DO_RELEASE=
|
||||||
# BCOND_DEFAULT_DEBUG=
|
# BCOND_DEFAULT_DEBUG=
|
||||||
|
# BCOND_DEFAULT_LTO=
|
||||||
# BCOND_DEFAULT_TEST=
|
# BCOND_DEFAULT_TEST=
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
|
|
@ -119,6 +120,7 @@ COMMIT_FULL="${COMMIT_FULL:-$(git rev-parse --verify HEAD || die "Error reading
|
||||||
COMMIT="${COMMIT:-$(printf '%s' "$COMMIT_FULL" | sed 's/^\(.\{10\}\).*/\1/' || die "Error reading HEAD revision")}"
|
COMMIT="${COMMIT:-$(printf '%s' "$COMMIT_FULL" | sed 's/^\(.\{10\}\).*/\1/' || die "Error reading HEAD revision")}"
|
||||||
BCOND_DEFAULT_DEBUG="${BCOND_DEFAULT_DEBUG:-0}"
|
BCOND_DEFAULT_DEBUG="${BCOND_DEFAULT_DEBUG:-0}"
|
||||||
BCOND_DEFAULT_TEST="${BCOND_DEFAULT_TEST:-0}"
|
BCOND_DEFAULT_TEST="${BCOND_DEFAULT_TEST:-0}"
|
||||||
|
BCOND_DEFAULT_LTO="${BCOND_DEFAULT_LTO}"
|
||||||
USERNAME="${USERNAME:-"$(git config user.name) <$(git config user.email)>"}"
|
USERNAME="${USERNAME:-"$(git config user.name) <$(git config user.email)>"}"
|
||||||
SPECFILE="$(abs_path "$SPECFILE" "$SCRIPTDIR/NetworkManager.spec")" || die "invalid \$SPECFILE argument"
|
SPECFILE="$(abs_path "$SPECFILE" "$SCRIPTDIR/NetworkManager.spec")" || die "invalid \$SPECFILE argument"
|
||||||
SOURCE_FROM_GIT="$(coerce_bool "$SOURCE_FROM_GIT" "")"
|
SOURCE_FROM_GIT="$(coerce_bool "$SOURCE_FROM_GIT" "")"
|
||||||
|
|
@ -174,12 +176,14 @@ LOG "SOURCE_README_IFCFG_FILES=$SOURCE_README_IFCFG_FILES"
|
||||||
LOG "BUILDTYPE=$BUILDTYPE"
|
LOG "BUILDTYPE=$BUILDTYPE"
|
||||||
LOG "NM_RPMBUILD_ARGS=$NM_RPMBUILD_ARGS"
|
LOG "NM_RPMBUILD_ARGS=$NM_RPMBUILD_ARGS"
|
||||||
LOG "BCOND_DEFAULT_DEBUG=$BCOND_DEFAULT_DEBUG"
|
LOG "BCOND_DEFAULT_DEBUG=$BCOND_DEFAULT_DEBUG"
|
||||||
|
LOG "BCOND_DEFAULT_LTO=$BCOND_DEFAULT_LTO"
|
||||||
LOG "BCOND_DEFAULT_TEST=$BCOND_DEFAULT_TEST"
|
LOG "BCOND_DEFAULT_TEST=$BCOND_DEFAULT_TEST"
|
||||||
LOG ""
|
LOG ""
|
||||||
LOG "UUID=$UUID"
|
LOG "UUID=$UUID"
|
||||||
LOG "BASEDIR=$TEMP"
|
LOG "BASEDIR=$TEMP"
|
||||||
|
|
||||||
in_set "$BCOND_DEFAULT_DEBUG" 0 1 || die "Invalid value for \$BCOND_DEFAULT_DEBUG: \"$BCOND_DEFAULT_DEBUG\""
|
in_set "$BCOND_DEFAULT_DEBUG" 0 1 || die "Invalid value for \$BCOND_DEFAULT_DEBUG: \"$BCOND_DEFAULT_DEBUG\""
|
||||||
|
in_set "$BCOND_DEFAULT_LTO" '' 0 1 || die "Invalid value for \$BCOND_DEFAULT_LTO: \"$BCOND_DEFAULT_LTO\""
|
||||||
in_set "$BCOND_DEFAULT_TEST" 0 1 || die "Invalid value for \$BCOND_DEFAULT_TEST: \"$BCOND_DEFAULT_TEST\""
|
in_set "$BCOND_DEFAULT_TEST" 0 1 || die "Invalid value for \$BCOND_DEFAULT_TEST: \"$BCOND_DEFAULT_TEST\""
|
||||||
|
|
||||||
ln -snf "$TEMPBASE" ./latest0
|
ln -snf "$TEMPBASE" ./latest0
|
||||||
|
|
@ -209,6 +213,7 @@ sed -e "s/__VERSION__/$VERSION/g" \
|
||||||
-e "s/__SNAPSHOT__/$SNAPSHOT/g" \
|
-e "s/__SNAPSHOT__/$SNAPSHOT/g" \
|
||||||
-e "s/__SOURCE1__/$(basename "$SOURCE")/g" \
|
-e "s/__SOURCE1__/$(basename "$SOURCE")/g" \
|
||||||
-e "s/__BCOND_DEFAULT_DEBUG__/$BCOND_DEFAULT_DEBUG/g" \
|
-e "s/__BCOND_DEFAULT_DEBUG__/$BCOND_DEFAULT_DEBUG/g" \
|
||||||
|
-e "s/__BCOND_DEFAULT_LTO__/${BCOND_DEFAULT_LTO:-"%{nil}"}/g" \
|
||||||
-e "s/__BCOND_DEFAULT_TEST__/$BCOND_DEFAULT_TEST/g" \
|
-e "s/__BCOND_DEFAULT_TEST__/$BCOND_DEFAULT_TEST/g" \
|
||||||
"$SPECFILE" |
|
"$SPECFILE" |
|
||||||
sed -e "/^__CHANGELOG__$/ \
|
sed -e "/^__CHANGELOG__$/ \
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ usage() {
|
||||||
echo " -s|--snapshot TEXT: use TEXT as the snapshot version for the new package (overwrites \$NM_BUILD_SNAPSHOT environment)"
|
echo " -s|--snapshot TEXT: use TEXT as the snapshot version for the new package (overwrites \$NM_BUILD_SNAPSHOT environment)"
|
||||||
echo " -r|--release: built a release tarball (this option must be alone)"
|
echo " -r|--release: built a release tarball (this option must be alone)"
|
||||||
echo " --default-for-debug \$OPTION: set the default for "debug" option in the generated spec file"
|
echo " --default-for-debug \$OPTION: set the default for "debug" option in the generated spec file"
|
||||||
|
echo " --default-for-lto \$OPTION: set the default for "lto" option in the generated spec file"
|
||||||
echo " --default-for-test \$OPTION: set the default for "test" option in the generated spec file"
|
echo " --default-for-test \$OPTION: set the default for "test" option in the generated spec file"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,6 +57,7 @@ SOURCE_FROM_GIT=0
|
||||||
SNAPSHOT="$NM_BUILD_SNAPSHOT"
|
SNAPSHOT="$NM_BUILD_SNAPSHOT"
|
||||||
DO_RELEASE=0
|
DO_RELEASE=0
|
||||||
unset BCOND_DEFAULT_DEBUG
|
unset BCOND_DEFAULT_DEBUG
|
||||||
|
unset BCOND_DEFAULT_LTO
|
||||||
unset BCOND_DEFAULT_TEST
|
unset BCOND_DEFAULT_TEST
|
||||||
|
|
||||||
ADD_WITH_TEST=1
|
ADD_WITH_TEST=1
|
||||||
|
|
@ -110,6 +112,9 @@ while [[ $# -gt 0 ]]; do
|
||||||
debug)
|
debug)
|
||||||
[[ -z ${BCOND_DEFAULT_DEBUG+.} ]] && BCOND_DEFAULT_DEBUG=1
|
[[ -z ${BCOND_DEFAULT_DEBUG+.} ]] && BCOND_DEFAULT_DEBUG=1
|
||||||
;;
|
;;
|
||||||
|
lto)
|
||||||
|
[[ -z ${BCOND_DEFAULT_LTO+.} ]] && BCOND_DEFAULT_LTO=1
|
||||||
|
;;
|
||||||
test)
|
test)
|
||||||
ADD_WITH_TEST=0
|
ADD_WITH_TEST=0
|
||||||
[[ -z ${BCOND_DEFAULT_TEST+.} ]] && BCOND_DEFAULT_TEST=1
|
[[ -z ${BCOND_DEFAULT_TEST+.} ]] && BCOND_DEFAULT_TEST=1
|
||||||
|
|
@ -124,6 +129,9 @@ while [[ $# -gt 0 ]]; do
|
||||||
debug)
|
debug)
|
||||||
[[ -z ${BCOND_DEFAULT_DEBUG+.} ]] && BCOND_DEFAULT_DEBUG=0
|
[[ -z ${BCOND_DEFAULT_DEBUG+.} ]] && BCOND_DEFAULT_DEBUG=0
|
||||||
;;
|
;;
|
||||||
|
lto)
|
||||||
|
[[ -z ${BCOND_DEFAULT_LTO+.} ]] && BCOND_DEFAULT_LTO=0
|
||||||
|
;;
|
||||||
test)
|
test)
|
||||||
ADD_WITH_TEST=0
|
ADD_WITH_TEST=0
|
||||||
[[ -z ${BCOND_DEFAULT_TEST+.} ]] && BCOND_DEFAULT_TEST=0
|
[[ -z ${BCOND_DEFAULT_TEST+.} ]] && BCOND_DEFAULT_TEST=0
|
||||||
|
|
@ -145,6 +153,12 @@ while [[ $# -gt 0 ]]; do
|
||||||
BCOND_DEFAULT_DEBUG="$1"
|
BCOND_DEFAULT_DEBUG="$1"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--default-for-lto)
|
||||||
|
[[ $# -gt 0 ]] || die "Missing argument to $A"
|
||||||
|
in_set "$1" "" 0 1 || die "invalid argument $A \"$1\""
|
||||||
|
BCOND_DEFAULT_LTO="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--default-for-test)
|
--default-for-test)
|
||||||
[[ $# -gt 0 ]] || die "Missing argument to $A"
|
[[ $# -gt 0 ]] || die "Missing argument to $A"
|
||||||
in_set "$1" "" 0 1 || die "invalid argument $A \"$1\""
|
in_set "$1" "" 0 1 || die "invalid argument $A \"$1\""
|
||||||
|
|
@ -226,6 +240,7 @@ export NM_RPMBUILD_ARGS="${WITH_LIST[@]}"
|
||||||
export SNAPSHOT
|
export SNAPSHOT
|
||||||
export DO_RELEASE
|
export DO_RELEASE
|
||||||
export BCOND_DEFAULT_DEBUG="$BCOND_DEFAULT_DEBUG"
|
export BCOND_DEFAULT_DEBUG="$BCOND_DEFAULT_DEBUG"
|
||||||
|
export BCOND_DEFAULT_LTO="$BCOND_DEFAULT_LTO"
|
||||||
export BCOND_DEFAULT_TEST="$BCOND_DEFAULT_TEST"
|
export BCOND_DEFAULT_TEST="$BCOND_DEFAULT_TEST"
|
||||||
|
|
||||||
"$SCRIPTDIR"/build.sh
|
"$SCRIPTDIR"/build.sh
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,14 @@ echo_color() {
|
||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " $BASH_SOURCE [devel|rc1|rc|major|major-post|minor] [--no-test] [--no-find-backports] [--no-cleanup] [--allow-local-branches] [--no-check-gitlab] [--no-check-news]"
|
echo " $BASH_SOURCE [devel|rc1|rc|major|major-post|minor]"
|
||||||
|
echo " [--no-test] \\"
|
||||||
|
echo " [--no-find-backports] \\"
|
||||||
|
echo " [--no-cleanup] \\"
|
||||||
|
echo " [--allow-local-branches] \\"
|
||||||
|
echo " [--no-check-gitlab] \\"
|
||||||
|
echo " [--no-check-news] \\"
|
||||||
|
echo " [--no-warn-publish-docs] \\"
|
||||||
}
|
}
|
||||||
|
|
||||||
die_help() {
|
die_help() {
|
||||||
|
|
@ -204,6 +211,7 @@ FIND_BACKPORTS=1
|
||||||
ALLOW_LOCAL_BRANCHES=0
|
ALLOW_LOCAL_BRANCHES=0
|
||||||
HELP_AND_EXIT=1
|
HELP_AND_EXIT=1
|
||||||
CHECK_GITLAB=1
|
CHECK_GITLAB=1
|
||||||
|
WARN_PUBLISH_DOCS=1
|
||||||
CHECK_NEWS=1
|
CHECK_NEWS=1
|
||||||
while [ "$#" -ge 1 ]; do
|
while [ "$#" -ge 1 ]; do
|
||||||
A="$1"
|
A="$1"
|
||||||
|
|
@ -228,6 +236,9 @@ while [ "$#" -ge 1 ]; do
|
||||||
--no-check-gitlab)
|
--no-check-gitlab)
|
||||||
CHECK_GITLAB=0
|
CHECK_GITLAB=0
|
||||||
;;
|
;;
|
||||||
|
--no-warn-publish-docs)
|
||||||
|
WARN_PUBLISH_DOCS=0
|
||||||
|
;;
|
||||||
--no-check-news)
|
--no-check-news)
|
||||||
CHECK_NEWS=0
|
CHECK_NEWS=0
|
||||||
;;
|
;;
|
||||||
|
|
@ -366,6 +377,24 @@ if ! check_news "$RELEASE_MODE" "@{VERSION_ARR[@]}" ; then
|
||||||
echo "WARNING: NEWS file needs update to mention stable release (test skipped with --no-check-news)"
|
echo "WARNING: NEWS file needs update to mention stable release (test skipped with --no-check-news)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$RELEASE_MODE" = major -o "$RELEASE_MODE" = minor ]; then
|
||||||
|
echo
|
||||||
|
latest=
|
||||||
|
if [ "$RELEASE_MODE" = major ]; then
|
||||||
|
echo "Note that after the new major you have to publish the new documentation on"
|
||||||
|
latest=" -l"
|
||||||
|
else
|
||||||
|
echo "Note that after the stable release you maybe should publish the new documentation on"
|
||||||
|
fi
|
||||||
|
echo "$(echo_color 36 -n "https://gitlab.freedesktop.org/NetworkManager/networkmanager.pages.freedesktop.org.git") by running"
|
||||||
|
echo " \`$(echo_color 36 -n "./scripts/import-docs.sh ${VERSION_ARR[0]}.$((${VERSION_ARR[1]} + 1)).0$latest")\`"
|
||||||
|
echo
|
||||||
|
if [ $WARN_PUBLISH_DOCS = 1 ]; then
|
||||||
|
echo "Avoid this prompt via \"--no-warn-publish-docs\""
|
||||||
|
read -p "Please confirm that you know [ENTER] "
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $FIND_BACKPORTS = 1 ]; then
|
if [ $FIND_BACKPORTS = 1 ]; then
|
||||||
git show "$ORIGIN/main:contrib/scripts/find-backports" > ./.git/nm-find-backports \
|
git show "$ORIGIN/main:contrib/scripts/find-backports" > ./.git/nm-find-backports \
|
||||||
&& chmod +x ./.git/nm-find-backports \
|
&& chmod +x ./.git/nm-find-backports \
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,8 @@ pushd "$DIRNAME"
|
||||||
git remote add origin "git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git"
|
git remote add origin "git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git"
|
||||||
elif [[ "$BUILD_TYPE" == "dracut" ]]; then
|
elif [[ "$BUILD_TYPE" == "dracut" ]]; then
|
||||||
git remote add origin "https://github.com/dracutdevs/dracut.git"
|
git remote add origin "https://github.com/dracutdevs/dracut.git"
|
||||||
|
elif [[ "$BUILD_TYPE" == "systemd" ]]; then
|
||||||
|
git remote add origin "https://github.com/systemd/systemd.git"
|
||||||
elif [[ "$BUILD_TYPE" == "vpnc" ]]; then
|
elif [[ "$BUILD_TYPE" == "vpnc" ]]; then
|
||||||
git_remote_add_github ndpgroup/vpnc
|
git_remote_add_github ndpgroup/vpnc
|
||||||
fi
|
fi
|
||||||
|
|
@ -515,6 +517,9 @@ cc304f05edab6c408a0f061eb1a104f9f06b8587 86ef789876b65c61751ce854835b91d4 init
|
||||||
|
|
||||||
# dracut
|
# dracut
|
||||||
00efe708cab023bfe6eaf530d8ac8ea97b440de2 SHA512 (dracut-050.tar.xz) = 9d9a66acfd6b9d2fd50855a59a2393e0602c2ef97119db046f68d6167ea84d1423fa465b8b4d96339febb38d5a96df26dec7862c4b3397c3d726db18d280eee4
|
00efe708cab023bfe6eaf530d8ac8ea97b440de2 SHA512 (dracut-050.tar.xz) = 9d9a66acfd6b9d2fd50855a59a2393e0602c2ef97119db046f68d6167ea84d1423fa465b8b4d96339febb38d5a96df26dec7862c4b3397c3d726db18d280eee4
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
903dd65b5eb63257393955cb79777beb8c71afc1 SHA512 (systemd-253-rc1.tar.gz) = aaf0a6bf21bbc50a42015c9cb17f69d1aaf6cab6cabfba5140a94212fb864e38d638dace9a70447f62b4d2a817a0d3bd6f4ae8d9b3c2e741cdeb1cb332f70b65
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
OLDIFS="$IFS"
|
OLDIFS="$IFS"
|
||||||
|
|
|
||||||
58
contrib/scripts/git-backport-merge
Executable file
58
contrib/scripts/git-backport-merge
Executable file
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Uses `git cherry-pick -x` to backport a merge commit to an older branch.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# First checkout the old-stable branch, that is the target for the backport.
|
||||||
|
# Then `git-backport-merge MERGE_REF [REFS...]`
|
||||||
|
# MERGE_REF is the merge commit that should be backported.
|
||||||
|
# [REFS...] is the commits that should be backported. If omitted,
|
||||||
|
# it automatically takes the parent commits of the merge commit.
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf '%s\n' "$*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
backport_merge() {
|
||||||
|
test "$#" -gt 0 || die "Requires the commit ref to backport (and optimally select the commits to include)"
|
||||||
|
|
||||||
|
local M="${@:$#}"
|
||||||
|
local h
|
||||||
|
|
||||||
|
if test "$#" -eq 1; then
|
||||||
|
local C=($(git log --reverse "--pretty=%H" "$M"^1.."$M"^2))
|
||||||
|
else
|
||||||
|
local C=("${@:1:$#-1}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
local OLD_HEAD="$(git rev-parse HEAD)" || die "failed to get current HEAD"
|
||||||
|
|
||||||
|
test -n "$(git status --porcelain --untracked-files=no)" && die "Working directory contains changes. Abort."
|
||||||
|
|
||||||
|
local M_ID="$(git rev-parse "$M"^{commit})" || die "\"$M\" is not a valid commit"
|
||||||
|
|
||||||
|
trap EXIT 'test -z "$OLD_HEAD" || git reset "$OLD_HEAD" --hard'
|
||||||
|
|
||||||
|
for h in "${C[@]}"; do
|
||||||
|
if ! git cherry-pick --allow-empty -x "$h" ; then
|
||||||
|
git cherry-pick --abort
|
||||||
|
die "failed to cherry-pick commit \"$h\" on top of \"$(git rev-parse HEAD)\""
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local NEW_HEAD="$(git rev-parse HEAD)" || die "failed to get new HEAD"
|
||||||
|
|
||||||
|
git reset --hard "$OLD_HEAD" || die "Failed to reset to previous HEAD \"$OLD_HEAD\""
|
||||||
|
|
||||||
|
git merge --no-ff --no-edit "$NEW_HEAD" || die "Failed to merge old HEAD \"$OLD_HEAD\" with new \"$NEW_HEAD\""
|
||||||
|
|
||||||
|
git commit --amend --allow-empty -C "$M" || die "Failed to amend merge commit \"$(git rev-parse HEAD)\" with commit message from \"$M\""
|
||||||
|
|
||||||
|
git rev-parse "$M" | sed 's/.*/(cherry picked from commit \0)/' | GIT_EDITOR='sh -c "cat >> \"$1\""' git commit --allow-empty --amend || \
|
||||||
|
die "Failed to amend merge commit \"$(git rev-parse HEAD)\" with cherry-picked-from message from \"$M\""
|
||||||
|
|
||||||
|
OLD_HEAD=
|
||||||
|
}
|
||||||
|
|
||||||
|
backport_merge "$@"
|
||||||
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
# environment variables:
|
# environment variables:
|
||||||
# - GIT_REF: the ref that should be build. Can be "main" or a git sha.
|
# - GIT_REF: the ref that should be build. Can be "main" or a git sha.
|
||||||
# - DEBUG: set to 1 to build "--with debug".
|
# - DEBUG: set to 1 to build "--with debug". Otherwise the default is a release
|
||||||
|
# build.
|
||||||
|
# - LTO: set to 1/0 to build "--with/--without lto", otherwise the default depends
|
||||||
|
# on the distribution.
|
||||||
# - NM_GIT_BUNDLE: set to a HTTP url where to fetch the nm-git-bundle-*.noarch.rpm
|
# - NM_GIT_BUNDLE: set to a HTTP url where to fetch the nm-git-bundle-*.noarch.rpm
|
||||||
# from. Set to empty to skip it. By default, it fetches the bundle from copr.
|
# from. Set to empty to skip it. By default, it fetches the bundle from copr.
|
||||||
|
|
||||||
|
|
@ -14,6 +17,14 @@ else
|
||||||
DEBUG="--without debug"
|
DEBUG="--without debug"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$LTO" = 0 ]; then
|
||||||
|
LTO='--without lto'
|
||||||
|
elif [ "$LTO" = 1 ]; then
|
||||||
|
LTO='--with lto'
|
||||||
|
else
|
||||||
|
LTO=
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z "$GIT_REF" ]]; then
|
if [[ -z "$GIT_REF" ]]; then
|
||||||
echo "\$GIT_REF is not set!"
|
echo "\$GIT_REF is not set!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -55,11 +66,12 @@ git remote remove nm-git-bundle || true
|
||||||
|
|
||||||
GIT_SHA="$(git show-ref --verify --hash "$GIT_REF" 2>/dev/null ||
|
GIT_SHA="$(git show-ref --verify --hash "$GIT_REF" 2>/dev/null ||
|
||||||
git show-ref --verify --hash "refs/remotes/origin/$GIT_REF" 2>/dev/null ||
|
git show-ref --verify --hash "refs/remotes/origin/$GIT_REF" 2>/dev/null ||
|
||||||
|
git rev-parse --verify "refs/remotes/origin/$GIT_REF" 2>/dev/null ||
|
||||||
git rev-parse --verify "$GIT_REF^{commit}" 2>/dev/null)"
|
git rev-parse --verify "$GIT_REF^{commit}" 2>/dev/null)"
|
||||||
|
|
||||||
git checkout -b tmp "$GIT_SHA"
|
git checkout -b tmp "$GIT_SHA"
|
||||||
|
|
||||||
./contrib/fedora/rpm/build_clean.sh -g -S -w test $DEBUG -s copr
|
./contrib/fedora/rpm/build_clean.sh -g -S -w test $DEBUG $LTO -s copr
|
||||||
popd
|
popd
|
||||||
|
|
||||||
mv ./NetworkManager/contrib/fedora/rpm/latest/{SOURCES,SPECS}/* .
|
mv ./NetworkManager/contrib/fedora/rpm/latest/{SOURCES,SPECS}/* .
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,8 @@ done
|
||||||
|
|
||||||
case "$(git config --get-all remote.origin.url)" in
|
case "$(git config --get-all remote.origin.url)" in
|
||||||
"https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git"| \
|
"https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git"| \
|
||||||
"git@gitlab.freedesktop.org:NetworkManager/NetworkManager.git")
|
"git@gitlab.freedesktop.org:NetworkManager/NetworkManager.git"| \
|
||||||
|
"ssh://git@gitlab.freedesktop.org/NetworkManager/NetworkManager")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "unexpected git repository. Expected that remote.origin.url is set to \"https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git\""
|
die "unexpected git repository. Expected that remote.origin.url is set to \"https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git\""
|
||||||
|
|
@ -109,6 +110,7 @@ git_config_reset blame.markUnblamableLines true
|
||||||
git_config_add notes.displayref 'refs/notes/bugs'
|
git_config_add notes.displayref 'refs/notes/bugs'
|
||||||
git_config_add remote.origin.fetch 'refs/notes/bugs:refs/notes/bugs'
|
git_config_add remote.origin.fetch 'refs/notes/bugs:refs/notes/bugs'
|
||||||
git_config_reset remote.origin.pushurl 'git@gitlab.freedesktop.org:NetworkManager/NetworkManager.git'
|
git_config_reset remote.origin.pushurl 'git@gitlab.freedesktop.org:NetworkManager/NetworkManager.git'
|
||||||
|
git_config_add 'alias.backport-merge' '! (git show main:contrib/scripts/git-backport-merge || git show origin/main:contrib/scripts/git-backport-merge) | bash -s -'
|
||||||
|
|
||||||
if [ "$NO_TEST" != 1 ]; then
|
if [ "$NO_TEST" != 1 ]; then
|
||||||
printf "Run with \"--no-test\" or see \"-h\"\n" >&2
|
printf "Run with \"--no-test\" or see \"-h\"\n" >&2
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ project(
|
||||||
# - add corresponding NM_VERSION_x_y_z macros in
|
# - add corresponding NM_VERSION_x_y_z macros in
|
||||||
# "src/libnm-core-public/nm-version-macros.h.in"
|
# "src/libnm-core-public/nm-version-macros.h.in"
|
||||||
# - update number in configure.ac
|
# - update number in configure.ac
|
||||||
version: '1.42.0',
|
version: '1.43.2',
|
||||||
license: 'GPL2+',
|
license: 'GPL2+',
|
||||||
default_options: [
|
default_options: [
|
||||||
'buildtype=debugoptimized',
|
'buildtype=debugoptimized',
|
||||||
|
|
|
||||||
|
|
@ -6811,7 +6811,10 @@ device_link_changed(gpointer user_data)
|
||||||
* sync state transition.
|
* sync state transition.
|
||||||
*/
|
*/
|
||||||
nm_device_queue_recheck_assume(self);
|
nm_device_queue_recheck_assume(self);
|
||||||
nm_device_set_unmanaged_by_flags_queue(self, NM_UNMANAGED_PLATFORM_INIT, FALSE, reason);
|
nm_device_set_unmanaged_by_flags_queue(self,
|
||||||
|
NM_UNMANAGED_PLATFORM_INIT,
|
||||||
|
NM_UNMAN_FLAG_OP_SET_MANAGED,
|
||||||
|
reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
_dev_unmanaged_check_external_down(self, FALSE, FALSE);
|
_dev_unmanaged_check_external_down(self, FALSE, FALSE);
|
||||||
|
|
@ -7867,7 +7870,7 @@ nm_device_master_add_slave(NMDevice *self, NMDevice *slave, gboolean configure)
|
||||||
g_warn_if_fail(!NM_FLAGS_HAS(slave_priv->unmanaged_mask, NM_UNMANAGED_IS_SLAVE));
|
g_warn_if_fail(!NM_FLAGS_HAS(slave_priv->unmanaged_mask, NM_UNMANAGED_IS_SLAVE));
|
||||||
nm_device_set_unmanaged_by_flags(slave,
|
nm_device_set_unmanaged_by_flags(slave,
|
||||||
NM_UNMANAGED_IS_SLAVE,
|
NM_UNMANAGED_IS_SLAVE,
|
||||||
FALSE,
|
NM_UNMAN_FLAG_OP_SET_MANAGED,
|
||||||
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
|
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
} else
|
} else
|
||||||
|
|
@ -14691,7 +14694,7 @@ nm_device_set_unmanaged_by_quitting(NMDevice *self)
|
||||||
|
|
||||||
nm_device_set_unmanaged_by_flags(self,
|
nm_device_set_unmanaged_by_flags(self,
|
||||||
NM_UNMANAGED_QUITTING,
|
NM_UNMANAGED_QUITTING,
|
||||||
TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
need_deactivate ? NM_DEVICE_STATE_REASON_REMOVED
|
need_deactivate ? NM_DEVICE_STATE_REASON_REMOVED
|
||||||
: NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
: NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -608,9 +608,9 @@ typedef enum {
|
||||||
} NMUnmanagedFlags;
|
} NMUnmanagedFlags;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NM_UNMAN_FLAG_OP_SET_MANAGED = FALSE,
|
NM_UNMAN_FLAG_OP_SET_MANAGED = 0,
|
||||||
NM_UNMAN_FLAG_OP_SET_UNMANAGED = TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
NM_UNMAN_FLAG_OP_FORGET = 2,
|
NM_UNMAN_FLAG_OP_FORGET,
|
||||||
} NMUnmanFlagOp;
|
} NMUnmanFlagOp;
|
||||||
|
|
||||||
const char *nm_unmanaged_flags2str(NMUnmanagedFlags flags, char *buf, gsize len);
|
const char *nm_unmanaged_flags2str(NMUnmanagedFlags flags, char *buf, gsize len);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "libnm-glib-aux/nm-random-utils.h"
|
||||||
#include "libnm-platform/nm-platform-utils.h"
|
#include "libnm-platform/nm-platform-utils.h"
|
||||||
#include "libnm-platform/nm-platform.h"
|
#include "libnm-platform/nm-platform.h"
|
||||||
#include "libnm-platform/nmp-netns.h"
|
#include "libnm-platform/nmp-netns.h"
|
||||||
|
|
@ -858,7 +859,7 @@ solicit_retransmit_time_jitter(gint32 solicit_retransmit_time_msec)
|
||||||
ten_percent = NM_MAX(1, solicit_retransmit_time_msec / 10);
|
ten_percent = NM_MAX(1, solicit_retransmit_time_msec / 10);
|
||||||
|
|
||||||
return solicit_retransmit_time_msec - ten_percent
|
return solicit_retransmit_time_msec - ten_percent
|
||||||
+ ((gint32) (g_random_int() % (2u * ((guint32) ten_percent))));
|
+ ((gint32) (nm_random_u32() % (2u * ((guint32) ten_percent))));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
@ -936,7 +937,7 @@ solicit_timer_start(NMNDisc *ndisc)
|
||||||
* a suitable delay in 2021. Wait only up to 250 msec instead. */
|
* a suitable delay in 2021. Wait only up to 250 msec instead. */
|
||||||
|
|
||||||
delay_msec =
|
delay_msec =
|
||||||
g_random_int() % ((guint32) (NM_NDISC_RFC4861_MAX_RTR_SOLICITATION_DELAY * 1000 / 4));
|
nm_random_u32() % ((guint32) (NM_NDISC_RFC4861_MAX_RTR_SOLICITATION_DELAY * 1000 / 4));
|
||||||
|
|
||||||
_LOGD("solicit: schedule sending first solicitation (of %d) in %.3f seconds",
|
_LOGD("solicit: schedule sending first solicitation (of %d) in %.3f seconds",
|
||||||
priv->config.router_solicitations,
|
priv->config.router_solicitations,
|
||||||
|
|
@ -974,8 +975,9 @@ announce_router(NMNDisc *ndisc)
|
||||||
|
|
||||||
/* Schedule next initial announcement retransmit. */
|
/* Schedule next initial announcement retransmit. */
|
||||||
priv->send_ra_id =
|
priv->send_ra_id =
|
||||||
g_timeout_add_seconds(g_random_int_range(NM_NDISC_ROUTER_ADVERT_DELAY,
|
g_timeout_add_seconds(nm_random_u64_range_full(NM_NDISC_ROUTER_ADVERT_DELAY,
|
||||||
NM_NDISC_ROUTER_ADVERT_INITIAL_INTERVAL),
|
NM_NDISC_ROUTER_ADVERT_INITIAL_INTERVAL,
|
||||||
|
FALSE),
|
||||||
(GSourceFunc) announce_router,
|
(GSourceFunc) announce_router,
|
||||||
ndisc);
|
ndisc);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1009,10 +1011,9 @@ announce_router_initial(NMNDisc *ndisc)
|
||||||
/* Schedule the initial send rather early. Clamp the delay by minimal
|
/* Schedule the initial send rather early. Clamp the delay by minimal
|
||||||
* delay and not the initial advert internal so that we start fast. */
|
* delay and not the initial advert internal so that we start fast. */
|
||||||
if (G_LIKELY(!priv->send_ra_id)) {
|
if (G_LIKELY(!priv->send_ra_id)) {
|
||||||
priv->send_ra_id =
|
priv->send_ra_id = g_timeout_add_seconds(nm_random_u64_range(NM_NDISC_ROUTER_ADVERT_DELAY),
|
||||||
g_timeout_add_seconds(g_random_int_range(0, NM_NDISC_ROUTER_ADVERT_DELAY),
|
(GSourceFunc) announce_router,
|
||||||
(GSourceFunc) announce_router,
|
ndisc);
|
||||||
ndisc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1028,7 +1029,7 @@ announce_router_solicited(NMNDisc *ndisc)
|
||||||
nm_clear_g_source(&priv->send_ra_id);
|
nm_clear_g_source(&priv->send_ra_id);
|
||||||
|
|
||||||
if (!priv->send_ra_id) {
|
if (!priv->send_ra_id) {
|
||||||
priv->send_ra_id = g_timeout_add(g_random_int_range(0, NM_NDISC_ROUTER_ADVERT_DELAY_MS),
|
priv->send_ra_id = g_timeout_add(nm_random_u64_range(NM_NDISC_ROUTER_ADVERT_DELAY_MS),
|
||||||
(GSourceFunc) announce_router,
|
(GSourceFunc) announce_router,
|
||||||
ndisc);
|
ndisc);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -368,7 +368,7 @@ nm_checkpoint_rollback(NMCheckpoint *self)
|
||||||
_LOGD("rollback: device was not realized, unmanage it");
|
_LOGD("rollback: device was not realized, unmanage it");
|
||||||
nm_device_set_unmanaged_by_flags_queue(device,
|
nm_device_set_unmanaged_by_flags_queue(device,
|
||||||
NM_UNMANAGED_USER_EXPLICIT,
|
NM_UNMANAGED_USER_EXPLICIT,
|
||||||
TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
||||||
goto next_dev;
|
goto next_dev;
|
||||||
}
|
}
|
||||||
|
|
@ -402,7 +402,7 @@ nm_checkpoint_rollback(NMCheckpoint *self)
|
||||||
_LOGD("rollback: explicitly unmanage device");
|
_LOGD("rollback: explicitly unmanage device");
|
||||||
nm_device_set_unmanaged_by_flags_queue(device,
|
nm_device_set_unmanaged_by_flags_queue(device,
|
||||||
NM_UNMANAGED_USER_EXPLICIT,
|
NM_UNMANAGED_USER_EXPLICIT,
|
||||||
TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
||||||
}
|
}
|
||||||
goto next_dev;
|
goto next_dev;
|
||||||
|
|
|
||||||
|
|
@ -3673,9 +3673,7 @@ _hw_addr_eth_complete(struct ether_addr *addr,
|
||||||
|
|
||||||
nm_assert((ouis == NULL) ^ (ouis_len != 0));
|
nm_assert((ouis == NULL) ^ (ouis_len != 0));
|
||||||
if (ouis) {
|
if (ouis) {
|
||||||
/* g_random_int() is good enough here. It uses a static GRand instance
|
oui = ouis[nm_random_u64_range(ouis_len)];
|
||||||
* that is seeded from /dev/urandom. */
|
|
||||||
oui = ouis[g_random_int() % ouis_len];
|
|
||||||
g_free(ouis);
|
g_free(ouis);
|
||||||
} else {
|
} else {
|
||||||
if (!nm_utils_hwaddr_aton(current_mac_address, &oui, ETH_ALEN))
|
if (!nm_utils_hwaddr_aton(current_mac_address, &oui, ETH_ALEN))
|
||||||
|
|
|
||||||
|
|
@ -1804,7 +1804,7 @@ remove_device(NMManager *self, NMDevice *device, gboolean quitting)
|
||||||
nm_device_sys_iface_state_set(device, NM_DEVICE_SYS_IFACE_STATE_REMOVED);
|
nm_device_sys_iface_state_set(device, NM_DEVICE_SYS_IFACE_STATE_REMOVED);
|
||||||
nm_device_set_unmanaged_by_flags(device,
|
nm_device_set_unmanaged_by_flags(device,
|
||||||
NM_UNMANAGED_PLATFORM_INIT,
|
NM_UNMANAGED_PLATFORM_INIT,
|
||||||
TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
NM_DEVICE_STATE_REASON_REMOVED);
|
NM_DEVICE_STATE_REASON_REMOVED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4942,12 +4942,12 @@ unmanaged_to_disconnected(NMDevice *device)
|
||||||
* and force the device to be managed. */
|
* and force the device to be managed. */
|
||||||
nm_device_set_unmanaged_by_flags(device,
|
nm_device_set_unmanaged_by_flags(device,
|
||||||
NM_UNMANAGED_PLATFORM_INIT,
|
NM_UNMANAGED_PLATFORM_INIT,
|
||||||
FALSE,
|
NM_UNMAN_FLAG_OP_SET_MANAGED,
|
||||||
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
||||||
|
|
||||||
nm_device_set_unmanaged_by_flags(device,
|
nm_device_set_unmanaged_by_flags(device,
|
||||||
NM_UNMANAGED_USER_EXPLICIT,
|
NM_UNMANAGED_USER_EXPLICIT,
|
||||||
FALSE,
|
NM_UNMAN_FLAG_OP_SET_MANAGED,
|
||||||
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
||||||
|
|
||||||
if (!nm_device_get_managed(device, FALSE)) {
|
if (!nm_device_get_managed(device, FALSE)) {
|
||||||
|
|
@ -6500,7 +6500,7 @@ device_sleep_cb(NMDevice *device, GParamSpec *pspec, NMManager *self)
|
||||||
_LOGD(LOGD_SUSPEND, "sleep: unmanaging device %s", nm_device_get_ip_iface(device));
|
_LOGD(LOGD_SUSPEND, "sleep: unmanaging device %s", nm_device_get_ip_iface(device));
|
||||||
nm_device_set_unmanaged_by_flags_queue(device,
|
nm_device_set_unmanaged_by_flags_queue(device,
|
||||||
NM_UNMANAGED_SLEEPING,
|
NM_UNMANAGED_SLEEPING,
|
||||||
TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
NM_DEVICE_STATE_REASON_SLEEPING);
|
NM_DEVICE_STATE_REASON_SLEEPING);
|
||||||
break;
|
break;
|
||||||
case NM_DEVICE_STATE_UNMANAGED:
|
case NM_DEVICE_STATE_UNMANAGED:
|
||||||
|
|
@ -6562,7 +6562,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed)
|
||||||
} else {
|
} else {
|
||||||
nm_device_set_unmanaged_by_flags(device,
|
nm_device_set_unmanaged_by_flags(device,
|
||||||
NM_UNMANAGED_SLEEPING,
|
NM_UNMANAGED_SLEEPING,
|
||||||
TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
NM_DEVICE_STATE_REASON_SLEEPING);
|
NM_DEVICE_STATE_REASON_SLEEPING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6582,7 +6582,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed)
|
||||||
if (device_is_wake_on_lan(priv->platform, device))
|
if (device_is_wake_on_lan(priv->platform, device))
|
||||||
nm_device_set_unmanaged_by_flags(device,
|
nm_device_set_unmanaged_by_flags(device,
|
||||||
NM_UNMANAGED_SLEEPING,
|
NM_UNMANAGED_SLEEPING,
|
||||||
TRUE,
|
NM_UNMAN_FLAG_OP_SET_UNMANAGED,
|
||||||
NM_DEVICE_STATE_REASON_SLEEPING);
|
NM_DEVICE_STATE_REASON_SLEEPING);
|
||||||
|
|
||||||
/* Check if the device is unmanaged but the state transition is still pending.
|
/* Check if the device is unmanaged but the state transition is still pending.
|
||||||
|
|
@ -6638,7 +6638,7 @@ do_sleep_wake(NMManager *self, gboolean sleeping_changed)
|
||||||
|
|
||||||
nm_device_set_unmanaged_by_flags(device,
|
nm_device_set_unmanaged_by_flags(device,
|
||||||
NM_UNMANAGED_SLEEPING,
|
NM_UNMANAGED_SLEEPING,
|
||||||
FALSE,
|
NM_UNMAN_FLAG_OP_SET_MANAGED,
|
||||||
NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "nm-libnm-aux.h"
|
#include "nm-libnm-aux.h"
|
||||||
|
|
||||||
|
#include "libnm-glib-aux/nm-random-utils.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
NMClient *
|
NMClient *
|
||||||
|
|
@ -101,7 +103,7 @@ nmc_client_new_waitsync(GCancellable *cancellable,
|
||||||
* code no longer uses that, we hardly test those code paths. But they should
|
* code no longer uses that, we hardly test those code paths. But they should
|
||||||
* work just the same. Randomly use instead the sync initialization in a debug
|
* work just the same. Randomly use instead the sync initialization in a debug
|
||||||
* build... */
|
* build... */
|
||||||
if ((g_random_int() % 2) == 0) {
|
if (nm_random_bool()) {
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
|
||||||
va_start(ap, first_property_name);
|
va_start(ap, first_property_name);
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,7 @@ static void name_owner_changed_cb(GDBusConnection *connection,
|
||||||
|
|
||||||
static void name_owner_get_call(NMClient *self);
|
static void name_owner_get_call(NMClient *self);
|
||||||
|
|
||||||
static void _set_nm_running(NMClient *self);
|
static void _set_nm_running(NMClient *self, gboolean queue_notify);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
@ -2724,6 +2724,7 @@ _obj_handle_dbus_changes(NMClient *self, NMLDBusObject *dbobj)
|
||||||
if (dbobj->dbus_path == _dbus_path_nm) {
|
if (dbobj->dbus_path == _dbus_path_nm) {
|
||||||
nm_assert(!priv->dbobj_nm);
|
nm_assert(!priv->dbobj_nm);
|
||||||
priv->dbobj_nm = dbobj;
|
priv->dbobj_nm = dbobj;
|
||||||
|
_set_nm_running(self, TRUE);
|
||||||
} else if (dbobj->dbus_path == _dbus_path_settings) {
|
} else if (dbobj->dbus_path == _dbus_path_settings) {
|
||||||
nm_assert(!priv->dbobj_settings);
|
nm_assert(!priv->dbobj_settings);
|
||||||
priv->dbobj_settings = dbobj;
|
priv->dbobj_settings = dbobj;
|
||||||
|
|
@ -2783,6 +2784,7 @@ _obj_handle_dbus_changes(NMClient *self, NMLDBusObject *dbobj)
|
||||||
if (dbobj->dbus_path == _dbus_path_nm) {
|
if (dbobj->dbus_path == _dbus_path_nm) {
|
||||||
nm_assert(priv->dbobj_nm == dbobj);
|
nm_assert(priv->dbobj_nm == dbobj);
|
||||||
priv->dbobj_nm = NULL;
|
priv->dbobj_nm = NULL;
|
||||||
|
_set_nm_running(self, TRUE);
|
||||||
nml_dbus_property_o_clear_many(priv->nm.property_o,
|
nml_dbus_property_o_clear_many(priv->nm.property_o,
|
||||||
G_N_ELEMENTS(priv->nm.property_o),
|
G_N_ELEMENTS(priv->nm.property_o),
|
||||||
self);
|
self);
|
||||||
|
|
@ -2936,7 +2938,7 @@ _dbus_handle_changes_commit(NMClient *self, gboolean allow_init_start_check_comp
|
||||||
|
|
||||||
_nm_client_notify_event_emit(self);
|
_nm_client_notify_event_emit(self);
|
||||||
|
|
||||||
_set_nm_running(self);
|
_set_nm_running(self, FALSE);
|
||||||
|
|
||||||
if (allow_init_start_check_complete)
|
if (allow_init_start_check_complete)
|
||||||
_init_start_check_complete(self);
|
_init_start_check_complete(self);
|
||||||
|
|
@ -3079,11 +3081,10 @@ _dbus_handle_interface_added(NMClient *self,
|
||||||
const char *object_path,
|
const char *object_path,
|
||||||
GVariant *ifaces)
|
GVariant *ifaces)
|
||||||
{
|
{
|
||||||
gboolean changed = FALSE;
|
gboolean changed = FALSE;
|
||||||
const char *interface_name;
|
const char *interface_name;
|
||||||
GVariant *changed_properties;
|
GVariant *changed_properties;
|
||||||
GVariantIter iter_ifaces;
|
GVariantIter iter_ifaces;
|
||||||
NMLDBusObject *dbobj = NULL;
|
|
||||||
|
|
||||||
nm_assert(g_variant_is_of_type(ifaces, G_VARIANT_TYPE("a{sa{sv}}")));
|
nm_assert(g_variant_is_of_type(ifaces, G_VARIANT_TYPE("a{sa{sv}}")));
|
||||||
|
|
||||||
|
|
@ -3097,7 +3098,7 @@ _dbus_handle_interface_added(NMClient *self,
|
||||||
interface_name,
|
interface_name,
|
||||||
TRUE,
|
TRUE,
|
||||||
changed_properties,
|
changed_properties,
|
||||||
&dbobj))
|
NULL))
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4084,15 +4085,18 @@ nm_client_get_startup(NMClient *client)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_set_nm_running(NMClient *self)
|
_set_nm_running(NMClient *self, gboolean queue_notify)
|
||||||
{
|
{
|
||||||
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE(self);
|
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE(self);
|
||||||
gboolean nm_running;
|
gboolean nm_running;
|
||||||
|
|
||||||
nm_running = priv->name_owner && !priv->get_managed_objects_cancellable;
|
nm_running = priv->dbobj_nm && priv->name_owner && !priv->get_managed_objects_cancellable;
|
||||||
if (priv->nm_running != nm_running) {
|
if (priv->nm_running != nm_running) {
|
||||||
priv->nm_running = nm_running;
|
priv->nm_running = nm_running;
|
||||||
_notify(self, PROP_NM_RUNNING);
|
if (queue_notify) {
|
||||||
|
_nm_client_queue_notify_object(self, self, obj_properties[PROP_NM_RUNNING]);
|
||||||
|
} else
|
||||||
|
_notify(self, PROP_NM_RUNNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7172,7 +7176,7 @@ name_owner_changed(NMClient *self, const char *name_owner)
|
||||||
if (changed && priv->name_owner)
|
if (changed && priv->name_owner)
|
||||||
_init_fetch_all(self);
|
_init_fetch_all(self);
|
||||||
|
|
||||||
_set_nm_running(self);
|
_set_nm_running(self, FALSE);
|
||||||
|
|
||||||
if (priv->init_data) {
|
if (priv->init_data) {
|
||||||
nm_auto_pop_gmaincontext GMainContext *main_context = NULL;
|
nm_auto_pop_gmaincontext GMainContext *main_context = NULL;
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@
|
||||||
#define NM_VERSION_1_38 (NM_ENCODE_VERSION(1, 38, 0))
|
#define NM_VERSION_1_38 (NM_ENCODE_VERSION(1, 38, 0))
|
||||||
#define NM_VERSION_1_40 (NM_ENCODE_VERSION(1, 40, 0))
|
#define NM_VERSION_1_40 (NM_ENCODE_VERSION(1, 40, 0))
|
||||||
#define NM_VERSION_1_42 (NM_ENCODE_VERSION(1, 42, 0))
|
#define NM_VERSION_1_42 (NM_ENCODE_VERSION(1, 42, 0))
|
||||||
|
#define NM_VERSION_1_44 (NM_ENCODE_VERSION(1, 44, 0))
|
||||||
|
|
||||||
/* For releases, NM_API_VERSION is equal to NM_VERSION.
|
/* For releases, NM_API_VERSION is equal to NM_VERSION.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,20 @@
|
||||||
#define NM_AVAILABLE_IN_1_42
|
#define NM_AVAILABLE_IN_1_42
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NM_VERSION_MIN_REQUIRED >= NM_VERSION_1_44
|
||||||
|
#define NM_DEPRECATED_IN_1_44 G_DEPRECATED
|
||||||
|
#define NM_DEPRECATED_IN_1_44_FOR(f) G_DEPRECATED_FOR(f)
|
||||||
|
#else
|
||||||
|
#define NM_DEPRECATED_IN_1_44
|
||||||
|
#define NM_DEPRECATED_IN_1_44_FOR(f)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if NM_VERSION_MAX_ALLOWED < NM_VERSION_1_44
|
||||||
|
#define NM_AVAILABLE_IN_1_44 G_UNAVAILABLE(1, 44)
|
||||||
|
#else
|
||||||
|
#define NM_AVAILABLE_IN_1_44
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Synchronous API for calling D-Bus in libnm is deprecated. See
|
* Synchronous API for calling D-Bus in libnm is deprecated. See
|
||||||
* https://networkmanager.dev/docs/libnm/latest/usage.html#sync-api
|
* https://networkmanager.dev/docs/libnm/latest/usage.html#sync-api
|
||||||
|
|
|
||||||
|
|
@ -447,3 +447,53 @@ again_getrandom:
|
||||||
|
|
||||||
return nm_utils_fd_read_loop_exact(fd, p, n, FALSE);
|
return nm_utils_fd_read_loop_exact(fd, p, n, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint64
|
||||||
|
nm_random_u64_range_full(guint64 begin, guint64 end, gboolean crypto_bytes)
|
||||||
|
{
|
||||||
|
gboolean bad_crypto_bytes = FALSE;
|
||||||
|
guint64 remainder;
|
||||||
|
guint64 maxvalue;
|
||||||
|
guint64 x;
|
||||||
|
guint64 m;
|
||||||
|
|
||||||
|
/* Returns a random #guint64 equally distributed in the range [@begin..@end-1].
|
||||||
|
*
|
||||||
|
* The function always set errno. It either sets it to zero or to EAGAIN
|
||||||
|
* (if crypto_bytes were requested but not obtained). In any case, the function
|
||||||
|
* will always return a random number in the requested range (worst case, it's
|
||||||
|
* not crypto_bytes despite being requested). Check errno if you care. */
|
||||||
|
|
||||||
|
if (begin >= end) {
|
||||||
|
/* systemd's random_u64_range(0) is an alias for random_u64_range((uint64_t)-1).
|
||||||
|
* Not for us. It's a caller error to request an element from an empty range. */
|
||||||
|
return nm_assert_unreachable_val(begin);
|
||||||
|
}
|
||||||
|
|
||||||
|
m = end - begin;
|
||||||
|
|
||||||
|
if (m == 1) {
|
||||||
|
x = 0;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
remainder = G_MAXUINT64 % m;
|
||||||
|
maxvalue = G_MAXUINT64 - remainder;
|
||||||
|
|
||||||
|
do
|
||||||
|
if (crypto_bytes) {
|
||||||
|
if (nm_random_get_crypto_bytes(&x, sizeof(x)) < 0) {
|
||||||
|
/* Cannot get good crypto numbers. We will try our best, but fail
|
||||||
|
* and set errno below. */
|
||||||
|
crypto_bytes = FALSE;
|
||||||
|
bad_crypto_bytes = TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
nm_random_get_bytes(&x, sizeof(x));
|
||||||
|
while (x >= maxvalue);
|
||||||
|
|
||||||
|
out:
|
||||||
|
errno = bad_crypto_bytes ? EAGAIN : 0;
|
||||||
|
return begin + (x % m);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,39 @@ nm_random_get_bytes(void *p, size_t n)
|
||||||
|
|
||||||
int nm_random_get_crypto_bytes(void *p, size_t n);
|
int nm_random_get_crypto_bytes(void *p, size_t n);
|
||||||
|
|
||||||
|
static inline guint32
|
||||||
|
nm_random_u32(void)
|
||||||
|
{
|
||||||
|
guint32 v;
|
||||||
|
|
||||||
|
nm_random_get_bytes(&v, sizeof(v));
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline guint64
|
||||||
|
nm_random_u64(void)
|
||||||
|
{
|
||||||
|
guint64 v;
|
||||||
|
|
||||||
|
nm_random_get_bytes(&v, sizeof(v));
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
nm_random_bool(void)
|
||||||
|
{
|
||||||
|
guint8 ch;
|
||||||
|
|
||||||
|
nm_random_get_bytes(&ch, sizeof(ch));
|
||||||
|
return ch % 2u;
|
||||||
|
}
|
||||||
|
|
||||||
|
guint64 nm_random_u64_range_full(guint64 begin, guint64 end, gboolean crypto_bytes);
|
||||||
|
|
||||||
|
static inline guint64
|
||||||
|
nm_random_u64_range(guint64 end)
|
||||||
|
{
|
||||||
|
return nm_random_u64_range_full(0, end, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __NM_RANDOM_UTILS_H__ */
|
#endif /* __NM_RANDOM_UTILS_H__ */
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,55 @@ test_nmhash(void)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_nm_random(void)
|
||||||
|
{
|
||||||
|
int i_run;
|
||||||
|
|
||||||
|
for (i_run = 0; i_run < 1000; i_run++) {
|
||||||
|
guint64 begin;
|
||||||
|
guint64 end;
|
||||||
|
guint64 m;
|
||||||
|
guint64 x;
|
||||||
|
|
||||||
|
m = nmtst_get_rand_uint64();
|
||||||
|
m = m >> (nmtst_get_rand_uint32() % 64);
|
||||||
|
|
||||||
|
if (m == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (nmtst_get_rand_uint32() % 4) {
|
||||||
|
case 0:
|
||||||
|
begin = 0;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
begin = nmtst_get_rand_uint64() % 1000;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
begin = ((G_MAXUINT64 - m) - 500) + (nmtst_get_rand_uint64() % 1000);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
begin = nmtst_get_rand_uint64() % (G_MAXUINT64 - m);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
end = (begin + m) - 10 + (nmtst_get_rand_uint64() % 5);
|
||||||
|
|
||||||
|
if (begin >= end)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (begin == 0 && nmtst_get_rand_bool())
|
||||||
|
x = nm_random_u64_range(end);
|
||||||
|
else
|
||||||
|
x = nm_random_u64_range_full(begin, end, nmtst_get_rand_bool());
|
||||||
|
|
||||||
|
g_assert_cmpuint(x, >=, begin);
|
||||||
|
g_assert_cmpuint(x, <, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
_make_strv_foo(void)
|
_make_strv_foo(void)
|
||||||
{
|
{
|
||||||
|
|
@ -2417,6 +2466,7 @@ main(int argc, char **argv)
|
||||||
g_test_add_func("/general/test_inet_utils", test_inet_utils);
|
g_test_add_func("/general/test_inet_utils", test_inet_utils);
|
||||||
g_test_add_func("/general/test_garray", test_garray);
|
g_test_add_func("/general/test_garray", test_garray);
|
||||||
g_test_add_func("/general/test_nm_prioq", test_nm_prioq);
|
g_test_add_func("/general/test_nm_prioq", test_nm_prioq);
|
||||||
|
g_test_add_func("/general/test_nm_random", test_nm_random);
|
||||||
|
|
||||||
return g_test_run();
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -707,6 +707,20 @@ _nm_log_impl(const char *file,
|
||||||
|
|
||||||
msg = nm_vsprintf_buf_or_alloc(fmt, fmt, msg_stack, &msg_heap, NULL);
|
msg = nm_vsprintf_buf_or_alloc(fmt, fmt, msg_stack, &msg_heap, NULL);
|
||||||
|
|
||||||
|
/* We always print the level and the timestamp.
|
||||||
|
*
|
||||||
|
* Timestamps are very useful for understanding logfiles. While journalctl
|
||||||
|
* might record the timestamp, it is not present in plain `journalctl` output.
|
||||||
|
* Users who report a bug would simply send us the `journalctl` output and
|
||||||
|
* requesting an output with timestamps (even if it's stored somewhere inside
|
||||||
|
* journald) is not workable.
|
||||||
|
*
|
||||||
|
* We print the level, because this too, it's to quickly identify the severity
|
||||||
|
* of a message.
|
||||||
|
*
|
||||||
|
* We also do this for all messages (for all levels), because then the logging
|
||||||
|
* lines are formatted and aligned in a consistent way, which aids reading the
|
||||||
|
* logs. */
|
||||||
#define MESSAGE_FMT "%s%-7s [%ld.%04ld] %s"
|
#define MESSAGE_FMT "%s%-7s [%ld.%04ld] %s"
|
||||||
#define MESSAGE_ARG(prefix, tv, msg) \
|
#define MESSAGE_ARG(prefix, tv, msg) \
|
||||||
prefix, nm_log_level_desc[level].level_str, (tv).tv_sec, ((tv).tv_usec / 100), (msg)
|
prefix, nm_log_level_desc[level].level_str, (tv).tv_sec, ((tv).tv_usec / 100), (msg)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
#include <linux/if_ether.h>
|
#include <linux/if_ether.h>
|
||||||
|
|
||||||
#include "libnm-glib-aux/nm-secret-utils.h"
|
#include "libnm-glib-aux/nm-secret-utils.h"
|
||||||
|
#include "libnm-glib-aux/nm-random-utils.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "connections.h"
|
#include "connections.h"
|
||||||
#include "libnmc-base/nm-client-utils.h"
|
#include "libnmc-base/nm-client-utils.h"
|
||||||
|
|
@ -4102,10 +4103,11 @@ generate_wpa_key(char *key, size_t len)
|
||||||
/* generate a 8-chars ASCII WPA key */
|
/* generate a 8-chars ASCII WPA key */
|
||||||
for (i = 0; i < WPA_PASSKEY_SIZE; i++) {
|
for (i = 0; i < WPA_PASSKEY_SIZE; i++) {
|
||||||
int c;
|
int c;
|
||||||
c = g_random_int_range(33, 126);
|
|
||||||
/* too many non alphanumeric characters are hard to remember for humans */
|
do {
|
||||||
while (!g_ascii_isalnum(c))
|
c = nm_random_u64_range_full(33, 126, TRUE);
|
||||||
c = g_random_int_range(33, 126);
|
/* too many non alphanumeric characters are hard to remember for humans */
|
||||||
|
} while (g_ascii_isalnum(c));
|
||||||
|
|
||||||
key[i] = (char) c;
|
key[i] = (char) c;
|
||||||
}
|
}
|
||||||
|
|
@ -4124,7 +4126,8 @@ generate_wep_key(char *key, size_t len)
|
||||||
/* generate a 10-digit hex WEP key */
|
/* generate a 10-digit hex WEP key */
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
int digit;
|
int digit;
|
||||||
digit = g_random_int_range(0, 16);
|
|
||||||
|
digit = nm_random_u64_range_full(0, 16, TRUE);
|
||||||
key[i] = hexdigits[digit];
|
key[i] = hexdigits[digit];
|
||||||
}
|
}
|
||||||
key[10] = '\0';
|
key[10] = '\0';
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue