mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-20 07:00:39 +01:00
systemd: update code from upstream (2019-11-19)
This is a direct dump from systemd git.
======
SYSTEMD_DIR=../systemd
COMMIT=25f9288e31a586460c13d49edea9edafdca2a972
(
cd "$SYSTEMD_DIR"
git checkout "$COMMIT"
git reset --hard
git clean -fdx
)
git ls-files -z :/src/systemd/src/ \
:/shared/systemd/src/ \
:/shared/nm-std-aux/unaligned.h | \
xargs -0 rm -f
nm_copy_sd_shared() {
mkdir -p "./shared/systemd/$(dirname "$1")"
cp "$SYSTEMD_DIR/$1" "./shared/systemd/$1"
}
nm_copy_sd_core() {
mkdir -p "./src/systemd/$(dirname "$1")"
cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}
nm_copy_sd_stdaux() {
mkdir -p "./shared/nm-std-aux/"
cp "$SYSTEMD_DIR/$1" "./shared/nm-std-aux/${1##*/}"
}
nm_copy_sd_core "src/libsystemd-network/arp-util.c"
nm_copy_sd_core "src/libsystemd-network/arp-util.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
nm_copy_sd_core "src/libsystemd-network/network-internal.c"
nm_copy_sd_core "src/libsystemd-network/network-internal.h"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd_core "src/systemd/_sd-common.h"
nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
nm_copy_sd_core "src/systemd/sd-dhcp-option.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd_core "src/systemd/sd-event.h"
nm_copy_sd_core "src/systemd/sd-id128.h"
nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
nm_copy_sd_core "src/systemd/sd-lldp.h"
nm_copy_sd_core "src/systemd/sd-ndisc.h"
nm_copy_sd_shared "src/basic/alloc-util.c"
nm_copy_sd_shared "src/basic/alloc-util.h"
nm_copy_sd_shared "src/basic/async.h"
nm_copy_sd_shared "src/basic/env-file.c"
nm_copy_sd_shared "src/basic/env-file.h"
nm_copy_sd_shared "src/basic/env-util.c"
nm_copy_sd_shared "src/basic/env-util.h"
nm_copy_sd_shared "src/basic/errno-util.h"
nm_copy_sd_shared "src/basic/escape.c"
nm_copy_sd_shared "src/basic/escape.h"
nm_copy_sd_shared "src/basic/ether-addr-util.c"
nm_copy_sd_shared "src/basic/ether-addr-util.h"
nm_copy_sd_shared "src/basic/extract-word.c"
nm_copy_sd_shared "src/basic/extract-word.h"
nm_copy_sd_shared "src/basic/fd-util.c"
nm_copy_sd_shared "src/basic/fd-util.h"
nm_copy_sd_shared "src/basic/fileio.c"
nm_copy_sd_shared "src/basic/fileio.h"
nm_copy_sd_shared "src/basic/format-util.c"
nm_copy_sd_shared "src/basic/format-util.h"
nm_copy_sd_shared "src/basic/fs-util.c"
nm_copy_sd_shared "src/basic/fs-util.h"
nm_copy_sd_shared "src/basic/hash-funcs.c"
nm_copy_sd_shared "src/basic/hash-funcs.h"
nm_copy_sd_shared "src/basic/hashmap.c"
nm_copy_sd_shared "src/basic/hashmap.h"
nm_copy_sd_shared "src/basic/hexdecoct.c"
nm_copy_sd_shared "src/basic/hexdecoct.h"
nm_copy_sd_shared "src/basic/hostname-util.c"
nm_copy_sd_shared "src/basic/hostname-util.h"
nm_copy_sd_shared "src/basic/in-addr-util.c"
nm_copy_sd_shared "src/basic/in-addr-util.h"
nm_copy_sd_shared "src/basic/io-util.c"
nm_copy_sd_shared "src/basic/io-util.h"
nm_copy_sd_shared "src/basic/list.h"
nm_copy_sd_shared "src/basic/log.h"
nm_copy_sd_shared "src/basic/macro.h"
nm_copy_sd_shared "src/basic/memory-util.c"
nm_copy_sd_shared "src/basic/memory-util.h"
nm_copy_sd_shared "src/basic/mempool.c"
nm_copy_sd_shared "src/basic/mempool.h"
nm_copy_sd_shared "src/basic/missing_fcntl.h"
nm_copy_sd_shared "src/basic/missing_random.h"
nm_copy_sd_shared "src/basic/missing_socket.h"
nm_copy_sd_shared "src/basic/missing_stat.h"
nm_copy_sd_shared "src/basic/missing_type.h"
nm_copy_sd_shared "src/basic/parse-util.c"
nm_copy_sd_shared "src/basic/parse-util.h"
nm_copy_sd_shared "src/basic/path-util.c"
nm_copy_sd_shared "src/basic/path-util.h"
nm_copy_sd_shared "src/basic/prioq.c"
nm_copy_sd_shared "src/basic/prioq.h"
nm_copy_sd_shared "src/basic/process-util.c"
nm_copy_sd_shared "src/basic/process-util.h"
nm_copy_sd_shared "src/basic/random-util.c"
nm_copy_sd_shared "src/basic/random-util.h"
nm_copy_sd_shared "src/basic/set.h"
nm_copy_sd_shared "src/basic/signal-util.h"
nm_copy_sd_shared "src/basic/siphash24.h"
nm_copy_sd_shared "src/basic/socket-util.c"
nm_copy_sd_shared "src/basic/socket-util.h"
nm_copy_sd_shared "src/basic/sort-util.h"
nm_copy_sd_shared "src/basic/sparse-endian.h"
nm_copy_sd_shared "src/basic/stat-util.c"
nm_copy_sd_shared "src/basic/stat-util.h"
nm_copy_sd_shared "src/basic/stdio-util.h"
nm_copy_sd_shared "src/basic/string-table.c"
nm_copy_sd_shared "src/basic/string-table.h"
nm_copy_sd_shared "src/basic/string-util.c"
nm_copy_sd_shared "src/basic/string-util.h"
nm_copy_sd_shared "src/basic/strv.c"
nm_copy_sd_shared "src/basic/strv.h"
nm_copy_sd_shared "src/basic/strxcpyx.c"
nm_copy_sd_shared "src/basic/strxcpyx.h"
nm_copy_sd_shared "src/basic/time-util.c"
nm_copy_sd_shared "src/basic/time-util.h"
nm_copy_sd_shared "src/basic/tmpfile-util.c"
nm_copy_sd_shared "src/basic/tmpfile-util.h"
nm_copy_sd_shared "src/basic/umask-util.h"
nm_copy_sd_shared "src/basic/utf8.c"
nm_copy_sd_shared "src/basic/utf8.h"
nm_copy_sd_shared "src/basic/util.c"
nm_copy_sd_shared "src/basic/util.h"
nm_copy_sd_shared "src/shared/dns-domain.c"
nm_copy_sd_shared "src/shared/dns-domain.h"
nm_copy_sd_stdaux "src/basic/unaligned.h"
This commit is contained in:
commit
046568cd09
2301 changed files with 1250511 additions and 448997 deletions
257
.gitignore
vendored
257
.gitignore
vendored
|
|
@ -6,11 +6,14 @@
|
|||
*.gcno
|
||||
*.gcda
|
||||
*.la
|
||||
*.bz2
|
||||
*.gir
|
||||
*-*.gir
|
||||
*.typelib
|
||||
*.stamp
|
||||
.dirstamp
|
||||
*-enum-types.[ch]
|
||||
*-glue.h
|
||||
*.loT
|
||||
*.pyc
|
||||
Makefile
|
||||
Makefile.in*
|
||||
compile
|
||||
|
|
@ -28,41 +31,58 @@ gtk-doc.make
|
|||
*.pc
|
||||
cscope.*out
|
||||
valgrind-*.log
|
||||
*-glue.h
|
||||
test-*.log
|
||||
test-*.trs
|
||||
/.zanata-cache/
|
||||
|
||||
/build/
|
||||
|
||||
/NetworkManager-*.tar.*
|
||||
|
||||
/ABOUT-NLS
|
||||
/COPYING
|
||||
/INSTALL
|
||||
/TAGS
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/build-aux
|
||||
/config.*
|
||||
/config-extra.h
|
||||
/configure
|
||||
/intltool-*
|
||||
|
||||
/callouts/nm-avahi-autoipd.action
|
||||
/callouts/nm-dispatcher
|
||||
/callouts/nmdbus-dispatcher.*
|
||||
/callouts/org.freedesktop.nm_dispatcher.service
|
||||
/callouts/tests/test-dispatcher-envp
|
||||
/confdefs.h
|
||||
/conftest.[ch]
|
||||
/conftest.o.*
|
||||
|
||||
/contrib/fedora/rpm/NetworkManager.*.??????/
|
||||
/contrib/fedora/rpm/latest0
|
||||
/contrib/fedora/rpm/latest
|
||||
|
||||
/dispatcher/nm-avahi-autoipd.action
|
||||
/dispatcher/nm-dispatcher
|
||||
/dispatcher/nmdbus-dispatcher.*
|
||||
/dispatcher/org.freedesktop.nm_dispatcher.service
|
||||
/dispatcher/tests/test-dispatcher-envp
|
||||
|
||||
/clients/cli/nmcli
|
||||
/clients/cli/settings-docs.c
|
||||
/clients/common/settings-docs.h
|
||||
/clients/common/tests/test-clients-common
|
||||
/clients/common/tests/test-libnm-core-aux
|
||||
/clients/nm-online
|
||||
/clients/tui/newt/libnmt-newt.a
|
||||
/clients/tui/nmtui
|
||||
/clients/nm-online
|
||||
|
||||
/data/NetworkManager.service
|
||||
/data/NetworkManager-wait-online.service
|
||||
/data/NetworkManager-dispatcher.service
|
||||
/data/org.freedesktop.NetworkManager.service
|
||||
/data/server.conf
|
||||
/data/org.freedesktop.NetworkManager.policy
|
||||
/data/org.freedesktop.NetworkManager.policy.in
|
||||
|
||||
/docs/api/version.xml
|
||||
/docs/api/settings-spec.html
|
||||
/docs/api/settings-spec.xml
|
||||
/docs/api/spec.html
|
||||
/docs/api/*.stamp
|
||||
/docs/api/html/
|
||||
/docs/api/tmpl/
|
||||
|
|
@ -77,32 +97,7 @@ valgrind-*.log
|
|||
/docs/api/NetworkManager.signals
|
||||
/docs/api/NetworkManager.types
|
||||
|
||||
/docs/libnm-glib/*.stamp
|
||||
/docs/libnm-glib/html/
|
||||
/docs/libnm-glib/tmpl/
|
||||
/docs/libnm-glib/xml/
|
||||
/docs/libnm-glib/libnm-glib-*.txt
|
||||
/docs/libnm-glib/libnm-glib.args
|
||||
/docs/libnm-glib/libnm-glib.hierarchy
|
||||
/docs/libnm-glib/libnm-glib.interfaces
|
||||
/docs/libnm-glib/libnm-glib.prerequisites
|
||||
/docs/libnm-glib/libnm-glib.signals
|
||||
/docs/libnm-glib/version.xml
|
||||
|
||||
/docs/libnm-util/*.stamp
|
||||
/docs/libnm-util/html/
|
||||
/docs/libnm-util/tmpl/
|
||||
/docs/libnm-util/xml/
|
||||
/docs/libnm-util/libnm-util-*.txt
|
||||
/docs/libnm-util/libnm-util-decl-list.txt.bak
|
||||
/docs/libnm-util/libnm-util-decl.txt.bak
|
||||
/docs/libnm-util/libnm-util.args
|
||||
/docs/libnm-util/libnm-util.hierarchy
|
||||
/docs/libnm-util/libnm-util.interfaces
|
||||
/docs/libnm-util/libnm-util.prerequisites
|
||||
/docs/libnm-util/libnm-util.signals
|
||||
/docs/libnm-util/libnm-util.types
|
||||
/docs/libnm-util/version.xml
|
||||
/docs/api/dbus-org.freedesktop.NetworkManager*.xml
|
||||
|
||||
/docs/libnm/*.stamp
|
||||
/docs/libnm/html/
|
||||
|
|
@ -128,44 +123,31 @@ valgrind-*.log
|
|||
/examples/C/qt/add-connection-wired
|
||||
/examples/C/qt/list-connections
|
||||
/examples/C/qt/change-ipv4-addresses
|
||||
/examples/C/qt/monitor-nm-running
|
||||
/examples/C/qt/monitor-nm-running.moc
|
||||
|
||||
/initscript/Slackware/rc.networkmanager
|
||||
/initscript/*/[Nn]etwork[Mm]anager
|
||||
/shared/nm-utils/tests/test-shared-general
|
||||
/shared/nm-version-macros.h
|
||||
|
||||
/introspection/all.xml
|
||||
/introspection/nmdbus-*.c
|
||||
/introspection/nmdbus-*.h
|
||||
/introspection/org.freedesktop.NetworkManager*.[ch]
|
||||
|
||||
/libgsystem/
|
||||
|
||||
/libnm-core/nm-version.h
|
||||
/libnm-core/tests/test-compare
|
||||
/libnm-core/tests/test-crypto
|
||||
/libnm-core/tests/test-settings-defaults
|
||||
/libnm-core/tests/test-general
|
||||
/libnm-core/tests/test-keyfile
|
||||
/libnm-core/tests/test-need-secrets
|
||||
/libnm-core/tests/test-secrets
|
||||
/libnm-core/tests/test-setting-8021x
|
||||
/libnm-core/tests/test-setting-dcb
|
||||
|
||||
/libnm-glib/libnm-glib-test
|
||||
/libnm-glib/tests/test-nm-client
|
||||
/libnm-glib/tests/test-remote-settings-client
|
||||
|
||||
/libnm-util/nm-ifcfg-rh-docs.xml
|
||||
/libnm-util/nm-keyfile-docs.xml
|
||||
/libnm-util/nm-setting-docs.xml
|
||||
/libnm-util/nm-version.h
|
||||
/libnm-util/test-crypto
|
||||
/libnm-util/tests/test-crypto
|
||||
/libnm-util/tests/test-settings-defaults
|
||||
/libnm-util/tests/test-general
|
||||
/libnm-util/tests/test-libnm-linking
|
||||
/libnm-util/tests/test-need-secrets
|
||||
/libnm-util/tests/test-secrets
|
||||
/libnm-util/tests/test-setting-8021x
|
||||
/libnm-util/tests/test-setting-dcb
|
||||
/libnm-core/tests/test-setting
|
||||
/libnm-core/nm-dbus-types.xml
|
||||
/libnm-core/nm-vpn-dbus-types.xml
|
||||
|
||||
/libnm/nm-settings-ifcfg-rh-docs.xml
|
||||
/libnm/nm-property-docs.xml
|
||||
/libnm/nm-settings-docs.xml
|
||||
/libnm/nm-settings-docs-overrides.xml
|
||||
/libnm/nm-settings-keyfile-docs.xml
|
||||
/libnm/tests/test-libnm
|
||||
/libnm/tests/test-nm-client
|
||||
/libnm/tests/test-remote-settings-client
|
||||
/libnm/tests/test-secret-agent
|
||||
|
|
@ -204,11 +186,11 @@ valgrind-*.log
|
|||
/m4/wint_t.m4
|
||||
/m4/xsize.m4
|
||||
|
||||
/man/*.[185]
|
||||
/man/NetworkManager.conf.xml
|
||||
/man/*.[1785]
|
||||
/man/nm-settings.xml
|
||||
/man/nm-settings-ifcfg-rh.xml
|
||||
/man/nm-settings-keyfile.xml
|
||||
/man/common.ent
|
||||
|
||||
/po/*.gmo
|
||||
/po/.intltool-merge-cache
|
||||
|
|
@ -222,31 +204,142 @@ valgrind-*.log
|
|||
/po/quot.sed
|
||||
/po/remove-potcdate.sin
|
||||
|
||||
/src/NetworkManager
|
||||
/src/NetworkManager.ver
|
||||
/src/devices/bluetooth/tests/nm-bt-test
|
||||
/src/devices/tests/test-acd
|
||||
/src/devices/tests/test-lldp
|
||||
/src/devices/wifi/tests/test-devices-wifi
|
||||
/src/devices/wwan/tests/test-service-providers
|
||||
/src/dhcp/nm-dhcp-helper
|
||||
/src/dhcp/tests/test-dhcp-dhclient
|
||||
/src/dhcp/tests/test-dhcp-options
|
||||
/src/dhcp/tests/test-dhcp-utils
|
||||
/src/dnsmasq/tests/test-dnsmasq-utils
|
||||
/src/initrd/nm-initrd-generator
|
||||
/src/initrd/tests/test-cmdline-reader
|
||||
/src/initrd/tests/test-dt-reader
|
||||
/src/initrd/tests/test-ibft-reader
|
||||
/src/nm-iface-helper
|
||||
/src/ndisc/tests/test-ndisc-fake
|
||||
/src/ndisc/tests/test-ndisc-linux
|
||||
/src/platform/tests/monitor
|
||||
/src/platform/tests/test-address-fake
|
||||
/src/platform/tests/test-address-linux
|
||||
/src/platform/tests/test-cleanup-fake
|
||||
/src/platform/tests/test-cleanup-linux
|
||||
/src/platform/tests/test-link-fake
|
||||
/src/platform/tests/test-link-linux
|
||||
/src/platform/tests/test-nmp-object
|
||||
/src/platform/tests/test-platform-general
|
||||
/src/platform/tests/test-route-fake
|
||||
/src/platform/tests/test-route-linux
|
||||
/src/settings/plugins/ifcfg-rh/nmdbus-ifcfg-rh.[ch]
|
||||
/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
|
||||
/src/settings/plugins/ifupdown/tests/test-ifupdown
|
||||
/src/settings/plugins/keyfile/tests/test-keyfile-settings
|
||||
/src/settings/plugins/ifcfg-rh/tests/network-scripts/tmp/
|
||||
/src/supplicant/tests/test-supplicant-config
|
||||
/src/tests/config/test-config
|
||||
/src/tests/test-dcb
|
||||
/src/tests/test-core
|
||||
/src/tests/test-core-with-expect
|
||||
/src/tests/test-ip4-config
|
||||
/src/tests/test-ip6-config
|
||||
/src/tests/test-route-manager-fake
|
||||
/src/tests/test-route-manager-linux
|
||||
/src/tests/test-systemd
|
||||
/src/tests/test-utils
|
||||
/src/tests/test-wired-defname
|
||||
|
||||
/vapi/*.vapi
|
||||
|
||||
# The following names are no longer present on this branch,
|
||||
# but they were on older versions. Thus keep ignoring them
|
||||
# otherwise when switching branches these untracked files show
|
||||
# up.
|
||||
/callouts/nm-avahi-autoipd.action
|
||||
/callouts/nm-dispatcher
|
||||
/callouts/nmdbus-dispatcher.*
|
||||
/callouts/org.freedesktop.nm_dispatcher.service
|
||||
/callouts/tests/test-dispatcher-envp
|
||||
/clients/cli/settings-docs.c
|
||||
/clients/common/settings-docs.c
|
||||
/clients/common/tests/test-general
|
||||
/docs/libnm-glib/*.stamp
|
||||
/docs/libnm-glib/html/
|
||||
/docs/libnm-glib/libnm-glib-*.txt
|
||||
/docs/libnm-glib/libnm-glib.args
|
||||
/docs/libnm-glib/libnm-glib.hierarchy
|
||||
/docs/libnm-glib/libnm-glib.interfaces
|
||||
/docs/libnm-glib/libnm-glib.prerequisites
|
||||
/docs/libnm-glib/libnm-glib.signals
|
||||
/docs/libnm-glib/tmpl/
|
||||
/docs/libnm-glib/version.xml
|
||||
/docs/libnm-glib/xml/
|
||||
/docs/libnm-util/*.stamp
|
||||
/docs/libnm-util/html/
|
||||
/docs/libnm-util/libnm-util-*.txt
|
||||
/docs/libnm-util/libnm-util-decl-list.txt.bak
|
||||
/docs/libnm-util/libnm-util-decl.txt.bak
|
||||
/docs/libnm-util/libnm-util.args
|
||||
/docs/libnm-util/libnm-util.hierarchy
|
||||
/docs/libnm-util/libnm-util.interfaces
|
||||
/docs/libnm-util/libnm-util.prerequisites
|
||||
/docs/libnm-util/libnm-util.signals
|
||||
/docs/libnm-util/libnm-util.types
|
||||
/docs/libnm-util/tmpl/
|
||||
/docs/libnm-util/version.xml
|
||||
/docs/libnm-util/xml/
|
||||
/include/
|
||||
/initscript/*/[Nn]etwork[Mm]anager
|
||||
/initscript/Slackware/rc.networkmanager
|
||||
/introspection/nmdbus-*.c
|
||||
/introspection/nmdbus-*.h
|
||||
/introspection/nmdbus-*.xml
|
||||
/libgsystem/
|
||||
/libnm-core/tests/test-setting-8021x
|
||||
/libnm-core/tests/test-setting-bond
|
||||
/libnm-core/tests/test-setting-dcb
|
||||
/libnm-glib/libnm-glib-test
|
||||
/libnm-glib/nm-secret-agent-glue.h
|
||||
/libnm-glib/nm-vpn-plugin-glue.h
|
||||
/libnm-glib/tests/test-nm-client
|
||||
/libnm-glib/tests/test-remote-settings-client
|
||||
/libnm-util/test-crypto
|
||||
/libnm-util/tests/test-crypto
|
||||
/libnm-util/tests/test-general
|
||||
/libnm-util/tests/test-libnm-linking
|
||||
/libnm-util/tests/test-need-secrets
|
||||
/libnm-util/tests/test-secrets
|
||||
/libnm-util/tests/test-setting-8021x
|
||||
/libnm-util/tests/test-setting-dcb
|
||||
/libnm-util/tests/test-settings-defaults
|
||||
/libnm/fake-typelib/typelibs.c
|
||||
/libnm/nm-ifcfg-rh-docs.xml
|
||||
/libnm/nm-keyfile-docs.xml
|
||||
/libnm/nm-setting-docs-overrides.xml
|
||||
/libnm/nm-setting-docs.xml
|
||||
/libnm/tests/test-general
|
||||
/policy/org.freedesktop.NetworkManager.policy
|
||||
/policy/org.freedesktop.NetworkManager.policy.in
|
||||
|
||||
/src/NetworkManager
|
||||
/src/devices/tests/test-arping
|
||||
/src/devices/wifi/tests/test-general
|
||||
/src/devices/wifi/tests/test-wifi-ap-utils
|
||||
/src/dhcp-manager/nm-dhcp-helper
|
||||
/src/dhcp-manager/tests/test-dhcp-dhclient
|
||||
/src/dhcp-manager/tests/test-dhcp-options
|
||||
/src/dhcp-manager/tests/test-dhcp-utils
|
||||
/src/dnsmasq-manager/tests/test-dnsmasq-utils
|
||||
/src/platform/tests/dump
|
||||
/src/platform/tests/platform
|
||||
/src/platform/tests/test-general
|
||||
/src/rdisc/
|
||||
/src/settings/plugins/ibft/tests/test-ibft
|
||||
/src/settings/plugins/ifcfg-rh/tests/network-scripts/*-Test_Write_*
|
||||
/src/settings/plugins/ifcfg-rh/tests/network-scripts/Test_Write_*
|
||||
/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
|
||||
/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils
|
||||
/src/settings/plugins/ifnet/tests/check_ifnet
|
||||
/src/settings/plugins/ifupdown/tests/test-ifupdown
|
||||
/src/settings/plugins/ifnet
|
||||
/src/settings/plugins/keyfile/tests/test-keyfile
|
||||
/src/supplicant-manager/tests/test-supplicant-config
|
||||
/src/tests/config/test-config
|
||||
/src/tests/test-dcb
|
||||
/src/tests/test-general
|
||||
/src/tests/test-general-with-expect
|
||||
/src/tests/test-ip4-config
|
||||
/src/tests/test-ip6-config
|
||||
/src/tests/test-resolvconf-capture
|
||||
/src/tests/test-wired-defname
|
||||
|
||||
/vapi/*.vapi
|
||||
|
|
|
|||
184
.gitlab-ci.yml
Normal file
184
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
# Quick syntax check:
|
||||
# python -c 'import sys, yaml; yaml.dump (yaml.load (sys.stdin), sys.stdout)' <.gitlab-ci.yml
|
||||
|
||||
# If things don't seem to work, this can help:
|
||||
# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/ci/lint
|
||||
|
||||
stages:
|
||||
- test
|
||||
- deploy
|
||||
|
||||
.fedora_install: &fedora_install
|
||||
before_script:
|
||||
|
||||
# enable EPEL on CentOS
|
||||
- date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||
|
||||
- date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || (yum install -y glibc-common && localedef -c -i pl_PL -f UTF-8 pl_PL.UTF-8 && locale -a)
|
||||
|
||||
- date '+%Y%m%d-%H%M%S'; NM_NO_EXTRA=1 NM_INSTALL="yum install -y" ./contrib/fedora/REQUIRED_PACKAGES
|
||||
- date '+%Y%m%d-%H%M%S'; yum install -y glibc-langpack-pl ccache clang which
|
||||
|
||||
# containers have "tsflags=nodocs" in /etc/dnf/dnf.conf. We need /usr/shared/gtk-doc/html
|
||||
# to generate proper documentation.
|
||||
- date '+%Y%m%d-%H%M%S'; yum reinstall -y --setopt='tsflags=' glib2-doc
|
||||
|
||||
- date '+%Y%m%d-%H%M%S'; ! grep -q '^NAME=.*\(CentOS\)' /etc/os-release || yum install -y python36-dbus python36-gobject-base
|
||||
|
||||
- date '+%Y%m%d-%H%M%S'; ! which dnf || dnf install -y python3-dnf-plugins-core
|
||||
- date '+%Y%m%d-%H%M%S'; ! which dnf || dnf debuginfo-install -y glib2
|
||||
- date '+%Y%m%d-%H%M%S'; which dnf || debuginfo-install -y glib2
|
||||
|
||||
- date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-ci-patch-gtkdoc.sh || true
|
||||
|
||||
- date '+%Y%m%d-%H%M%S'; test -x /usr/bin/ninja || ! test -x /usr/bin/ninja-build || ln -s /usr/bin/ninja-build /usr/bin/ninja
|
||||
|
||||
.debian_install: &debian_install
|
||||
before_script:
|
||||
- date '+%Y%m%d-%H%M%S'; apt-get update
|
||||
- date '+%Y%m%d-%H%M%S'; NM_INSTALL="apt-get -qq install -y" ./contrib/debian/REQUIRED_PACKAGES
|
||||
- date '+%Y%m%d-%H%M%S'; dbus-uuidgen --ensure
|
||||
- date '+%Y%m%d-%H%M%S'; sed -i 's/^# \(pl_PL.UTF-8 .*\)$/\1/p' /etc/locale.gen ; true
|
||||
- date '+%Y%m%d-%H%M%S'; locale-gen pl_PL.UTF-8
|
||||
- date '+%Y%m%d-%H%M%S'; pip3 install meson
|
||||
- date '+%Y%m%d-%H%M%S'; contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh
|
||||
|
||||
# iproute2 5.2.0 on debian:sid causes our unit tests to fail.
|
||||
# Downgrade to a working version. See https://www.spinics.net/lists/netdev/msg584916.html
|
||||
- date '+%Y%m%d-%H%M%S'; ! ( dpkg -s iproute2 | grep -q '^Version[:] 5.2.0-1\(ubuntu1\)\?$' ) || (curl 'http://ftp.debian.org/debian/pool/main/i/iproute2/iproute2_4.20.0-2_amd64.deb' --output /tmp/iproute2_4.20.0-2_amd64.deb && dpkg -i /tmp/iproute2_4.20.0-2_amd64.deb)
|
||||
|
||||
.do_build: &do_build
|
||||
stage: test
|
||||
script:
|
||||
- date '+%Y%m%d-%H%M%S'; uname -a
|
||||
- date '+%Y%m%d-%H%M%S'; locale -a
|
||||
- date '+%Y%m%d-%H%M%S'; env
|
||||
- date '+%Y%m%d-%H%M%S'; meson --version
|
||||
- date '+%Y%m%d-%H%M%S'; ! which dpkg || dpkg -l
|
||||
- date '+%Y%m%d-%H%M%S'; ! which yum || yum list installed
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=autotools CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh
|
||||
- date '+%Y%m%d-%H%M%S'; rm -rf /tmp/nm-docs-html; mv build/INST/share/gtk-doc/html /tmp/nm-docs-html
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=meson CC=gcc WITH_DOCS=1 WITH_VALGRIND=1 contrib/scripts/nm-ci-run.sh
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=autotools CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx ; BUILD_TYPE=meson CC=clang WITH_DOCS=0 contrib/scripts/nm-ci-run.sh
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=.*\(Fedora\|CentOS\)' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -W meson
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx ; ! grep -q '^NAME=.*\(Fedora\)' /etc/os-release || ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -w meson
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx ; test "$NM_BUILD_TARBALL" != 1 || ( ./contrib/fedora/rpm/build_clean.sh -r && mv ./NetworkManager-1*.tar.xz /tmp/ && mv ./contrib/fedora/rpm/latest/SRPMS/NetworkManager-1*.src.rpm /tmp/ )
|
||||
- date '+%Y%m%d-%H%M%S'; git clean -fdx
|
||||
- date '+%Y%m%d-%H%M%S'; mv /tmp/nm-docs-html ./docs-html
|
||||
- date '+%Y%m%d-%H%M%S'; test "$NM_BUILD_TARBALL" != 1 || mv /tmp/NetworkManager-1*.tar.xz /tmp/NetworkManager-1*.src.rpm ./
|
||||
|
||||
checkpatch:
|
||||
image: fedora:29
|
||||
stage: test
|
||||
script:
|
||||
- date '+%Y%m%d-%H%M%S'; dnf install -y git
|
||||
- date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt
|
||||
allow_failure: true
|
||||
artifacts:
|
||||
when: on_failure
|
||||
paths:
|
||||
- checkpatch-out.txt
|
||||
|
||||
t_fedora:28:
|
||||
<<: *fedora_install
|
||||
image: fedora:28
|
||||
<<: *do_build
|
||||
when: manual
|
||||
|
||||
t_fedora:29:
|
||||
<<: *fedora_install
|
||||
image: fedora:29
|
||||
<<: *do_build
|
||||
variables:
|
||||
NM_BUILD_TARBALL: 1
|
||||
artifacts:
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- docs-html
|
||||
- NetworkManager-1*.tar.xz
|
||||
- NetworkManager-1*.src.rpm
|
||||
|
||||
t_fedora:30:
|
||||
<<: *fedora_install
|
||||
image: fedora:30
|
||||
<<: *do_build
|
||||
|
||||
t_fedora:31:
|
||||
<<: *fedora_install
|
||||
image: fedora:31
|
||||
<<: *do_build
|
||||
|
||||
t_fedora:rawhide:
|
||||
<<: *fedora_install
|
||||
image: fedora:rawhide
|
||||
<<: *do_build
|
||||
allow_failure: true
|
||||
when: manual
|
||||
|
||||
t_centos:7.5.1804:
|
||||
<<: *fedora_install
|
||||
image: centos:7.5.1804
|
||||
<<: *do_build
|
||||
when: manual
|
||||
|
||||
t_centos:7.6.1810:
|
||||
<<: *fedora_install
|
||||
image: centos:7.6.1810
|
||||
<<: *do_build
|
||||
|
||||
t_ubuntu:16.04:
|
||||
<<: *debian_install
|
||||
image: ubuntu:16.04
|
||||
<<: *do_build
|
||||
|
||||
t_ubuntu:18.04:
|
||||
<<: *debian_install
|
||||
image: ubuntu:18.04
|
||||
<<: *do_build
|
||||
|
||||
t_ubuntu:rolling:
|
||||
<<: *debian_install
|
||||
image: ubuntu:rolling
|
||||
<<: *do_build
|
||||
when: manual
|
||||
|
||||
t_ubuntu:devel:
|
||||
<<: *debian_install
|
||||
image: ubuntu:devel
|
||||
<<: *do_build
|
||||
when: manual
|
||||
|
||||
t_debian:9:
|
||||
<<: *debian_install
|
||||
image: debian:stretch
|
||||
<<: *do_build
|
||||
|
||||
t_debian:10:
|
||||
<<: *debian_install
|
||||
image: debian:stretch
|
||||
<<: *do_build
|
||||
|
||||
t_debian:testing:
|
||||
<<: *debian_install
|
||||
image: debian:testing
|
||||
<<: *do_build
|
||||
when: manual
|
||||
|
||||
t_debian:sid:
|
||||
<<: *debian_install
|
||||
image: debian:sid
|
||||
<<: *do_build
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
dependencies:
|
||||
- t_fedora:29
|
||||
script:
|
||||
- mv docs-html public
|
||||
artifacts:
|
||||
expire_in: 20 days
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
75
.mailmap
Normal file
75
.mailmap
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
A S Alam <aalam@users.sf.net> <amanpreet.alam@gmail.com>
|
||||
Aleksander Morgado <aleksander@aleksander.es> <aleksander@lanedo.com>
|
||||
Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
|
||||
Amitakhya Phukan <aphukan@redhat.com> <aphukan@fedoraproject.org>
|
||||
Antony Mee <eemynotna@gmail.com> <A.J.Mee@ncl.ac.uk>
|
||||
Artur Flinta <aflinta@svn.gnome.org> <aflinta@cvs.gnome.org>
|
||||
Beniamino Galvani <bgalvani@redhat.com> <b.galvani@gmail.com>
|
||||
Bryan Clark <clarkbw@cvs.gnome.org> <bclark@redhat.com>
|
||||
Bryan Clark <clarkbw@cvs.gnome.org> <clarkbw@gnome.org>
|
||||
Christian Kirbach <christian.kirbach@gmail.com> <Christian.Kirbach@googlemail.com>
|
||||
Christian Persch <chpe@gnome.org> <chpe@cvs.gnome.org>
|
||||
Colin Walters <walters@verbum.org> <walters@redhat.com>
|
||||
Dan Williams <dcbw@redhat.com> <dcbw@redaht.com>
|
||||
Dan Winship <danw@redhat.com> <danw@gnome.org>
|
||||
Daniel Nylander <po@danielnylander.se> <Daniel Nylander po@danielnylander.se>
|
||||
David Zeuthen <davidz@redhat.com> <david@fubar.dk>
|
||||
Fran Diéguez <frandieguez@gnome.org>
|
||||
Fran Diéguez <frandieguez@gnome.org> <fran.dieguez@mabishu.com>
|
||||
Francisco Javier F. Serrador <serrador@cvs.gnome.org> <serrador@openshine.com>
|
||||
Frédéric Danis <frederic.danis.oss@gmail.com> <frederic.danis.external@sigfox.com>
|
||||
Gabor Kelemen <kelemeng@gnome.hu> <kelemeng@gnome.org>
|
||||
Gene Czarcinski <gene@czarc.net> <czar@acm.org>
|
||||
Giovanni Campagna <gcampagna@src.gnome.org> <scampa.giovanni@gmail.com>
|
||||
gunchleoc <fios@foramnagaidhlog.net> <fios@foramnagaidhlig.net>
|
||||
Hendrik Brandt <heb@gnome-de.org> <hebra@cvs.gnome.org>
|
||||
Henrique P. Machado <hpmachado@gnome.org> <zehrique@gmail.com>
|
||||
Iñaki Larrañaga Murgoitio <dooteo@euskalgnu.org>
|
||||
Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
|
||||
Jiří Klimeš <blueowl@centrum.cz> <jklimes@redhat.com>
|
||||
Jonh Wendell <jonh.wendell@oiwifi.com.br> <jwendell@gnome.org>
|
||||
Jorge González <jorgegonz@svn.gnome.org>
|
||||
Jörg Billeter <j@bitron.ch>
|
||||
Kjartan Maraas <kmaraas@gnome.org>
|
||||
Leonardo Ferreira Fontenelle <leonardof@gnome.org> <leonardof@svn.gnome.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk> <lkundrak@rhel7-4.local>
|
||||
Mario Blättermann <mario.blaettermann@gmail.com> <mariobl@svn.gnome.org>
|
||||
Martin Pitt <martinpitt@gnome.org> <martin.pitt@ubuntu.com>
|
||||
Matej Urbančič <matej.urban@gmail.com> <mateju@svn.gnome.org>
|
||||
Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com> <mathieu-tl@ubuntu.com>
|
||||
Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com> <mathieu.tl@gmail.com>
|
||||
Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com> <mathieu@canonical.com>
|
||||
Maxim Dziumanenko <dziumanenko@gmail.com> <mvd@mylinux.com.ua>
|
||||
Maxim Dziumanenko <dziumanenko@gmail.com> <mvd@mylinux.ua>
|
||||
Michael Biebl <biebl@debian.org> <mbiebl@debian.org>
|
||||
Michael Biebl <biebl@debian.org> <mbiebl@gmail.com>
|
||||
Michael Schaller <misch@google.com> <misch@rodete-desktop-imager.corp.google.com>
|
||||
Mikhail Efremov <sem@altlinux.org> <sem altlinux org>
|
||||
Mu Qiao <qiaomuf@gentoo.org> <qiaomuf@gmail.com>
|
||||
Nicolas Trangez <eikke@eikke.com> <ikke@nicolast.be>
|
||||
Pavel Šimerda <pavlix@pavlix.net> <psimerda@redhat.com>
|
||||
Pawan Chitrakar <chautari@gmail.com> <pawan@nplinux.org>
|
||||
Peter Korsgaard <peter@korsgaard.com> <jacmet@sunsite.dk>
|
||||
Philip Withnall <withnall@endlessm.com> <philip@tecnocode.co.uk>
|
||||
Philip Withnall <withnall@endlessm.com> <pwithnall@svn.gnome.org>
|
||||
Priit Laes <plaes@plaes.org> <plaes at svn dot gnome dot org>
|
||||
Priit Laes <plaes@plaes.org> <plaes@svn.gnome.org>
|
||||
Priit Laes <plaes@plaes.org> <plaes@cvs.gnome.org>
|
||||
Richard Hughes <hughsient@gmail.com> <richard@hughsie.com>
|
||||
Robby Workman <rworkman@slackware.com> <rw@rlworkman.net>
|
||||
Robert Love <rml@novell.com> <rlove@rlove.org>
|
||||
Robert Love <rml@novell.com> <rml@novell.com>
|
||||
Rodrigo Moya <rodrigo@gnome-db.org> <rodrigo@novell.com>
|
||||
Sam Friedmann <sfriedma@redhat.com> <sam.friedmann@redhat.com>
|
||||
Sandeep Shedmake <sshedmak@redhat.com> <sandeep.shedmake@gmail.com>
|
||||
Scott Shambarger <devel@shambarger.net> <scott-gnome@shambarger.net>
|
||||
Simos Xenitellis <simos.bugzilla@gmail.com> <simos@gnome.org>
|
||||
Sjoerd Simons <sjoerd.simons@collabora.co.uk> <sjoerd@debian.org>
|
||||
Sjoerd Simons <sjoerd.simons@collabora.co.uk> <sjoerd@luon.net>
|
||||
Tambet Ingo <tambet@gmail.com> <tambet@ximian.com>
|
||||
Tomasz Dominikowski <dominikowski@gmail.com> <tdominikowski@aviary.pl>
|
||||
William Jon McCann <william.jon.mccann@gmail.com> <mccann@jhu.edu>
|
||||
Wouter Bolsterlee <wbolster@svn.gnome.org> <wbolster@gnome.org>
|
||||
Wouter Bolsterlee <wbolster@svn.gnome.org> <uws+gnome@xs4all.nl>
|
||||
Øivind Hoel <ohoel@cvs.gnome.org>
|
||||
Žygimantas Beručka <uid0@akl.lt> <zygis@gnome.org>
|
||||
88
.travis.yml
Normal file
88
.travis.yml
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
language: c
|
||||
dist: trusty
|
||||
sudo: required
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- autoconf
|
||||
- libtool
|
||||
- pkg-config
|
||||
- intltool
|
||||
- libdbus-1-dev
|
||||
- libiw-dev
|
||||
- libglib2.0-dev
|
||||
- libmm-glib-dev
|
||||
- ppp
|
||||
- ppp-dev
|
||||
- libpolkit-gobject-1-dev
|
||||
- libgnutls-dev
|
||||
- libgcrypt11-dev
|
||||
- uuid-dev
|
||||
- libudev-dev
|
||||
- libgirepository1.0-dev
|
||||
- gobject-introspection
|
||||
- gtk-doc-tools
|
||||
- libglib2.0-doc
|
||||
- libreadline-dev
|
||||
- libnewt-dev
|
||||
- libnss3-dev
|
||||
- iptables
|
||||
- make
|
||||
- python-software-properties
|
||||
- python-gi
|
||||
- python-dbus
|
||||
- dbus
|
||||
- dbus-x11
|
||||
- libjansson4
|
||||
- libjansson-dev
|
||||
- libndp-dev
|
||||
- automake
|
||||
- dnsmasq
|
||||
- libcurl4-gnutls-dev
|
||||
- python3-pip
|
||||
- mobile-broadband-provider-info
|
||||
coverity_scan:
|
||||
project:
|
||||
name: NetworkManager/NetworkManager
|
||||
build_command_prepend: sh autogen.sh --with-systemd-logind=no --enable-more-warnings=no --disable-ovs
|
||||
build_command: make -j4
|
||||
branch_pattern: .*coverity.*
|
||||
|
||||
before_install:
|
||||
- sudo dbus-uuidgen --ensure
|
||||
- |
|
||||
if test "$BUILD_TYPE" == 'meson'; then
|
||||
git clone https://github.com/ninja-build/ninja &&
|
||||
pushd ninja &&
|
||||
./configure.py --bootstrap &&
|
||||
sudo cp ninja /usr/bin/ &&
|
||||
popd
|
||||
|
||||
# Recent meson requires python 3.5, which isn't in Ubuntu 14.04.
|
||||
# Hence we cannot install it via `pip3 install meson`. Install the latest
|
||||
# working release.
|
||||
#
|
||||
# Wouldn't it be nice to have a build system that supports everything
|
||||
# that NetworkManager would like to support?
|
||||
wget https://github.com/mesonbuild/meson/releases/download/0.44.1/meson-0.44.1.tar.gz -O /tmp/meson.tar.gz
|
||||
tar -C /tmp -xvzf /tmp/meson.tar.gz
|
||||
pushd /tmp/meson-0.44.1
|
||||
sudo python3 setup.py install
|
||||
popd
|
||||
fi
|
||||
- sudo chmod o+x /usr/sbin/pppd
|
||||
- sudo locale-gen pl_PL.UTF-8
|
||||
|
||||
script:
|
||||
- CI=travis contrib/scripts/nm-ci-run.sh
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- BUILD_TYPE=autotools
|
||||
- BUILD_TYPE=meson
|
||||
global:
|
||||
secure: K36MXkcsuDZ0msuEj5zHMmHfv6O725lsXuFdP6AJ3rYWKuLYE1+iNLgIRndNWDK9ckkNQFaCxDY4Z/NCfCYQTGAS9oXR5AwNqNbhOq8XrqdaZ2GX35sob8Tp4B3IsoREkN/UbIkXQKYlA5rUhgtSifUg3EwfeOiFvnLCwHcp0rYHnvT/jaq5vodBbA1jChjezcMHsp43kvPXHpybKRkipb9EzV/V3VtDLLWh9WQBvQNawpsHnT+MXSke1yU1zfNMyD9XiD7VDzCwaTs6LzjoFBLc86QS5U/9W72s0rFe6SbecntQHftknRzSrGiJDNe64wDZN/Wxq1MHxEOFCwDi6vcSwQ+RoTdhyshhfPVY2Mm5soj2w7Dx43Cz0dDZDCMhu5xxzFAFgkieJSfwXbuxga0ds58Ph8MgtDSp3fBRewZwI+vMuzl7a1hGkcqJojrm1lfgAKbNgrNUzQRwbVYAyrpa6/vCbd6ZH4PEtITwLaRf2mz8PG71xiMQguDDDXS8WF0U7Looe+G9ybAUwDS5hqHfeP+3q6bfN5Sg5Zs5QkBIN5LZbeWbPYldOEEDTvo3VI7e84bk7U5qEoUKc0w/tqVF1B5KgNUq6nIkCkmoBx8RFnmjpOHh99IfeRG9nQTRpCaEDvAM4fcRzITzId8dIIfAW/45P3ozzfz/HYiie+o=
|
||||
7
AUTHORS
7
AUTHORS
|
|
@ -1,6 +1 @@
|
|||
Current authors:
|
||||
Dan Williams <dcbw@redhat.com>
|
||||
Tambet Ingo <tambet@gmail.com>
|
||||
|
||||
Previous authors:
|
||||
Robert Love <rml@novell.com>
|
||||
The NetworkManager Team <networkmanager-list@gnome.org>
|
||||
|
|
|
|||
113
CONTRIBUTING
113
CONTRIBUTING
|
|
@ -1,19 +1,17 @@
|
|||
Guidelines for Contributing:
|
||||
Guidelines for Contributing
|
||||
===========================
|
||||
|
||||
1) Platform-specific functionality (for example, location of binaries that
|
||||
NetworkManager calls, or functionality used only on some platforms or
|
||||
distribution, like resolvconf) should be configurable at build time, with the
|
||||
normal autoconf mechanisms for putting a #define in config.h (AC_DEFINE), then
|
||||
with #ifdef MY_DEFINE / #endif in the code.
|
||||
Coding Standard
|
||||
---------------
|
||||
|
||||
2) Coding standards are generally GNOME coding standards, with these exceptions:
|
||||
a) 4 space tabs (_not_ 8-space tabs)
|
||||
b) REAL tabs (_not_ a mix of tabs and spaces in the initial indent)
|
||||
c) spaces used to align continuation lines past the indent point of the
|
||||
first statement line, like so:
|
||||
Coding standards are generally GNOME coding standards, with these exceptions:
|
||||
a) 4 space tabs (_not_ 8-space tabs)
|
||||
b) REAL tabs (_not_ a mix of tabs and spaces in the initial indent)
|
||||
c) spaces used to align continuation lines past the indent point of the
|
||||
first statement line, like so:
|
||||
|
||||
if (some_really_really_long_variable_name &&
|
||||
another_really_really_long_variable_name) {
|
||||
if ( some_really_really_long_variable_name
|
||||
&& another_really_really_long_variable_name) {
|
||||
...
|
||||
}
|
||||
|
||||
|
|
@ -21,13 +19,10 @@ with #ifdef MY_DEFINE / #endif in the code.
|
|||
GOOD: g_strdup (x)
|
||||
BAD: g_strdup(x)
|
||||
|
||||
* C-style comments, except for FIXMEs.
|
||||
* C-style comments
|
||||
GOOD: f(x); /* comment */
|
||||
BAD: f(x); // comment
|
||||
|
||||
GOOD: // FIXME: juice the gooblygok
|
||||
BAD: /* FIXME: juice the gooblygok */
|
||||
|
||||
* Keep assignments in the variable declaration area pretty short.
|
||||
GOOD: MyObject *object;
|
||||
BAD: MyObject *object = complex_and_long_init_function(arg1, arg2, arg3);
|
||||
|
|
@ -39,3 +34,87 @@ with #ifdef MY_DEFINE / #endif in the code.
|
|||
GOOD: #define MY_CONSTANT 42
|
||||
BAD: static const unsigned myConstant = 42;
|
||||
|
||||
Legal
|
||||
-----
|
||||
|
||||
NetworkManager is partly licensed under terms of GNU Lesser General Public License
|
||||
version 2 or later (LGPL-2.1+). That is for example the case for libnm.
|
||||
For historical reasons, the daemon itself is licensed under terms of GNU General
|
||||
Public License, version 2 or later (GPL-2.0+). See the license comment in the source
|
||||
files.
|
||||
Note that all new contributions to NetworkManager MUST be made under terms of
|
||||
LGPL-2.1+, that is also the case for parts that are currently licensed GPL-2.0+.
|
||||
The reason for that is that we might eventually relicense everything as LGPL and
|
||||
new contributions already must agree with that future change.
|
||||
|
||||
Assertions in NetworkManager code
|
||||
---------------------------------
|
||||
|
||||
There are different kind of assertions. Use the one that is appropriate.
|
||||
|
||||
1) g_return_*() from glib. This is usually enabled in release builds and
|
||||
can be disabled with G_DISABLE_CHECKS define. This uses g_log() with
|
||||
G_LOG_LEVEL_CRITICAL level (which allows the program to continue,
|
||||
unless G_DEBUG=fatal-criticals or G_DEBUG=fatal-warnings is set). As such,
|
||||
this is usually the preferred way for assertions that are supposed to be
|
||||
enabled by default.
|
||||
|
||||
Optimally, after a g_return_*() failure the program can still continue. This is
|
||||
also the reason why g_return_*() is preferable over g_assert().
|
||||
For example, that is often not given for functions that return a GError, because
|
||||
g_return_*() will return failure without setting the error output. That often leads
|
||||
to a crash immidiately after, because the caller requires the GError to be set.
|
||||
Make a reasonable effort so that an assertion failure may allow the process
|
||||
to proceed. But don't put too much effort in it. After all, it's an assertion
|
||||
failure that is not supposed to happen either way.
|
||||
|
||||
2) nm_assert() from NetworkManager. This is disabled by default in release
|
||||
builds, but enabled if you build --with-more-assertions. See "WITH_MORE_ASSERTS"
|
||||
define. This is preferred for assertions that are expensive to check or
|
||||
nor necessary to check frequently. It's also for conditions that can easily
|
||||
verified to be true and where future refactoring is unlikley to break that
|
||||
condition.
|
||||
Use this deliberately and assume it is removed from production builds.
|
||||
|
||||
3) g_assert() from glib. This is used in unit tests and commonly enabled
|
||||
in release builds. It can be disabled with G_DISABLE_ASSERT assert
|
||||
define. Since this results in a hard crash on assertion failure, you
|
||||
should almost always prefer g_return_*() over this (except in unit tests).
|
||||
|
||||
4) assert() from <assert.h>. It is usually enabled in release builds and
|
||||
can be disabled with NDEBUG define. Don't use it in NetworkManager,
|
||||
it's basically like g_assert().
|
||||
|
||||
5) g_log() from glib. These are always compiled in, depending on the logging level
|
||||
these are assertions too. G_LOG_LEVEL_ERROR aborts the program, G_LOG_LEVEL_CRITICAL
|
||||
logs a critical warning (like g_return_*(), see G_DEBUG=fatal-criticals)
|
||||
and G_LOG_LEVEL_WARNING logs a warning (see G_DEBUG=fatal-warnings).
|
||||
G_LOG_LEVEL_DEBUG level is usually not printed, unless G_MESSAGES_DEBUG environment
|
||||
is set.
|
||||
In general, avoid using g_log() in NetworkManager. We have nm-logging instead
|
||||
which logs to syslog/systemd-journald.
|
||||
From a library like libnm it might make sense to log warnings (if someting
|
||||
is really wrong) or debug messages. But better don't. If it's important,
|
||||
find a way to report the notification via the API to the caller. If it's
|
||||
not important, keep silent.
|
||||
In particular, don't use levels G_LOG_LEVEL_CRITICAL and G_LOG_LEVEL_WARNING because
|
||||
these are effectively assertions and we want to run with G_DEBUG=fatal-warnings.
|
||||
|
||||
6) g_warn_if_*() from glib. These are always compiled in and log a G_LOG_LEVEL_WARNING
|
||||
warning. Don't use this.
|
||||
|
||||
7) G_TYPE_CHECK_INSTANCE_CAST() from glib. Unless building with "WITH_MORE_ASSERTS",
|
||||
we set G_DISABLE_CAST_CHECKS. This means, cast macros like NM_DEVICE(ptr)
|
||||
translate to plain C pointer casts. Use such cast macros deliberately, in production
|
||||
code they are cheap, with more asserts enabled the check that the pointer type is
|
||||
suitable.
|
||||
|
||||
Of course, every assertion failure is a bug, and calling it must have no side effects.
|
||||
|
||||
Theoretically, you are welcome to disable G_DISABLE_CHECKS and G_DISABLE_ASSERT
|
||||
in production builds. In practice, nobody tests such a configuration, so beware.
|
||||
|
||||
For testing, you also want to run NetworkManager with environment variable
|
||||
G_DEBUG=fatal-warnings to crash upon G_LOG_LEVEL_CRITICAL and G_LOG_LEVEL_WARNING
|
||||
g_log() message. NetworkManager won't use these levels for regular logging
|
||||
but for assertions.
|
||||
|
|
|
|||
42
COPYING
42
COPYING
|
|
@ -1,22 +1,12 @@
|
|||
Unless a COPYING file in a subdirectory or file-specific license headers
|
||||
specify a different license, the following applies to all files in this
|
||||
directory and all subdirectories.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
|
|
@ -25,7 +15,7 @@ software--to make sure the software is free for all its users. This
|
|||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
|
|
@ -66,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
|
|||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
|
|
@ -265,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
|||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
|
|
@ -287,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
|
|
@ -313,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
|
@ -346,6 +335,5 @@ necessary. Here is a sample; alter the names:
|
|||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
|
|
|
|||
355
COPYING.GFDL
Normal file
355
COPYING.GFDL
Normal file
|
|
@ -0,0 +1,355 @@
|
|||
GNU Free Documentation License
|
||||
Version 1.1, March 2000
|
||||
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
0. PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
written document "free" in the sense of freedom: to assure everyone
|
||||
the effective freedom to copy and redistribute it, with or without
|
||||
modifying it, either commercially or noncommercially. Secondarily,
|
||||
this License preserves for the author and publisher a way to get
|
||||
credit for their work, while not being considered responsible for
|
||||
modifications made by others.
|
||||
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
|
||||
1. APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work that contains a
|
||||
notice placed by the copyright holder saying it can be distributed
|
||||
under the terms of this License. The "Document", below, refers to any
|
||||
such manual or work. Any member of the public is a licensee, and is
|
||||
addressed as "you".
|
||||
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A "Secondary Section" is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall subject
|
||||
(or to related matters) and contains nothing that could fall directly
|
||||
within that overall subject. (For example, if the Document is in part a
|
||||
textbook of mathematics, a Secondary Section may not explain any
|
||||
mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License.
|
||||
|
||||
The "Cover Texts" are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License.
|
||||
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, whose contents can be viewed and edited directly and
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup has been designed to thwart or discourage
|
||||
subsequent modification by readers is not Transparent. A copy that is
|
||||
not "Transparent" is called "Opaque".
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML designed for human modification. Opaque formats include
|
||||
PostScript, PDF, proprietary formats that can be read and edited only
|
||||
by proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML produced by some word processors for output
|
||||
purposes only.
|
||||
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, "Title Page" means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
|
||||
2. VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
|
||||
3. COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies of the Document numbering more than 100,
|
||||
and the Document's license notice requires Cover Texts, you must enclose
|
||||
the copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a publicly-accessible computer-network location containing a complete
|
||||
Transparent copy of the Document, free of added material, which the
|
||||
general network-using public has access to download anonymously at no
|
||||
charge using public-standard network protocols. If you use the latter
|
||||
option, you must take reasonably prudent steps, when you begin
|
||||
distribution of Opaque copies in quantity, to ensure that this
|
||||
Transparent copy will remain thus accessible at the stated location
|
||||
until at least one year after the last time you distribute an Opaque
|
||||
copy (directly or through your agents or retailers) of that edition to
|
||||
the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
|
||||
4. MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has less than five).
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
D. Preserve all the copyright notices of the Document.
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
H. Include an unaltered copy of this License.
|
||||
I. Preserve the section entitled "History", and its title, and add to
|
||||
it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section entitled "History" in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the "History" section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
K. In any section entitled "Acknowledgements" or "Dedications",
|
||||
preserve the section's title, and preserve in the section all the
|
||||
substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
M. Delete any section entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
N. Do not retitle any existing section as "Endorsements"
|
||||
or to conflict in title with any Invariant Section.
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
|
||||
5. COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections entitled "History"
|
||||
in the various original documents, forming one section entitled
|
||||
"History"; likewise combine any sections entitled "Acknowledgements",
|
||||
and any sections entitled "Dedications". You must delete all sections
|
||||
entitled "Endorsements."
|
||||
|
||||
|
||||
6. COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
|
||||
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, does not as a whole count as a Modified Version
|
||||
of the Document, provided no compilation copyright is claimed for the
|
||||
compilation. Such a compilation is called an "aggregate", and this
|
||||
License does not apply to the other self-contained works thus compiled
|
||||
with the Document, on account of their being thus compiled, if they
|
||||
are not themselves derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one quarter
|
||||
of the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that surround only the Document within the aggregate.
|
||||
Otherwise they must appear on covers around the whole aggregate.
|
||||
|
||||
|
||||
8. TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License provided that you also include the
|
||||
original English version of this License. In case of a disagreement
|
||||
between the translation and the original English version of this
|
||||
License, the original English version will prevail.
|
||||
|
||||
|
||||
9. TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document is void, and will
|
||||
automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this
|
||||
License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
|
||||
10. FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
https://www.gnu.org/licenses/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
|
||||
|
||||
ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
Copyright (c) YEAR YOUR NAME.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
If you have no Invariant Sections, write "with no Invariant Sections"
|
||||
instead of saying which ones are invariant. If you have no
|
||||
Front-Cover Texts, write "no Front-Cover Texts" instead of
|
||||
"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
|
|
@ -1,118 +1,125 @@
|
|||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, too.
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if
|
||||
you distribute copies of the library, or if you modify it.
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, so that any problems introduced by others will not reflect on
|
||||
the original authors' reputations.
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
|
|
@ -139,7 +146,7 @@ such a program is covered only if its contents constitute a work based
|
|||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
|
|
@ -261,7 +268,7 @@ distribute the object code for the work under the terms of Section 6.
|
|||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
|
|
@ -288,23 +295,31 @@ of these things:
|
|||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the source code distributed need not include anything that is normally
|
||||
distributed (in either source or binary form) with the major
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
|
@ -353,7 +368,7 @@ Library), the recipient automatically receives a license from the
|
|||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
|
|
@ -396,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if
|
|||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library General Public License from time to time.
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
|
|
@ -417,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
|
|||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
|
|
@ -440,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
|
|
@ -459,19 +474,18 @@ convey the exclusion of warranty; and each file should have at least the
|
|||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301 USA.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Dan Williams
|
||||
E-mail: dcbw redhat com
|
||||
Userid: dcbw
|
||||
Lubomir Rintel
|
||||
E-mail: lkundrak v3 sk
|
||||
Userid: lkundrak
|
||||
|
||||
|
|
|
|||
4997
Makefile.am
4997
Makefile.am
File diff suppressed because it is too large
Load diff
199
Makefile.examples
Normal file
199
Makefile.examples
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
###############################################################################
|
||||
# examples/C/glib
|
||||
###############################################################################
|
||||
|
||||
examples_C_glib_cppflags = \
|
||||
-I$(top_srcdir)/shared \
|
||||
-I$(top_builddir)/shared \
|
||||
-I$(top_srcdir)/libnm-core \
|
||||
-I$(top_builddir)/libnm-core \
|
||||
-I$(top_srcdir)/libnm \
|
||||
-I$(top_builddir)/libnm \
|
||||
$(GLIB_CFLAGS)
|
||||
|
||||
examples_C_glib_cppflags_gdbus = $(examples_C_glib_cppflags)
|
||||
examples_C_glib_cppflags_libnm = $(examples_C_glib_cppflags)
|
||||
|
||||
check_programs_norun += \
|
||||
examples/C/glib/add-connection-gdbus \
|
||||
examples/C/glib/add-connection-libnm \
|
||||
examples/C/glib/get-active-connections-gdbus \
|
||||
examples/C/glib/get-ap-info-libnm \
|
||||
examples/C/glib/list-connections-gdbus \
|
||||
examples/C/glib/list-connections-libnm \
|
||||
examples/C/glib/monitor-nm-running-gdbus \
|
||||
examples/C/glib/monitor-nm-state-gdbus
|
||||
|
||||
examples_C_glib_add_connection_gdbus_CPPFLAGS = $(examples_C_glib_cppflags_gdbus)
|
||||
examples_C_glib_add_connection_gdbus_LDADD = \
|
||||
$(GLIB_LIBS) \
|
||||
$(UUID_LIBS)
|
||||
$(examples_C_glib_add_connection_gdbus_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||
|
||||
examples_C_glib_add_connection_libnm_CPPFLAGS = $(examples_C_glib_cppflags_libnm)
|
||||
examples_C_glib_add_connection_libnm_LDADD = \
|
||||
libnm/libnm.la \
|
||||
$(GLIB_LIBS)
|
||||
$(examples_C_glib_add_connection_libnm_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||
|
||||
examples_C_glib_get_active_connections_gdbus_CPPFLAGS = $(examples_C_glib_cppflags_gdbus)
|
||||
examples_C_glib_get_active_connections_gdbus_LDADD = \
|
||||
$(GLIB_LIBS)
|
||||
$(examples_C_glib_get_active_connections_gdbus_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||
|
||||
examples_C_glib_get_ap_info_libnm_CPPFLAGS = $(examples_C_glib_cppflags_libnm)
|
||||
examples_C_glib_get_ap_info_libnm_LDADD = \
|
||||
libnm/libnm.la \
|
||||
$(GLIB_LIBS)
|
||||
$(examples_C_glib_get_ap_info_libnm_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||
|
||||
examples_C_glib_list_connections_gdbus_CPPFLAGS = $(examples_C_glib_cppflags_gdbus)
|
||||
examples_C_glib_list_connections_gdbus_LDADD = \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
examples_C_glib_list_connections_libnm_CPPFLAGS = $(examples_C_glib_cppflags_libnm)
|
||||
examples_C_glib_list_connections_libnm_LDADD = \
|
||||
libnm/libnm.la \
|
||||
$(GLIB_LIBS)
|
||||
$(examples_C_glib_list_connections_libnm_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||
|
||||
examples_C_glib_monitor_nm_running_gdbus_CPPFLAGS = $(examples_C_glib_cppflags_gdbus)
|
||||
examples_C_glib_monitor_nm_running_gdbus_LDADD = \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
examples_C_glib_monitor_nm_state_gdbus_CPPFLAGS = $(examples_C_glib_cppflags_gdbus)
|
||||
examples_C_glib_monitor_nm_state_gdbus_LDADD = \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
EXTRA_DIST += \
|
||||
examples/C/glib/meson.build
|
||||
|
||||
###############################################################################
|
||||
# examples/C/qt
|
||||
###############################################################################
|
||||
|
||||
if WITH_QT
|
||||
|
||||
examples_C_qt_cppflags = \
|
||||
-I$(top_srcdir)/libnm-core \
|
||||
-I$(top_builddir)/libnm-core \
|
||||
-I$(builddir)/examples/C/qt \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(QT_CFLAGS)
|
||||
|
||||
check_programs_norun += \
|
||||
examples/C/qt/add-connection-wired \
|
||||
examples/C/qt/list-connections \
|
||||
examples/C/qt/change-ipv4-addresses \
|
||||
examples/C/qt/monitor-nm-running
|
||||
|
||||
examples_C_qt_add_connection_wired_SOURCES = examples/C/qt/add-connection-wired.cpp
|
||||
examples_C_qt_add_connection_wired_CPPFLAGS = $(examples_C_qt_cppflags)
|
||||
examples_C_qt_add_connection_wired_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(QT_LIBS)
|
||||
|
||||
examples_C_qt_list_connections_SOURCES = examples/C/qt/list-connections.cpp
|
||||
examples_C_qt_list_connections_CPPFLAGS = $(examples_C_qt_cppflags)
|
||||
examples_C_qt_list_connections_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(QT_LIBS)
|
||||
|
||||
examples_C_qt_change_ipv4_addresses_SOURCES = examples/C/qt/change-ipv4-addresses.cpp
|
||||
examples_C_qt_change_ipv4_addresses_CPPFLAGS = $(examples_C_qt_cppflags)
|
||||
examples_C_qt_change_ipv4_addresses_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(QT_LIBS)
|
||||
|
||||
examples_C_qt_monitor_nm_running_SOURCES = examples/C/qt/monitor-nm-running.cpp
|
||||
examples_C_qt_monitor_nm_running_CPPFLAGS = $(examples_C_qt_cppflags)
|
||||
examples_C_qt_monitor_nm_running_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(QT_LIBS)
|
||||
|
||||
examples/C/qt/monitor-nm-running.moc: examples/C/qt/monitor-nm-running.cpp
|
||||
$(AM_V_GEN) $(MOC) -i $< -o $@
|
||||
|
||||
$(examples_C_qt_monitor_nm_running_OBJECTS): examples/C/qt/monitor-nm-running.moc
|
||||
|
||||
CLEANFILES += \
|
||||
examples/C/qt/monitor-nm-running.moc
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
examples/C/qt/add-connection-wired.cpp \
|
||||
examples/C/qt/list-connections.cpp \
|
||||
examples/C/qt/change-ipv4-addresses.cpp \
|
||||
examples/C/qt/monitor-nm-running.cpp \
|
||||
examples/C/qt/meson.build
|
||||
|
||||
###############################################################################
|
||||
# examples
|
||||
###############################################################################
|
||||
|
||||
EXTRA_DIST += \
|
||||
examples/dispatcher/10-ifcfg-rh-routes.sh \
|
||||
examples/dispatcher/70-wifi-wired-exclusive.sh \
|
||||
\
|
||||
examples/js/get_ips.js \
|
||||
\
|
||||
examples/lua/lgi/add-connection.lua \
|
||||
examples/lua/lgi/list-connections.lua \
|
||||
examples/lua/lgi/list-devices.lua \
|
||||
examples/lua/lgi/show-wifi-networks.lua \
|
||||
examples/lua/lgi/get-basic-nm-info.lua \
|
||||
examples/lua/lgi/get-ips.lua \
|
||||
examples/lua/lgi/change-vpn-username.lua \
|
||||
examples/lua/lgi/deactivate-all.lua \
|
||||
\
|
||||
examples/nm-conf.d/30-anon.conf \
|
||||
examples/nm-conf.d/31-mac-addr-change.conf \
|
||||
\
|
||||
examples/python/dbus/nm-state.py \
|
||||
examples/python/dbus/add-connection.py \
|
||||
examples/python/dbus/add-connection-compat.py \
|
||||
examples/python/dbus/add-wifi-eap-connection.py \
|
||||
examples/python/dbus/add-wifi-psk-connection.py \
|
||||
examples/python/dbus/vpn.py \
|
||||
examples/python/dbus/update-secrets.py \
|
||||
examples/python/dbus/list-connections.py \
|
||||
examples/python/dbus/show-bssids.py \
|
||||
examples/python/dbus/disconnect-device.py \
|
||||
examples/python/dbus/get-active-connection-uuids.py \
|
||||
examples/python/dbus/list-devices.py \
|
||||
examples/python/dbus/update-ip4-method.py \
|
||||
examples/python/dbus/is-wwan-default.py \
|
||||
examples/python/dbus/wifi-hotspot.py \
|
||||
examples/python/dbus/create-bond.py \
|
||||
examples/python/dbus/wifi-active-ap.py\
|
||||
\
|
||||
examples/python/gi/README \
|
||||
examples/python/gi/add_connection.py \
|
||||
examples/python/gi/deactivate-all.py \
|
||||
examples/python/gi/device-state-ip4config.py \
|
||||
examples/python/gi/firewall-zone.py \
|
||||
examples/python/gi/get-active-connections.py \
|
||||
examples/python/gi/get_ips.py \
|
||||
examples/python/gi/list-connections.py \
|
||||
examples/python/gi/nm-add-connection2.py \
|
||||
examples/python/gi/nm-connection-update-stable-id.py \
|
||||
examples/python/gi/nm-update2.py \
|
||||
examples/python/gi/nm-wg-set \
|
||||
examples/python/gi/setting-user-data.py \
|
||||
examples/python/gi/show-wifi-networks.py \
|
||||
examples/python/gi/update-ip4-method.py \
|
||||
\
|
||||
examples/python/python-networkmanager/README \
|
||||
\
|
||||
examples/ruby/add-connection.rb \
|
||||
examples/ruby/get-basic-nm-info.rb \
|
||||
examples/ruby/list-devices.rb \
|
||||
\
|
||||
examples/shell/nm-logging.sh \
|
||||
examples/shell/get-hostname.sh \
|
||||
examples/shell/list-devices.sh \
|
||||
examples/shell/disconnect-device.sh \
|
||||
examples/shell/active-wifi.sh \
|
||||
\
|
||||
$(NULL)
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
# -*- Mode: makefile -*-
|
||||
#
|
||||
# Work-in-progress...
|
||||
# See https://bugzilla.gnome.org/show_bug.cgi?id=654395
|
||||
|
|
@ -85,7 +84,7 @@ $(1).h: $(1).h.stamp
|
|||
|
||||
$(1).c.stamp: $(_glib_enum_types_h_sources) Makefile
|
||||
$$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
|
||||
--fhead "/* Generated by glib-mkenums. Do not edit */\n\n#include \"$(notdir $(1)).h\"\n" \
|
||||
--fhead "/* Generated by glib-mkenums. Do not edit */\n\n#include \"config.h\"\n\n#include \"$(notdir $(1)).h\"\n" \
|
||||
$$(GLIB_MKENUMS_C_FLAGS) \
|
||||
$$($(_glib_enum_types_prefix)_MKENUMS_C_FLAGS) \
|
||||
--fhead "$$(foreach f,$$(filter-out Makefile,$$(^F)),\n#include \"$$(f)\")\n\n" \
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ _vapigen_silent_opts = $(_vapigen_silent_opts_$(V))
|
|||
_vapigen_silent_opts_ = $(_vapigen_silent_opts_$(AM_DEFAULT_VERBOSITY))
|
||||
_vapigen_silent_opts_0 = --quiet
|
||||
|
||||
$(if $(VAPIGEN),,$(error You must define VAPIGEN))
|
||||
|
||||
_vapi_name = $(subst /,_,$(subst -,_,$(subst .,_,$(1))))
|
||||
|
||||
define vapigen
|
||||
|
|
@ -57,7 +55,8 @@ $(1): $$($(_vapi_name)_GIR)
|
|||
$(foreach _vapi_dir_name,$(if $($(_vapi_name)_VAPIDIRS),$($(_vapi_name)_VAPIDIRS),$(VAPIGEN_VAPIDIRS)),--vapidir $(_vapi_dir_name)) \
|
||||
$(foreach _vapi_gir_dir,$(if $($(_vapi_name)_GIRDIRS),$($(_vapi_name)_GIRDIRS),$(VAPIGEN_GIRDIRS)),--girdir $(_vapi_gir_dir)) \
|
||||
$(foreach _vapi_dep_name,$(if $($(_vapi_name)_DEPS),$($(_vapi_name)_DEPS),$(VAPIGEN_DEPS)),--pkg $(_vapi_dep_name)) \
|
||||
$$($(_vapi_name)_FILES)
|
||||
$$($(_vapi_name)_FILES) && \
|
||||
touch $(1)
|
||||
endef
|
||||
|
||||
$(foreach vapi,$(VAPIGEN_VAPIS),$(eval $(call vapigen,$(vapi))))
|
||||
839
NEWS
839
NEWS
|
|
@ -1,3 +1,804 @@
|
|||
=============================================
|
||||
NetworkManager-1.22
|
||||
Overview of changes since NetworkManager-1.20
|
||||
=============================================
|
||||
|
||||
This is a snapshot of NetworkManager 1.22 development series.
|
||||
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!
|
||||
|
||||
* Drop support for BlueZ 4. BlueZ 5 was released in 2012 and should
|
||||
nowadays be available everywhere.
|
||||
* core: declare "startup complete" when device reaches "connected"
|
||||
state, even if IP addressing methods did not yet fully complete.
|
||||
This changes behavior for unblocking "NetworkManager-wait-online.service",
|
||||
and "network-online.target" earlier. If this causes issues in your
|
||||
setup, you may need to configure "ipv4.may-fail=no" or "ipv6.may-fail=no",
|
||||
which delays reaching "connected" state for the address family accordingly.
|
||||
* Various bug fixes and improvements.
|
||||
* libnm: hide NMObject and NMClient typedefs from header files. This prevents
|
||||
the user from subclassing these types and is an ABI change (in case somebody
|
||||
was doing so).
|
||||
* libnm: retire deprecated WiMAX API NMDeviceWimax and NMWimaxNsp.
|
||||
WiMAX support was removed from NetworkManager in version 1.2 (2016) and no such
|
||||
type instances would have been created by NMClient for a while now.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.20
|
||||
Overview of changes since NetworkManager-1.18
|
||||
=============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* The libnm-glib library, deprecated in favor of libnm since NetworkManager 1.0,
|
||||
and disabled by default since NetworkManager 1.12, has now been removed.
|
||||
* The DHCP client now defaults to "internal". The default can be overriden
|
||||
at build time by using the --with-config-dhcp-default option of the
|
||||
configure script or at run time by setting the main.dhcp option in the
|
||||
configuration file.
|
||||
* Added support for configuring fq_codel line discipline and mirred action.
|
||||
* Added a possibility for distributions to ship dispatcher scripts in /usr/lib.
|
||||
* Drop deprecated setting "main.monitor-connection-files" in NetworkManager.conf.
|
||||
This setting now has no more effect and was disabled by default for a long time.
|
||||
Instead, after changes, load files explicitly with `nmcli connection load` or
|
||||
`nmcli connection reload`.
|
||||
* Rework parsing team JSON config in libnm and stricter validate settings.
|
||||
With this, NetworkManager rejects settings that it considers invalid while
|
||||
still allowing setting arbitrary JSON config directly.
|
||||
* Drop ibft settings plugin. This functionality is now covered by using
|
||||
nm-initrd-generator from initrd to pre-generate in-memory profiles.
|
||||
* Support "suppress_prefixlength" attribute for policy routing rules.
|
||||
This is what wg-quick uses for the "Improved Rule-based Routing" solution,
|
||||
and the user can now manually configure such policy routing rules.
|
||||
* Support "wireguard.ip4-auto-default-route" and "wireguard.ip6-auto-default-route".
|
||||
This automatically implements the "Improved Rule-based Routing" of wg-quick
|
||||
to help avoiding routing loops when setting the default-route on the WireGuard
|
||||
interface. Note that this is now enabled by default, so there is a change in behavior
|
||||
if your WireGuard connection profiles from before had a default-route (/0)
|
||||
in allowed-ips.
|
||||
* Rework implementation of settings plugins and how profiles are presisted
|
||||
to disk. This is a large internal refactoring of the settings plugins that
|
||||
allows to migrate a connection profile between plugins.
|
||||
* In-memory profiles are now only handled by keyfile plugin and will also be
|
||||
persisted to /run directory. This allows to restart NetworkManager without
|
||||
loosing these profiles and it provides a file-system based API for creating
|
||||
in-memory profiles.
|
||||
* Keyfile plugin now supports a read-only directory of profiles under directory
|
||||
"/usr/lib/NetworkManager/system-connections". Such profiles still can be modified
|
||||
and deleted via D-Bus, which results in writing profiles to /etc or /run that
|
||||
shadow the read-only files.
|
||||
* Add new D-Bus method AddConnection2() that allows to block autoconnect of
|
||||
the profile at the moment when creating the profile. Also add support for
|
||||
this API to libnm.
|
||||
* Add flag "no-reapply" to Update2() D-Bus method. Normally, when a connection
|
||||
profile gets modified, this only changes the profile itself. When the profile
|
||||
is currently activated on a device, then the device's configuration does not update
|
||||
before the profile is fully re-activated or Reapply on the device is called. There
|
||||
is an exception to this: the "connection.zone" and the "connection.metered"
|
||||
properties take effect immediately. The "no-reapply" flag allows suppressing to
|
||||
reapply any properties, so that no changes take effect automatically. The purpose
|
||||
is to really only modify the profile itself without changes to the runtime configuration
|
||||
of the device.
|
||||
* Add "ipv6.method=disabled" to disable IPv6 on a device, like also possible for
|
||||
IPv4. Until now, the users could only set "ipv6.method=ignore" which means the
|
||||
users are free to set IPv6 related sysctl values themselves.
|
||||
* Added support for Wi-Fi Mesh network.
|
||||
|
||||
The following changes were backported to 1.18.x releases between 1.18.0
|
||||
and 1.18.2 are also present in NetworkManager-1.18:
|
||||
|
||||
- 1.18.2:
|
||||
* Add compatibility with out-of-tree WireGuard module on 5.2 kernels
|
||||
* Fix parsing of BOOTIF= variables in initrd.
|
||||
* Accept numeric IPv4 prefix in place of a mask when parsing a command line
|
||||
in initrd.
|
||||
* Don't check connectivity of unconfigured devices.
|
||||
* Fix PKCS#12 handling in the ifcfg-rh plugin.
|
||||
* Avoid waiting for udev to see software devices created by NetworkManager.
|
||||
* Don't attempt to stop management daemon for Team devices created
|
||||
externally to NetworkManager.
|
||||
* Use FQDN for persistent hostname on Slackware.
|
||||
* Restore IPv6 configuration of a device when its link goes back up.
|
||||
* Fix management status of software devices on system suspend.
|
||||
* Make nmcli not print certificate blobs if --show-secrets is not used.
|
||||
* Fix MTU reapply.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.18
|
||||
Overview of changes since NetworkManager-1.16
|
||||
=============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* Add support for policy routing rules.
|
||||
* Add support for VLAN filtering for Linux bridge.
|
||||
* Support ieee-802-1 and ieee-802-3 LLDP TLVs.
|
||||
* Allow large MTU sizes for infiniband/IPoIB connection profiles.
|
||||
* Improve nmcli's handling of list options for connection properties.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.16
|
||||
Overview of changes since NetworkManager-1.14
|
||||
=============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* Check connectivity per address family.
|
||||
* Support "main.systemd-resolved" to let NetworkManager configure DNS settings
|
||||
in systemd-resolved without making it the main DNS plugin of NetworkManager.
|
||||
* Write "/var/run/NetworkManager/no-stub-resolv.conf" with original nameservers.
|
||||
That is useful with caching DNS plugins like "systemd-resolved" or "dnsmasq" where
|
||||
"/var/run/NetworkManager/resolv.conf" refers to localhost.
|
||||
* Change default "ipv4.dhcp-client-id" setting for the internal DHCP plugin from
|
||||
"duid" to "mac". This is a change in behavior on upgrade when using the internal
|
||||
DHCP plugin (unless the default is overwritten in "NetworkManager.conf" or specified
|
||||
per connection profile).
|
||||
* Improve handling of DHCP router options with internal DHCP plugin. For one, accept
|
||||
multiple routers and add a default-route to each. On D-Bus expose the original DNS
|
||||
and NTP servers without cleaning up local nameservers.
|
||||
* Allow binding a connections lifetime to the DBus client that activated it.
|
||||
* Add support for establishing Wi-Fi Direct connections (Wi-Fi P2P).
|
||||
* Add support for WireGuard VPN tunnels to NetworkManager. D-Bus API and libnm
|
||||
support all options. nmcli supports creating and managing WireGuard profiles,
|
||||
with the exception of configuring and showing peers.
|
||||
* Add initrd generator to be used by dracut and use it as new way of handling
|
||||
iBFT.
|
||||
* Deprecated "plugins.monitor-connection-files" setting in NetworkManager.conf.
|
||||
This option will have no effect in future versions.
|
||||
* Add AP and Ad-hoc support for iwd Wi-Fi backend.
|
||||
* Warn about invalid settings in "NetworkManager.conf".
|
||||
* Support announcing "ANDROID_METERED" DHCP option for shared mode.
|
||||
* Support SAE authentication as used for 802.11s Meshing and WPA3-Personal.
|
||||
* NetworkManager is no longer installed as D-Bus activatable service.
|
||||
* Mark docker bridges as unmanaged via udev rule.
|
||||
* Add new PolicyKit permission "org.freedesktop.NetworkManager.wifi.scan" for controlling
|
||||
Wi-Fi scanning.
|
||||
|
||||
The following changes were backported to 1.14.x releases between 1.14.0
|
||||
and 1.14.6 are also present in NetworkManager-1.14:
|
||||
|
||||
- 1.14.6:
|
||||
* Fix memory corruption in internal DHCPv6 client (CVE-2018-15688).
|
||||
* No longer limit number of search entries in resolv.conf to 6.
|
||||
* Support restricting NetworkManager.conf device configuration based on used DHCP
|
||||
plugin.
|
||||
* Add "${MAC}" specifier for connection.stable-id. This uses the current MAC
|
||||
address for seeding the stable generation of MAC address, DHCP client-id
|
||||
or IPv6 stable-privacy interface identifier.
|
||||
* Support special value "duid" for "ipv4.dhcp-client-id". This generates an
|
||||
RFC4361-compliant client-id like the internal DHCP client used to do by default.
|
||||
Previously, there was no explicit name for such a client-id and it was not
|
||||
usable with dhclient DHCP plugin. This also generates the same client-id as
|
||||
systemd-networkd does by default.
|
||||
* Support and use a new kind of secret-key in "/var/lib/NetworkManager/secret_key".
|
||||
The secret-key represents the identity of the machine that is used for various
|
||||
purposes like generating IPv6 stable privacy addresses. It is now combined
|
||||
with "/etc/machine-id" so that changing only the machine-id results in new identifiers.
|
||||
That matters for example when cloning a virtual machine. Previously, the user
|
||||
hard to prune NetworkManager's secret-key to get a new identity, now regenerating
|
||||
machine-id suffices. Secret-keys generated by earlier versions of NetworkManager are
|
||||
not affected and keep their previous behavior.
|
||||
* Fix the DHCP client-ids based on the MAC address of IPoIB/infiniband devices.
|
||||
* Fix restoring IP configuration after interface went down.
|
||||
* No longer let NetworkManager touch rp_filter setting. The rp_filter sysctl must now
|
||||
be set outside of NetworkManager according to the admin's preference. Note that a strict
|
||||
rp_filter may break valid use-cases and interacts badly with connectivity checking.
|
||||
* Various bug fixes and improvements.
|
||||
|
||||
- 1.14.4:
|
||||
* Fix a crash in nmcli when a device is removed while being disconnected.
|
||||
* Fix a crash in ifupdown (Debian) configuration plugin.
|
||||
* Fix a daemon crash when a generated connection doesn't validate.
|
||||
* Fix a memory leak in dhclient DHCP plugin.
|
||||
* Fix line editing in nmcli password prompts.
|
||||
* Fix a RPATH in bluetooth and wwan plugin when built with Meson (otherwise
|
||||
they wouldn't find libnm-wwan.so).
|
||||
|
||||
- 1.14.2:
|
||||
* Fix a bug that could cause NetworkManager to crash after checking
|
||||
connectivity status.
|
||||
* Correctly apply a default (-1) metric from DHCP.
|
||||
* Multiple fixes for IWD Wi-Fi backend.
|
||||
* Multiple fixes for builds with Meson build system.
|
||||
* Fix a crash with OLPC XO-1 mesh Wi-Fi.
|
||||
* Fix handling "serial.parity" and "serial.send-delay" properties in nmcli.
|
||||
* Improve auto-selecting device when activating a connection profile
|
||||
and don't auto-select unmanaged devices when activating multi-connect
|
||||
profile.
|
||||
* Avoid expiring the lifetime of IPv6 addresses from router advertisements.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.14
|
||||
Overview of changes since NetworkManager-1.12
|
||||
=============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* Added support for IEEE 802.15.4 and 6LowPAN devices.
|
||||
* Support activating profile multiple times via connection.multi-connect
|
||||
setting.
|
||||
* Add match setting to restrict a profile to devices based on
|
||||
a list of interface names with globbing supported.
|
||||
* Fix PrimaryConnection for VPN with default-route.
|
||||
* Add support for ethtool offload features.
|
||||
* Add support for configuring llmnr.
|
||||
* Deprecate endian-dependent D-Bus API and add new API that can be
|
||||
used instead (rh#1153559).
|
||||
* Add support for ip6gre/ip6gretap IP tunnels.
|
||||
* Add support for detecting WireGuard interfaces (WireGuard VPN cannot
|
||||
be controlled via NetworkManager).
|
||||
* Add support for configuring SR-IOV devices.
|
||||
* Improve error reporting of activation when no device is available.
|
||||
* Support reapplying changes of the route metric.
|
||||
* Support EAP profiles with iwd Wi-Fi backend and support iwd API 0.8.
|
||||
* Expose slaves of OVS bridges and ports.
|
||||
|
||||
The following changes were backported to 1.12.x releases between 1.12.0
|
||||
and 1.12.2 are also present in NetworkManager-1.14:
|
||||
|
||||
* fix missing symbols in libnm ABI for settings.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.12
|
||||
Overview of changes since NetworkManager-1.10
|
||||
=============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* Improved support for configuration checkpoint, including support in libnm.
|
||||
* Added capability to set IP Tunnel configuration flags.
|
||||
* The systemd-resolved DNS plugins now supports MDNS.
|
||||
* systemd-resolved and dnsmasq DNS plugins now honor the DNS priority setting.
|
||||
* Wi-Fi devices now support FILS for speedier roaming support.
|
||||
* Drop dependency on libnl3 library.
|
||||
* Add support for "onlink" routes.
|
||||
* More robust connectivity checking.
|
||||
* Dropped the obsolete "ifnet" settings plugin,
|
||||
* Try harder to generate reasonable human-readable names for devices even if
|
||||
the hwdb contains garbage.
|
||||
* Add an "overview" option to hide default values in nmcli, resulting in more
|
||||
concise output.
|
||||
* Reworked the inner workings of D-Bus interface for better resource efficiency.
|
||||
* Add support for configuring nmcli coloring via terminal-colors.d(5).
|
||||
* Added experimental support for Meson build system,
|
||||
* Added initial IWD Wi-Fi daemon support.
|
||||
* A non-hexadecimal DHCPv4 client-id is now properly passed to
|
||||
dhclient with the first byte (type) set to zero, as stated in the
|
||||
documentation. This represents a change in behavior since previous
|
||||
versions where the first character of the string was used as
|
||||
type. The internal client is not affected by the change.
|
||||
* DNS setting rc-manager=file now always follows dangling symlinks
|
||||
instead of replacing /etc/resolv.conf with a plain file.
|
||||
* Added wake_on_wlan connection setting to configure
|
||||
wake-on-wireless-lan (WoWLAN).
|
||||
* The libnm-glib library, deprecated in favor of libnm since NetworkManager 1.0,
|
||||
is now not built by default. While it can still be enabled, the distributions
|
||||
should have a good plan for removing it if they need to keep shipping it at
|
||||
this point.
|
||||
* nmcli now scans for Wi-Fi networks before displaying them, if the last scan
|
||||
was too long ago.
|
||||
* Added the ipv6.dhcp-duid property to allow configuring the DHCPv6 DUID
|
||||
* Extended ipv6.dhcp-client-id property to support DHCP client identifiers
|
||||
depending on the MAC address and the stable ID.
|
||||
* Set NM_DISPATCHER_ACTION environment variable in dispatcher scripts.
|
||||
|
||||
The following features were backported to 1.10.x releases from 1.10.0 to
|
||||
1.10.10 are also present in NetworkManager-1.12:
|
||||
|
||||
* Fix crash during reapply of connection settings
|
||||
* Fix connectivity timeout handling (bgo #794464),
|
||||
* Retry activating devices when the parent becomes managed (rh #1553595),
|
||||
* Correctly set the rp_filter value (rh #1565529).
|
||||
* A fix to ensure teamd is respawned after daemon restart (rh #1551958).
|
||||
* Better handle DHCP expiry (bgo #783391).
|
||||
* Fix configuration of IPv6 over master interfaces (rh #1575944).
|
||||
* ovs: fix compilation issue of OVS plugin and various fixes.
|
||||
* team: add support for team runner "random".
|
||||
* core: cleanup activation of device (rh #1537160).
|
||||
* dhcp: retry indefinitely to renew the lease (rh #1503587).
|
||||
* core: fix blocking autoconnect for no-secrets (rh #794014).
|
||||
* libnm: mark async results as cancelled (bgo #794088).
|
||||
* Load jansson at runtime. This solves a clash with json-glib that caused
|
||||
a gnome-control-center crash, but also gets rid of a hard dependency.
|
||||
* Correct nmcli exit values after receiving a signal.
|
||||
* Fix libnm secret agent asynchronous initialization.
|
||||
* Add a default route for a modem even if it didn't sent a gateway.
|
||||
* Improve communication of DAD failures.
|
||||
* Remember device default metrics across daemon restarts.
|
||||
* Various bug fixes including possible crashes.
|
||||
* Added support for 'onlink' IPv4 routes attribute.
|
||||
* Wait longer for the carrier to come up after a MTU change.
|
||||
* Implemented abstraction for team connections that exposes team
|
||||
configuration items as distinct properties.
|
||||
* Added basic support for tc queueing disciplines and filters.
|
||||
* Introduced an Update2() D-Bus method to update connection settings
|
||||
with more flexibility.
|
||||
* Many bug fixes and improvements.
|
||||
|
||||
============================================
|
||||
NetworkManager-1.10
|
||||
Overview of changes since NetworkManager-1.8
|
||||
============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* NetworkManager includes now basic Open vSwitch support, good enough
|
||||
to be capable of setting up simple Open vSwitch configurations.
|
||||
* Added support for activating PPP connections on non-Ethernet
|
||||
interfaces.
|
||||
* It is now possible to authenticate to a Wi-Fi network using WPS
|
||||
(Wi-Fi Protected Setup).
|
||||
* Implemented support for Wi-Fi PMF (Protected Management Frames,
|
||||
802.11w), which can be configured via the wifi-sec.pmf property.
|
||||
* Now the maximum rate of wireless access points supporting 802.11 is
|
||||
properly calculated and exposed on D-Bus.
|
||||
* Background scanning is now disabled for non-WPA-Enterprise Wi-Fi
|
||||
networks.
|
||||
* Added support for the Bluetooth NAP (Network Access Point) profile.
|
||||
* Added support for disabling connectivity checking via the D-Bus
|
||||
interface.
|
||||
* The internal DHCP client now understands the domain-search option.
|
||||
* Bridge connections support the group-forward-mask property.
|
||||
* NetworkManager can now configure multiple IPv6 default routes
|
||||
received through RA and each gets configured with the announced
|
||||
preference.
|
||||
* It is possible to specify the routing table for each static route.
|
||||
* Support specifying a explicit routing table for any non-static-route,
|
||||
including routes from DHCP, device-routes, IPv6 autoconf.
|
||||
* Device are left configured when a user sets them as unmanaged by
|
||||
NetworkManager.
|
||||
* New connection.auth-retry property to configure how often authentication
|
||||
is prompted before failing the configuration.
|
||||
* The platform code that handles synchronization with kernel status
|
||||
via netlink has been reworked and is more efficient.
|
||||
* Allowed the update of connections that have an associated ifcfg-rh
|
||||
routing rules file.
|
||||
* Non-UTF8 properties are now escaped when they are exported on D-Bus.
|
||||
* NetworkManager-wait-online.service now starts NetworkManager.service
|
||||
if needed.
|
||||
* The MAC address for bond connections can be changed in nmtui.
|
||||
* Fixed dependency problems when setting the MTU of VLAN and master
|
||||
devices.
|
||||
* The systemd-resolved DNS plugin properly handles the DNS priority
|
||||
setting.
|
||||
* Fixed setting a DHCP timeout greater than 60 seconds (dhclient).
|
||||
* Fixed some memory leaks.
|
||||
* Many other bug fixes and improvements.
|
||||
|
||||
============================================
|
||||
NetworkManager-1.8
|
||||
Overview of changes since NetworkManager-1.6
|
||||
============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* Default routes set by devices that failed connectivity checks are now
|
||||
penalized with a higher metric
|
||||
* nmcli is now able to produce output more friendly for machine parsing
|
||||
* The slaves available at the time a master connection is activated are
|
||||
enslaved in a stable order, making the automatic MAC address for Bonding
|
||||
devices more predictable.
|
||||
* Hostname management is now more flexibly configured
|
||||
* Support for additional route options (pref-src, src, tos, window, cwnd,
|
||||
initcwnd, initrwnd, mtu, lock-window, lock-cwnd, lock-initcwnd, lock-initrwnd,
|
||||
and lock-mtu).
|
||||
* Fixed detection of EAP-FAST support in wpa_supplicant
|
||||
* Support for handling PINs for PKCS#11 tokens as secrets
|
||||
* GSM and CDMA connections now have a MTU property
|
||||
* An option to disable selected TLS versions during EAP phase 1 authentication
|
||||
* The 802.1x authentication timeout is now configurable to allow a faster
|
||||
fallback to other connections
|
||||
* Persist managed state of device until reboot. This improves seamless take over
|
||||
of a previously managed device after restart of NetworkManager.
|
||||
* Better handle devices that are externally managed by somebody else by
|
||||
consistently generating an in-memory connection to reflect the external
|
||||
state.
|
||||
* Expose SRIOV capability of a device on D-Bus and support configuring the
|
||||
number of virtual functions via NetworkManager.conf.
|
||||
* Support matching networking devices via new "driver:" device spec in
|
||||
NetworkManager.conf.
|
||||
* Introduced support for creating and managing dummy links
|
||||
* The teaming devices now support setting a hardcoded MAC address
|
||||
* Settings of bonding devices can now be modified on-the-fly, without the
|
||||
need to reactivate a connection
|
||||
* The failures to activate a connection now communicate better error
|
||||
responses to nmcli
|
||||
* Dropped dependency on libgudev
|
||||
* Reverse Path filtering is now disabled in multihoming configurations where
|
||||
it would interfere with legitimate network traffic
|
||||
* libcurl is used instead of libsoup for connectivity checking, resulting in
|
||||
a smaller dependency footprint
|
||||
* With DNS mode "rc-manager=symlink", don't write /etc/resolv.conf as
|
||||
a symlink if it already exists as a regular file.
|
||||
* Support attaching user-data in form of key-value pairs to connection profiles.
|
||||
* Fix accpeting fully qualified name for ipv4.dhcp-hostname setting.
|
||||
* Make NetworkManager more forgiving to failure to change the MAC address during
|
||||
scanning.
|
||||
* Many bug fixes and improvements
|
||||
|
||||
============================================
|
||||
NetworkManager-1.6
|
||||
Overview of changes since NetworkManager-1.4
|
||||
============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* Added support for managing the MACsec links. Requires support in
|
||||
wpa_supplicant (version newer than 2.6).
|
||||
* Support for configuration and discovery of Web Proxy settings with
|
||||
PacRunner service.
|
||||
* The ipv6.method=shared is now supported, utilizing DHCPv6 Prefix
|
||||
Delegation option to obtain prefixes for the interface.
|
||||
* Support for systemd-resolved local DNS forwarder backend.
|
||||
* The configuration is now read from /run/NetworkManager/conf.d as well.
|
||||
This is useful for handing over configuration discovered on system
|
||||
startup to NetworkManager.
|
||||
* The PPP manager can now be split into a separate package.
|
||||
* Added initial support for PKCS#11 tokens with 802.1x authentication.
|
||||
* Introduced Vala bindings for libnm.
|
||||
* NetworkManager would now keep most connections up on shutdown (except Wi-Fi
|
||||
connections, VPN connections and other kinds that can't be assumed on
|
||||
startup)
|
||||
* The checkpoint/restore connection can now also remove new connections and
|
||||
disconnect devices that were activated since the checkpoint was taken.
|
||||
* New connection.autoconnect_retries property that allows fine-tuning
|
||||
the autoconnect behavior.
|
||||
* Fix emission of NM-style PropertiesChanged signals and deprecate them
|
||||
for PropertiesChanged on "org.freedesktop.DBus.Properties" interface.
|
||||
* Change the meaning of unset "cloned-mac-address" settings from "permanent" to
|
||||
"preserve". This changes the default value and affects existing connections
|
||||
during upgrade that did not explicitly configure cloned-mac-address. This
|
||||
has the effect that externally configured MAC addresses are preserved
|
||||
by default instead of setting the permanent address (bgo#770611).
|
||||
* Avoid reading the permanent MAC address before the device is initialized
|
||||
by UDEV. This avoids a race where NetworkManager might detect the MAC
|
||||
address of the wrong interface.
|
||||
* The cloned.mac-address property can now be used with Bond and Bridge
|
||||
devices.
|
||||
* The ifcfg parsing code has been reworked for better compatibility with
|
||||
actual shell variable files.
|
||||
* nmtui now supports creating and editing IP tunnel connections.
|
||||
* The libnm client library now uses the D-Bus ObjectManager API that allows
|
||||
for quicker initialization of the clients.
|
||||
* nmtui now utilizes the asynchronous libnm client API to paralellize
|
||||
communication with the daemon, reducing the client startup time.
|
||||
* Ethernet devices now use "802-3.speed" and "802-3.duplex" properties to
|
||||
allow controlling overriding the negotiated link parameters.
|
||||
* Order in which IP addresses are configured is now preserved so that
|
||||
primary address is selected correctly.
|
||||
* Details of the DNS information obtained from the connections is now
|
||||
exposed on the D-Bus and can be inspected with nmcli.
|
||||
* Fixed race conditions when renaming interfaces, for example as done
|
||||
by UDEV for persistent interface naming. This could cause detecting
|
||||
devices as the wrong hardware type.
|
||||
* Added the support for DHCPV6_HOSTNAME and DHCPV6_SEND_HOSTNAME keys in
|
||||
ifcfg files that control "dhcp-hostname" and "dhcp-send-hostname"
|
||||
properties of the "ipv6" setting.
|
||||
* The stable-addressing for MAC address randomization and RFC7217 IPv6 stable
|
||||
privacy addressing can now be more flexibly configured using dynamic
|
||||
randomization seeds in "connection.stable-id".
|
||||
See "examples/nm-conf.d/30-anon.conf" for example use.
|
||||
* When the master of Team, Bridge and Bond devices is specified as a connection
|
||||
UUID, the ifcfg-rh plugin now writes the master connection's interface name
|
||||
into the ifcfg file for improved compatibility with the legacy network service.
|
||||
* Improve handling of MTU by resetting the previous MTU when the device deactivates
|
||||
and reset the MTU to a defined value on activation.
|
||||
* Improve tracking of parent devices for dependent devices like ip-tunnels, MACVLAN,
|
||||
VETH, VLAN, and VXLAN.
|
||||
* Many bug fixes and improvements
|
||||
|
||||
============================================
|
||||
NetworkManager-1.4
|
||||
Overview of changes since NetworkManager-1.2
|
||||
============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* The MAC address assigned to a device can now be set according to
|
||||
different policies: preserve, permanent, random, stable
|
||||
* NetworkManager now waits for IPv6 DAD to terminate before completing
|
||||
the activation
|
||||
* Added support for setting IPv6 tokenized interface identifiers
|
||||
through the 'ipv6.token' connection property
|
||||
* Added a 'Reload' D-Bus method to reload configuration and reapply
|
||||
DNS configuration
|
||||
* Added ability to create a configuration checkpoints and rolling back
|
||||
changes after a timeout.
|
||||
* NetworkManager now follows symlinks when accessing resolv.conf and
|
||||
rc-manager is set to 'file'
|
||||
* Added support for oFono as modem manager
|
||||
* The devices now exposes counters of transferred data
|
||||
* The 'may-fail' property of ipv4 and ipv6 settings is now respected
|
||||
more accurately
|
||||
* The timeout for requests of secrets to agents has been increased
|
||||
from 25 to 120 seconds
|
||||
* Name servers passed to dnsmasq now specify an egress interface to
|
||||
avoid problems with multiple active connections
|
||||
* Reverse DNS entries for IPv6 are now added to dnsmasq, and IPv4
|
||||
reverse entries now honor the network prefix
|
||||
* A new 'dns-priority' property of ipv4 and ipv6 settings can be used
|
||||
to tweak the order of servers in resolv.conf when multiple
|
||||
connections are active
|
||||
* configure script accepts --enable-{address,undefined}-sanitizer
|
||||
options to build NetworkManager with GCC sanitizers
|
||||
* The default resolv.conf manager can now be specified at build time
|
||||
using the --with-config-dns-rc-manager-default configure option
|
||||
* NetworkManager is now compiled with --gc-sections to reduce
|
||||
executable size
|
||||
* Added a new 'VPN_PLUGIN' logging domain
|
||||
* It is now possible to change the configuration currently applied on
|
||||
a device with 'nmcli device modify' and 'nmcli device reapply'
|
||||
* nmcli invoked without parameters shows an overview of the current
|
||||
network configuration
|
||||
* The 'nmcli connection add' syntax has been extended and is now
|
||||
possible to pass properties (e.g. 'ipv4.dns') along with aliases
|
||||
* nmtui now returns to initial menu after a sub-form exits
|
||||
* Improved bash autocompletion for nmcli
|
||||
* Now devices are disconnected before the system suspends, executing
|
||||
dispatcher scripts. This allows external applications to be notified
|
||||
of the change in connectivity
|
||||
* Dispatcher scripts are now called also when connectivity status
|
||||
changes
|
||||
* Many other fixes and improvements
|
||||
|
||||
============================================
|
||||
NetworkManager-1.2
|
||||
Overview of changes since NetworkManager-1.0
|
||||
============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* MAC addresses during Wi-Fi access point scanning are now randomized
|
||||
if wpa_supplicant supports PreassocMacAddr.
|
||||
* Added an option to enable random MAC addresses for association to Wi-Fi access
|
||||
point (defaults to disabled). Controlled with 'wifi.mac-address-randomization'
|
||||
property (MAC_ADDRESS_RANDOMIZATION key in ifcfg files). Requires support from
|
||||
wpa_supplicant.
|
||||
* Wi-Fi scanning now utilizes wpa_supplicant's AP list.
|
||||
* Added support for Wi-Fi powersave, configured with POWERSAVE key in ifcfg
|
||||
files.
|
||||
* Added support for creation of more types of software devices: tun & tap,
|
||||
macvlan, vxlan and ip tunnels (ipip, gre, sit, ip6ip6 and ipip6).
|
||||
* The software devices (bond, bridge, vlan, team, ...) can now be stacked
|
||||
arbitrarily. The nmcli interface for creating master-slave relationships
|
||||
has been significantly improved by the use of 'master' argument to
|
||||
all link types.
|
||||
* RFC7217 stable privacy addressing is now used by default to protect from
|
||||
address-based host tracking. The IPv6 addressing mode is configured with
|
||||
IPV6_ADDR_GEN_MODE key in ifcfg files.
|
||||
* Improved route management code to avoid clashes between conflicting
|
||||
routes in multiple connections.
|
||||
* Refactored platform code resulting in more robust interface to platform,
|
||||
less overhead and reduced memory footprint.
|
||||
* Improved interoperability with other network management tools. The
|
||||
externally created software devices are not managed until they're
|
||||
activated.
|
||||
* The Device instances now exist for all software connections and the platform
|
||||
devices are now only created when the device is activated. This makes it
|
||||
possible for connections with device of same name not to clash unless
|
||||
they're activated concurrently. The links are now not unnecessarily present
|
||||
unless the connection is active, avoiding pollution of the link namespace.
|
||||
* NetworkManager now correctly manages connectivity in namespace-based
|
||||
containers such as LXC and Docker.
|
||||
* Support for configuring ethernet Wake-On-Lan has been added.
|
||||
* Added LLDP listener functionality and related CLI client commands. Enabled via
|
||||
LLDP option in ifcfg files.
|
||||
* CLI secret agent has been extended with support for VPN secrets.
|
||||
* The command line client now utilizes colors for its output.
|
||||
* The command line client now sorts the devices and properties for better
|
||||
clarity.
|
||||
* Numerous improvements to Bash command completion for nmcli.
|
||||
* NetworkManager relies on less external libraries. The use of dbus-glib
|
||||
has been replaced with gio's native D-Bus support and libnl-route is no
|
||||
longer used.
|
||||
* Dependency on avahi-autoipd has been dropped. Native IPv4 link-local
|
||||
addressing configuration based on systemd network library is now used
|
||||
instead.
|
||||
* Hostname is now managed via systemd-hostnamed on systemd-based systems.
|
||||
* Management of resolv.conf can be changed at runtime, private resolv.conf
|
||||
is always written in /run.
|
||||
* NetworkManager can now write DNS options to resolv.conf.
|
||||
* Added an option to enable the old-fashioned /etc/resolv.conf handling
|
||||
(using a symlink)
|
||||
* Updated version of systemd network library used for internal DHCP and
|
||||
IPv4 link-local support.
|
||||
* Support for event logging via audit subsystem has been added.
|
||||
* Support for native logging via systemd-journald has been added taking
|
||||
advantage of its structured logging.
|
||||
* Live reconfiguration of IP configuration after changing the settings without
|
||||
reactivation of the device with "nmcli device reapply" command and via
|
||||
D-Bus API.
|
||||
* The API for VPN plugins now supports multiple simultaneous connections.
|
||||
Most popular VPN plugins have been updated to support this functionality.
|
||||
* The libnm library now provides API to access VPN service definitions.
|
||||
* New DHCP_FQDN key in ifcfg files to configure the full FQDN to be sent to
|
||||
the DHCP servers.
|
||||
* The timeout for DHCP requests can now be modified using the
|
||||
'ipv4.dhcp-timeout' property.
|
||||
* Added multicast_snooping option to BRIDGING_OPTS ifcfg key.
|
||||
* Added support for detecting duplicate IPv4 addresses, with a timeout
|
||||
configurable through the ipv4.dad-timeout connection property.
|
||||
* Fixed a race condition that could potentially lead to unauthorized access
|
||||
to connection secrets (CVE-2016-0764).
|
||||
* dnsmasq configuration for shared connections can now be extended by
|
||||
placing custom files in /etc/NetworkManager/dnsmasq-shared.d/.
|
||||
* Generic devices are no longer assumed unless explicitly requested by
|
||||
user.
|
||||
* The reorder-header VLAN flag setting is now honored; to keep backwards
|
||||
compatibility in behavior, an existing REORDER_HDR=0 ifcfg-rh key is
|
||||
ignored; the flag must be disabled with VLAN_FLAGS=NO_REORDER_HDR.
|
||||
* NetworkManager now checks the connection data from client for validity
|
||||
and gracefully handles unknown properties in client. This improves
|
||||
interoperability between the server and clients of different versions.
|
||||
* The activation of a VLAN device with a virtual parent that is inactive
|
||||
now results in a parent being activated first.
|
||||
* The server name used with 802.1x authentication can now be constrained
|
||||
to a particular domain suffix (CVE-2006-7246).
|
||||
* Fair amount of bugs was fixed and robustness was generally improved.
|
||||
|
||||
The following features were backported to 1.0.x releases from 1.0.0 to 1.0.10
|
||||
are also present in NetworkManager-1.2:
|
||||
|
||||
* Added support for handling VPN secrets to nmtui and nmcli agent.
|
||||
* The team devices can now properly be enslaved to bridges.
|
||||
* Failed DHCP attempts for assumed connections are now retried after
|
||||
a timeout.
|
||||
* Default wired connection is now created after udev registers the device.
|
||||
* Support for Bluetooth DUN devices with Bluez 5 has been fixed.
|
||||
* The 'ipv6.ignore-auto-dns' property is now properly honored making it
|
||||
possible to override automatically obtained name servers.
|
||||
* Invalid permanent MAC addresses as reported by some devices are now
|
||||
ignored.
|
||||
* Device links reported by more recent versions of Linux kernel that reside
|
||||
in different network namespaces are no longer confused with links in
|
||||
the namespace NetworkManager runs in.
|
||||
* MAC address changes of bond or team devices are now properly propagated
|
||||
to VLANs created on the device.
|
||||
* Fixed error handling for teaming devices with invalid configuration.
|
||||
* Wi-Fi AP list is now updated correctly after AP mode has been used.
|
||||
* The error handling for VPN secret agents is now significantly more robust.
|
||||
* Detection of s390 CTC devices now works properly.
|
||||
* A GATEWAY key in in /etc/sysconfig/network now no longer affects
|
||||
non-static connections.
|
||||
* Added support for IPv6-only VPN connections.
|
||||
* The systemd service now uses HUP signal to reload configuration.
|
||||
* Change VLAN default flags to set REORDER_HDR for new connections.
|
||||
* nmtui is now able to ignore automatically configured routes.
|
||||
* Allow setting IPv6 and PPP settings for GDM and CDMA connections via
|
||||
nmcli.
|
||||
* Added support for adding ADSL connections in nmcli.
|
||||
* Improved capture portal detection.
|
||||
* Default route through Wi-Fi connection is now preferred to Mobile
|
||||
Broadband if both are available.
|
||||
* Expose a flag to determine whether a particular connection is metered
|
||||
via API and client tools. Configurable in ifcfg with CONNECTION_METERED
|
||||
key.
|
||||
* Add support for locking connections to a channel within a particular
|
||||
band.
|
||||
* Add support for configuring Wake-on-LAN capabilitites.
|
||||
* Allow overriding the MTU for team device.
|
||||
* The MTU setting from an IPv6 neighbor discovery Router Advertisements is
|
||||
now ignored if applying it would result in invalid configuration.
|
||||
* Some configuration options can now be changed without restarting the
|
||||
daemon. Notably, this applies to 'dns', 'connectivity' and
|
||||
'ignore-carrier' settings.
|
||||
* The connection activation was made more robust. If an active connection
|
||||
is reactivated, the device it is active on takes precedence. If an attempt
|
||||
is made to activate a connection on a different device than the one it is
|
||||
active on, the activation proceeds removing the connection from the active
|
||||
device.
|
||||
* The device specifiers in configuration files now support negation via
|
||||
'except:' match.
|
||||
* Devices that only have IPv6 link-local address are no longer assumed to
|
||||
be connected.
|
||||
* nmcli now provides hints and tab-completion for enumeration properties.
|
||||
* If the IPv6 interface tokens are set they are honored when creating an
|
||||
interface identifier for IPv6 addressing.
|
||||
* NetworkManager now maintains correct routing configuration when multiple
|
||||
interfaces are connected to the same network.
|
||||
* The management of devices can now be controlled with udev rules. The veth
|
||||
devices as well as the virtual Ethernet devices of various
|
||||
virtualization tools (VMWare, VirtualBox, Parallels Workstation) are
|
||||
now ignored by default.
|
||||
* The IPv6 privacy extensions are now enabled by default and handling of
|
||||
the ip6-privacy sysctl has been improved.
|
||||
* Activating a Bond, Bridge or Team device can now optionally activate the
|
||||
slave connections as well. The behavior is controlled with
|
||||
'connection.autoconnect-slaves' property and AUTOCONNECT-SLAVES key in
|
||||
ifcfg files.
|
||||
* The platform support code has been refactored, resulting in better
|
||||
scalability in large configurations.
|
||||
* Changes to network interfaces configuration done outside NetworkManager
|
||||
are now picked up and exposed to the user via NetworkManager API and tools.
|
||||
* A connection can now optionally leave externally configured default route
|
||||
in place instead of overriding it. The behavior is controlled with
|
||||
'ipv4.never-default' and 'ipv6.never-default' properties.
|
||||
* nmcli allows multiple devices for 'nmcli device disconnect/delete'.
|
||||
* Firewall zone is added to firewalld for device-based VPN connections too.
|
||||
* Wi-Fi devices now indicate support for 2GHz and 5GHz frequencies
|
||||
* "nmcli device" output now indicates physical port ID
|
||||
* New config items added to the 'ifcfg-rh' plugin:
|
||||
- IPV4_ROUTE_METRIC and IPV6_ROUTE_METRIC
|
||||
- DEVTIMEOUT
|
||||
- IPADDR and PREFIX are now supported for specifying address ranges of
|
||||
shared IPv4 connections
|
||||
* Dispatcher scripts now get a CONNECTION_FILENAME variable with the path
|
||||
to the configuration file for the connection
|
||||
* An example dispatcher script that is able to apply complex routing rules
|
||||
(such as setting up policy-based routing) for 'ifcfg-rh' connections was
|
||||
added to examples/dispatcher/.
|
||||
* 'mode' key of Bond device options property now accepts numeric values
|
||||
* Connection attempts for devices without carrier on startup now wait for
|
||||
carrier to appear within a short timeout instead of failing
|
||||
immediately. This makes system startup more robust.
|
||||
* Bridge connectivity is now properly restored on resume from suspend
|
||||
* The D-Bus name is acquired earlier during the daemon startup. This makes
|
||||
it possible for the systemd service manager to optimize the service
|
||||
startup so that services that require networking are activated sooner
|
||||
contributing to faster system start up time.
|
||||
* A lot of memory leak problems were fixed, resulting in reduced memory usage.
|
||||
Many of them were discovered as a result of improvements in use of
|
||||
Valgrind in the testing infrastructure.
|
||||
* Management of 'teamd' daemon instances for Team devices is now more robust.
|
||||
* The 'dnsmasq' daemon respawns when it terminates and it is configured for
|
||||
management of DNS resolver configuration
|
||||
* Hostnames that are not fully qualified are no longer sent to a DHCPv6
|
||||
server for a dynamic DNS update
|
||||
* Connection UUIDs are now checked for uniqueness when connection
|
||||
configurations are read
|
||||
* Receipt of a NDP Router Advertisement can no longer lower the IPv6 hop
|
||||
limit (CVE-2015-2924)
|
||||
|
||||
===============================================
|
||||
NetworkManager-1.0
|
||||
Overview of changes since NetworkManager-0.9.10
|
||||
===============================================
|
||||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* A new 'libnm' GObject-based client library to replace libnm-util/libnm-glib
|
||||
- IP address, IP route, hardware address, and other properties are now
|
||||
represented as strings
|
||||
- Based on GIO's GDBus bindings instead of dbus-glib
|
||||
- Uses modern GObject APIs including GAsyncResult and GVariant
|
||||
- For more information see https://wiki.gnome.org/Projects/NetworkManager/libnm
|
||||
* Devices and VPN connections now have individual default routes. Priorities
|
||||
are handled through configurable route metrics.
|
||||
* nmcli now supports password requests and PolicyKit authorizations
|
||||
* A faster, lighter-weight (though less capable) internal DHCP client has been
|
||||
added and may be selected with the "dhcp=internal" option. It supports
|
||||
fewer DHCP options and does not yet support DHCPv6.
|
||||
* A new 'configure-and-quit=yes' option has been added for environments with
|
||||
less dynamic network configuration
|
||||
* When running on 3.17 and later kernels, NetworkManager handles IPv6LL address
|
||||
assignment to ensure that IPv6 connectivity is not enabled until
|
||||
intentionally configured by the user
|
||||
* NetworkManager no longer causes the nl80211 kernel module to be loaded on
|
||||
systems with no Wi-Fi devices
|
||||
* Bluetooth DUN support now works with Bluez 5.x
|
||||
* VPN connections can now persist across link changes and suspend/resume if
|
||||
their VPN plugin supports this feature
|
||||
* A new 'ibft' settings plugin has been added to support firmware-based
|
||||
iBFT/iSCSI configurations. This functionality has been moved to 'ibft'
|
||||
from the 'ifcfg-rh' plugin.
|
||||
* IPv6 router advertisement MTUs are now respected
|
||||
* NetworkManager no longer requires polkit libraries at runtime when Polkit
|
||||
support is enabled, and Polkit can be disabled at build time too
|
||||
* Automatically created connections are now deleted when their device goes away
|
||||
* 'nmcli dev connect' now attempts to create a connection if none exists
|
||||
* Manually configured static IPv6 configuration is kept even if SLAAC fails
|
||||
* Manpages for the 'keyfile' and 'ifcfg-rh' plugins now describe their
|
||||
configuration syntax and available options
|
||||
* WWAN connections now support IPv6 if the modem and provider support IPv6
|
||||
* Software devices (bridge, bond, team, etc) can now be deleted from the D-Bus
|
||||
API or with nmcli
|
||||
* The manpages, documentation, and API annotations have received many cleanups
|
||||
* Externally created virtual interfaces are no longer managed by NetworkManager
|
||||
until they are set "up" or activated via nmcli
|
||||
* Team device support is now an optional plugin
|
||||
|
||||
|
||||
==============================================
|
||||
NetworkManager-0.9.10
|
||||
Overview of changes since NetworkManager-0.9.8
|
||||
|
|
@ -12,7 +813,7 @@ This is a new stable release of NetworkManager. Notable changes include:
|
|||
* Added support for Data Center Bridging (DCB) and FibreChannel over Ethernet (FCoE)
|
||||
* IPv6 autoconfiguration is now done in userspace with libndp instead of the kernel
|
||||
* The D-Bus daemon is no longer required for root-only operation
|
||||
* WiFi, ADSL, WWAN, and Bluetooth are now optional plugins, reducing install size
|
||||
* Wi-Fi, ADSL, WWAN, and Bluetooth are now optional plugins, reducing install size
|
||||
* Added support for Infiniband Partitions
|
||||
* Network connection files are no longer watched by default, use "nmcli con reload"
|
||||
to notice changes made externally or set "monitor-connection-files=true" in
|
||||
|
|
@ -41,7 +842,7 @@ This is a new stable release of NetworkManager. Notable changes include:
|
|||
* The dispatcher timeout has increased to 10 minutes, and new "pre-up" and
|
||||
"pre-down" events have been added which block activation until complete
|
||||
* NetworkManager no longer prevents Wake-on-LAN functionality from working
|
||||
* PPPoE now requires userland "rp-pppoe" to work around kernel bugs with
|
||||
* PPPoE now requires userland "rp-pppoe" to work around kernel bugs
|
||||
that prevent detecting server-side termination of the PPP link
|
||||
* An ARP announcement is now sent after IPv4 addresses are configured
|
||||
* Added a DNS plugin for dnssec-trigger for better DNSSEC operation
|
||||
|
|
@ -69,25 +870,27 @@ This is a new stable release of NetworkManager. Notable changes include:
|
|||
* Fix crash in dnsmasq plugin when no nameservers were present
|
||||
* Add support for 4G LTE network modes
|
||||
* Fix signal handling when daemonizing at startup
|
||||
* Don't autoconnect to WiFi networks that have never successfully connected
|
||||
* Only request new WiFi secrets during the initial association or when the
|
||||
* Don't autoconnect to Wi-Fi networks that have never successfully connected
|
||||
* Only request new Wi-Fi secrets during the initial association or when the
|
||||
secrets are known to be wrong, not every time the connection randomly fails
|
||||
* Add capability to autoconnect VPN connections when a parent connection succeeds
|
||||
* Add configure-time option for "permissive" system connection editing policy
|
||||
* Various libnm-glib fixes for asynchronous usage
|
||||
* Fix gateway handling when given with secondary IP addresses
|
||||
* Optionally listen to systemd for suspend/resume events instead of UPower
|
||||
* Fix 'seen-bssids' property when retrieving WiFi connections via D-Bus
|
||||
* Add support for AP-mode WiFi hotspots (instead of just Ad-Hoc)
|
||||
* Fix 'seen-bssids' property when retrieving Wi-Fi connections via D-Bus
|
||||
* Add support for AP-mode Wi-Fi hotspots (instead of just Ad-Hoc)
|
||||
* Add a "slaves" property to Bond devices
|
||||
* Add support for ModemManager 0.7/0.8
|
||||
* Allow more human-readable formatting of IP address in keyfile connections
|
||||
* Drop support for dhclient v3
|
||||
* Move PPP support to a separate plugin, so that it can be packaged separately
|
||||
and reduce the dependency on the core package.
|
||||
* Add support for DHCPv6 server-side Dynamic DNS
|
||||
* Add support for bridge master devices and bridge ports
|
||||
* Fix canceling secrets requests in GUI agents
|
||||
* Always enable Proactive Key Caching (PKC, also called OKC) for WPA Enterprise
|
||||
WiFi configurations
|
||||
Wi-Fi configurations
|
||||
|
||||
|
||||
==============================================
|
||||
|
|
@ -100,12 +903,12 @@ This is a new stable release of NetworkManager. Notable changes include:
|
|||
* Many libnm-glib fixes, including crashes when NetworkManager restarts
|
||||
* Enhanced IPv6 stability and compatibility
|
||||
* Fix regression in carrier handling for devices that don't support carrier detect
|
||||
* Add ability to connect to new WiFi networks from nmcli
|
||||
* Add ability to connect to new Wi-Fi networks from nmcli
|
||||
* Add native support for ADSL modems using PPPoE or PPPoATM
|
||||
* Reduce number of changes made to DNS information during connection setup
|
||||
* Add support for IPv6-enabled VPN connections
|
||||
* Add device driver version, firmware version, and autoconnect properties to D-Bus API
|
||||
* Add on-demand WiFi scan support
|
||||
* Add on-demand Wi-Fi scan support
|
||||
* Fix IPv6 default gateway handling for DHCPv6
|
||||
* Add Vala language bindings
|
||||
* Fix various crashes and issues in the ifcfg-rh system settings plugin
|
||||
|
|
@ -123,12 +926,12 @@ Overview of changes since NetworkManager-0.9.2
|
|||
|
||||
This is a new stable release of NetworkManager. Notable changes include:
|
||||
|
||||
* Better handling of WiFi devices via nl80211 when available (instead of WEXT)
|
||||
* Better handling of Wi-Fi devices via nl80211 when available (instead of WEXT)
|
||||
* IP configuration is now non-blocking; waiting for IPv6 RA no longer blocks
|
||||
the device from activating if IPv4 is ready and vice versa
|
||||
* Addded support for firewall "zones" via FirewallD
|
||||
* Added support for firewall "zones" via FirewallD
|
||||
* Added basic support for bonded interfaces
|
||||
* WiFi connections are no longer locked to a specific MAC address if they are
|
||||
* Wi-Fi connections are no longer locked to a specific MAC address if they are
|
||||
"locally administered" addresses (ie, 02:::::)
|
||||
* New state change reasons have been added for mobile broadband PIN errors
|
||||
* Agent-owned secrets are now sent to agents for newly created connections
|
||||
|
|
@ -153,7 +956,7 @@ This is a new stable release of NetworkManager. Notable changes include:
|
|||
* Enable out-of-the-box IPv6 connectivity by allowing IPv4 to fail if IPv6 succeeds
|
||||
* Allow proxying of DNSSEC data when using the dnsmasq local caching nameserver plugin
|
||||
* Add support for multiple domain names sent from VPN plugins
|
||||
* Removed support for WiFi Ad-Hoc WPA connections due to kernel bugs
|
||||
* Removed support for Wi-Fi Ad-Hoc WPA connections due to kernel bugs
|
||||
|
||||
|
||||
==============================================
|
||||
|
|
@ -272,8 +1075,8 @@ This is a new stable release of NetworkManager. Notable changes include:
|
|||
* Native local caching nameserver support using dnsmasq
|
||||
* Automatically detect addition and removal of new VPN plugins
|
||||
* Support for handling suspend/resume signals from UPower
|
||||
* Ensure users are allowed to enable/disable WiFi and networking
|
||||
* Ensure WiFi enable state is perserved across reboot and suspend
|
||||
* Ensure users are allowed to enable/disable Wi-Fi and networking
|
||||
* Ensure Wi-Fi enable state is perserved across reboot and suspend
|
||||
* Better handling of /etc/hosts and preservation of custom hostnames
|
||||
* Support for the systemd session management service
|
||||
* Better handling of 'keyfile' system connection errors
|
||||
|
|
@ -374,13 +1177,13 @@ Overview of changes since NetworkManager-0.5.0
|
|||
* Don't drop the last scanned AP (Dan Williams)
|
||||
* Broadcast state change when disconnected (Robert Love)
|
||||
* The Slackware backend now builds (Nico)
|
||||
* Don't install unsued config files (Dan Williams)
|
||||
* Don't install unused config files (Dan Williams)
|
||||
* Add a test for libnm_glib_unregister_callback (Christopher Aillon)
|
||||
* Requires wireless-tools 28pre9 (Christopher Aillon)
|
||||
|
||||
* nm-applet
|
||||
* Use g_get_host_name () if we've got it (Christopher Aillon)
|
||||
* Fix an unitialized variable (Robert Love)
|
||||
* Fix an uninitialized variable (Robert Love)
|
||||
* Fix sensitivity of VPN items (Robert Love)
|
||||
|
||||
|
||||
|
|
@ -436,7 +1239,7 @@ Overview of changes since NetworkManager-0.4.1
|
|||
default action.
|
||||
* Fix icon animation smoothness
|
||||
* Display more data in the Connection Information dialog
|
||||
(Robert Love)
|
||||
(Robert Love).
|
||||
|
||||
|
||||
============================================
|
||||
|
|
|
|||
23
README
23
README
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
******************
|
||||
2008-12-11: NetworkManager core daemon has moved to git.freedesktop.org!
|
||||
NetworkManager core daemon has moved to gitlab.freedesktop.org!
|
||||
|
||||
git clone git://git.freedesktop.org/git/NetworkManager/NetworkManager.git
|
||||
git clone https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
|
||||
******************
|
||||
|
||||
|
||||
|
|
@ -45,7 +44,7 @@ settings service" and the "user settings service" store connection information
|
|||
and provide these to NetworkManager, also via D-Bus. Each settings service
|
||||
can determine how and where it persistently stores the connection information;
|
||||
for example, the GNOME applet stores its configuration in GConf, and the system
|
||||
settings service stores it's config in distro-specific formats, or in a distro-
|
||||
settings service stores its config in distro-specific formats, or in a distro-
|
||||
agnostic format, depending on user/administrator preference.
|
||||
|
||||
A variety of other system services are used by NetworkManager to provide
|
||||
|
|
@ -75,11 +74,15 @@ aren't expecting the dynamic requests that NetworkManager and wpa_supplicant
|
|||
make. Driver bugs should be filed in the bug tracker of the distribution being
|
||||
run, since often distributions customize their kernel and drivers.
|
||||
|
||||
Sometimes, it really is NetworkManager's fault. If you think that's the case,
|
||||
please file a bug at http://bugzilla.gnome.org and choose the NetworkManager
|
||||
component. Attaching the output of /var/log/messages or /var/log/daemon.log
|
||||
(wherever your distribution directs syslog's 'daemon' facility output) is often
|
||||
very helpful, and (if you can get) a working wpa_supplicant config file helps
|
||||
enormously.
|
||||
Sometimes, it really is NetworkManager's fault. If you think that's
|
||||
the case, please file a bug at:
|
||||
|
||||
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues
|
||||
|
||||
Attaching NetworkManager debug logs from the journal (or wherever your
|
||||
distribution directs syslog's 'daemon' facility output, as
|
||||
/var/log/messages or /var/log/daemon.log) is often very helpful, and
|
||||
(if you can get) a working wpa_supplicant config file helps
|
||||
enormously. See the logging section of file
|
||||
contrib/fedora/rpm/NetworkManager.conf for how to enable debug logging
|
||||
in NetworkManager.
|
||||
|
|
|
|||
89
TODO
89
TODO
|
|
@ -18,8 +18,8 @@ of each device's state. Unfortunately that requires two things:
|
|||
The first is the largest obstacle, but ideally we implement this and enable it
|
||||
when we have the required glib and libsoup versions available. One other
|
||||
complication is that this checking should be done during the
|
||||
NM_DEVICE_STATE_IP_CHECK phase (along with other operations like WiFi hotspot
|
||||
auto-login) while the current checks are done globally in nm-manager.c, so
|
||||
NM_DEVICE_STATE_IP_CHECK phase (along with other operations like Wi-Fi hotspot
|
||||
auto-login) while the current checks are done globally in nm-manager.c, so
|
||||
keeping both code paths might be complex.
|
||||
|
||||
But ideally, once the device has successfully gotten an IPv4 or IPv6 address, it
|
||||
|
|
@ -38,7 +38,7 @@ based on it and the device's state.
|
|||
|
||||
To allow for "pre-down" scenarios, this state should be implemented before a
|
||||
device is taken down while it still has connectivity. If the device is
|
||||
taken down because it's ethernet carrier was dropped, or because the WiFi
|
||||
taken down because its ethernet carrier was dropped, or because the WiFi
|
||||
connection was terminated by the supplicant, this state is pointless and should
|
||||
be skipped. But if the user requested a manual "disconnect", or NM is dropping
|
||||
connections on exit, etc, then this state should be entered. In the future
|
||||
|
|
@ -97,7 +97,7 @@ same MAC address, the connection with the most recent timestamp should be
|
|||
preferred.
|
||||
|
||||
Similarly, if the probing/listening process detects 802.1x frames the device
|
||||
should be marked as requring 802.1x authentication until the carrier drops.
|
||||
should be marked as requiring 802.1x authentication until the carrier drops.
|
||||
This would be accomplished by adding a new property to the NMDeviceEthernet
|
||||
object and exporting that property through the
|
||||
introspection/nm-device-ethernet.xml file. This would allow clients like
|
||||
|
|
@ -109,10 +109,10 @@ successfully connect to this network.
|
|||
* VPN re-connect (bgo #349151)
|
||||
|
||||
NM should remember whether a VPN was connected if a connection disconnects
|
||||
(like WiFi drops out or short carrier drop) or if the laptop goes to sleep.
|
||||
(like Wi-Fi drops out or short carrier drop) or if the laptop goes to sleep.
|
||||
Upon reconnect, if the same Connection is again active, the previously
|
||||
connected VPN should be activated again as well. Basically, don't just drop
|
||||
the VPN because WiFi choked for 10 seconds, but reconnect the VPN if it was
|
||||
the VPN because Wi-Fi choked for 10 seconds, but reconnect the VPN if it was
|
||||
connected before the drop.
|
||||
|
||||
|
||||
|
|
@ -123,11 +123,7 @@ pseudo-ethernet device to obtain addressing information. This is not currently
|
|||
possible, but NM already has all the code for DHCP. Thus, a new "method"
|
||||
key should be defined in include/NetworkManagerVPN.h to allow for DHCP to
|
||||
be performed if the VPN service daemon requests it in the IP4Config or IP6Config
|
||||
signals. A patch here:
|
||||
|
||||
http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?h=vpn-ip-method
|
||||
|
||||
shows that. In nm-vpn-connection.c, upon receipt of the D-Bus Ip4Config signal
|
||||
signals. In nm-vpn-connection.c, upon receipt of the D-Bus Ip4Config signal
|
||||
from the VPN plugin, NetworkManager would inspect the "method" property of the
|
||||
ip4 config dictionary. If that property was present and set to "auto" then
|
||||
DHCP would be started using the network interface returned in the dict. The
|
||||
|
|
@ -235,7 +231,7 @@ proceeds with the connection.
|
|||
|
||||
NM sends the correct wpa_supplicant config for WPS to the supplicant, and waits
|
||||
for the connection to occur. WPS can only be used the *first* time, so after a
|
||||
first successfull connection, NM must request the actual hexadecimal PSK from
|
||||
first successful connection, NM must request the actual hexadecimal PSK from
|
||||
wpa_supplicant via D-Bus, and store that PSK in the connection, clear any WPS
|
||||
PIN code from the connection, and save the connection to backing storage.
|
||||
|
||||
|
|
@ -245,65 +241,6 @@ because the user has no physical access to the router itself, but has been given
|
|||
as passphrase/PSK instead.
|
||||
|
||||
|
||||
* Proxies
|
||||
|
||||
HTTP and other proxies are per-connection configuration. It's highly unlikely
|
||||
that the same proxy you need to use at work is used at home or in a coffee shop.
|
||||
Thus, it makes sense that which proxy settings to use should be updated when
|
||||
network connections change. NetworkManager is a perfect place to do this since
|
||||
it tracks which network connections are active, and it already queries the
|
||||
network for automatic proxy configuration via DHCP and WPAD.
|
||||
|
||||
However, proxy handling is complicated and may require use of Javascript to
|
||||
parse PAC files provided by WPAD, and this is not something NetworkManager
|
||||
should do itself. Instead, that should be left to "proxy handlers", or external
|
||||
utilities like libproxy or pacrunner that take raw proxy information, parse it,
|
||||
and tell applications what proxy server to use for a specific network resource.
|
||||
NetworkManager should provide all the proxy information it can find to these
|
||||
external proxy handlers via the D-Bus interface and dispatcher scripts.
|
||||
|
||||
We should add a new NMSetting subclass called NMSettingProxy that holds
|
||||
necessary proxy configuration. The properties of this setting should be a
|
||||
superset of what is provided in the Firefox proxy configuration screen and the
|
||||
various desktop environment proxy configuration tools like the GNOME Network
|
||||
Proxy control panel; this should include at a minimum:
|
||||
|
||||
method: "auto", "manual", "none"
|
||||
default-proxy: string
|
||||
default-proxy-port: uint
|
||||
default-always: boolean (use default proxy for all protocols)
|
||||
ssl-proxy: string
|
||||
ssl-proxy-port: uint
|
||||
ftp-proxy: string
|
||||
ftp-proxy-port: uint
|
||||
socks-proxy: string
|
||||
socks-proxy-port: uint
|
||||
socks-version: uint, either 4 or 5
|
||||
no-proxy-for: array of strings (things not to use the proxy for, ie ".foobar.com",
|
||||
"192.168.0.1/24", an IPv6 address, etc)
|
||||
pac-url: string (URL of PAC file, overrides DHCP-provided WPAD value)
|
||||
(FIXME: proxy authentication? do we need separate user/pass properties for
|
||||
each protocol type? should NM handle proxy auth or should it be punted
|
||||
to each application?)
|
||||
|
||||
After completing IP configuration but still during the NM_DEVICE_STATE_IP_CONFIG
|
||||
activation stage, NetworkManager would merge the automatically supplied proxy
|
||||
configuration (from DHCP's WPAD option) with user-provided overrides from the
|
||||
NMSettingProxy export the resulting proxy configuration via D-Bus and dispatcher
|
||||
scripts. The 'default' connection's proxy configuration would be preferred, so
|
||||
we'd have to update proxy configuration from nm-policy.c the same time we update
|
||||
DNS information and the default route.
|
||||
|
||||
Merged proxy information should be exposed in two places. First, it should be
|
||||
exported over D-Bus as a property of the org.freedesktop.NetworkManager.Device
|
||||
interface. This property should be named "ProxyInfo" and should have the
|
||||
D-Bus signature "a{sv}" (eg, dictionary) and should mirror the properties from
|
||||
the NMSettingProxy object.
|
||||
|
||||
Second, it should be exported via the dispatcher to dispatcher scripts when
|
||||
with the "up" and "down" events.
|
||||
|
||||
|
||||
* Better Tablet/Mobile Behavior
|
||||
|
||||
There are a few components to this:
|
||||
|
|
@ -311,7 +248,7 @@ There are a few components to this:
|
|||
1) kernel driver and hardware capabilities: most mobile devices use periodic
|
||||
background scanning to quickly determine whether a known SSID is available and
|
||||
notify the connection manager to connect to it. This typically requires special
|
||||
capabilities and good powersave/sleep support from the WiFi kernel driver.
|
||||
capabilities and good powersave/sleep support from the Wi-Fi kernel driver.
|
||||
There is a background scanning API in nl80211, but we need to determine how many
|
||||
SSIDs each driver allows for background scanning, and based on that number, give
|
||||
the driver the most recent N SSIDs. We still need to periodically wake the
|
||||
|
|
@ -346,10 +283,10 @@ connection process.
|
|||
2) single-device-at-a-time with overlapping connections: this is also probably
|
||||
the best route to go for desktop use-cases as well. Instead of bringing all
|
||||
available connections up, only bring up the "best" connection at any given
|
||||
time based on the current priority list (which is rougly Ethernet > WiFi >
|
||||
3G/Bluetooth/WiMAX). However, to ensure seamless connectivity, when one
|
||||
connection begins to degrade, the next-best connection should be started before
|
||||
the current one is terminated, such that there is a small amount of overlap.
|
||||
time based on the current priority list (which is roughly Ethernet > Wi-Fi >
|
||||
3G/Bluetooth). However, to ensure seamless connectivity, when one connection
|
||||
begins to degrade, the next-best connection should be started before the
|
||||
current one is terminated, such that there is a small amount of overlap.
|
||||
Consequently the same behavior should be used when a better connection becomes
|
||||
available. This behavior should be suspended when special connections like
|
||||
Internet Connection Sharing ones are started, where clearly the priorities
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ PKG_NAME=NetworkManager
|
|||
|
||||
(test -f $srcdir/configure.ac \
|
||||
&& test -f $srcdir/src/main.c) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
printf "**Error**: Directory "\`$srcdir\'" does not look like the" >&2
|
||||
echo " top-level $PKG_NAME directory" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
@ -28,5 +28,5 @@ AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose
|
|||
|
||||
cd $olddir
|
||||
if test -z "$NOCONFIGURE"; then
|
||||
exec $srcdir/configure --enable-maintainer-mode "$@"
|
||||
exec $srcdir/configure --enable-maintainer-mode --enable-more-warnings=error --enable-gtk-doc --enable-introspection "$@"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
# do not edit this file, it will be overwritten on update
|
||||
|
||||
# The fact that this device is driven by libertas is not currently exposed
|
||||
# in the sysfs tree..?
|
||||
KERNEL=="msh*", SUBSYSTEM=="net", DRIVERS=="usb", ATTRS{idVendor}=="1286", ATTRS{idProduct}=="2001", ENV{ID_NM_OLPC_MESH}="1"
|
||||
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
SUBDIRS = . tests
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I${top_srcdir}/include \
|
||||
-I${top_srcdir}/libnm-core \
|
||||
-I${top_builddir}/libnm-core \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(DBUS_CFLAGS) \
|
||||
-DNETWORKMANAGER_COMPILATION \
|
||||
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
|
||||
-DNMCONFDIR=\"$(nmconfdir)\" \
|
||||
-DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
-DLIBEXECDIR=\"$(libexecdir)\"
|
||||
|
||||
###########################################
|
||||
# Test libraries
|
||||
###########################################
|
||||
|
||||
noinst_LTLIBRARIES = \
|
||||
libtest-dispatcher-envp.la
|
||||
|
||||
|
||||
dbusservicedir = $(DBUS_SYS_DIR)
|
||||
dbusservice_DATA = \
|
||||
nm-dispatcher.conf \
|
||||
nm-avahi-autoipd.conf
|
||||
|
||||
libexec_PROGRAMS = \
|
||||
nm-dispatcher \
|
||||
nm-avahi-autoipd.action
|
||||
|
||||
|
||||
nm_avahi_autoipd_action_SOURCES = \
|
||||
nm-avahi-autoipd-action.c
|
||||
|
||||
nm_avahi_autoipd_action_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
||||
nm_dispatcher_SOURCES = \
|
||||
nm-dispatcher.c \
|
||||
nm-dispatcher-api.h \
|
||||
nm-dispatcher-utils.c \
|
||||
nm-dispatcher-utils.h
|
||||
|
||||
nm_dispatcher_LDADD = \
|
||||
$(top_builddir)/libnm/libnm.la \
|
||||
libnmdbus-dispatcher.la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
# See note about gdbus-codegen in introspection/Makefile.am
|
||||
|
||||
noinst_LTLIBRARIES += libnmdbus-dispatcher.la
|
||||
|
||||
nodist_libnmdbus_dispatcher_la_SOURCES = \
|
||||
nmdbus-dispatcher.c \
|
||||
nmdbus-dispatcher.h
|
||||
|
||||
libnmdbus_dispatcher_la_CPPFLAGS = $(filter-out -DGLIB_VERSION_MAX_ALLOWED%,$(AM_CPPFLAGS))
|
||||
|
||||
nmdbus-dispatcher.h: nm-dispatcher.xml
|
||||
$(AM_V_GEN) gdbus-codegen \
|
||||
--generate-c-code $(basename $@) \
|
||||
--c-namespace NMDBus \
|
||||
--interface-prefix org.freedesktop \
|
||||
$<
|
||||
|
||||
nmdbus-dispatcher.c: nmdbus-dispatcher.h
|
||||
@true
|
||||
|
||||
BUILT_SOURCES = nmdbus-dispatcher.h nmdbus-dispatcher.c
|
||||
|
||||
###########################################
|
||||
# dispatcher envp
|
||||
###########################################
|
||||
|
||||
libtest_dispatcher_envp_la_SOURCES = \
|
||||
nm-dispatcher-utils.c \
|
||||
nm-dispatcher-utils.h
|
||||
|
||||
libtest_dispatcher_envp_la_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS)
|
||||
|
||||
libtest_dispatcher_envp_la_LIBADD = \
|
||||
$(top_builddir)/libnm/libnm.la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
||||
if WITH_UDEV_DIR
|
||||
udevrulesdir = $(UDEV_DIR)/rules.d
|
||||
udevrules_DATA = 77-nm-olpc-mesh.rules
|
||||
endif
|
||||
|
||||
dbusactivationdir = $(datadir)/dbus-1/system-services
|
||||
dbusactivation_in_files = org.freedesktop.nm_dispatcher.service.in
|
||||
dbusactivation_DATA = $(dbusactivation_in_files:.service.in=.service)
|
||||
|
||||
%.service: %.service.in
|
||||
$(edit) $< >$@
|
||||
|
||||
edit = @sed \
|
||||
-e 's|@sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|@libexecdir[@]|$(libexecdir)|g'
|
||||
|
||||
dispatcherdir=$(sysconfdir)/NetworkManager/dispatcher.d
|
||||
install-data-hook:
|
||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)
|
||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)/pre-down.d
|
||||
$(mkinstalldirs) -m 0755 $(DESTDIR)$(dispatcherdir)/pre-up.d
|
||||
|
||||
CLEANFILES = $(nodist_libnmdbus_dispatcher_la_SOURCES) $(dbusactivation_DATA)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(dbusservice_DATA) \
|
||||
$(udevrules_DATA) \
|
||||
$(dbusactivation_in_files) \
|
||||
nm-dispatcher.xml
|
||||
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2008, 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define NM_AVAHI_AUTOIPD_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd"
|
||||
#define NM_AVAHI_AUTOIPD_DBUS_INTERFACE "org.freedesktop.nm_avahi_autoipd"
|
||||
|
||||
static void
|
||||
on_name_acquired (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer loop)
|
||||
{
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
|
||||
static void
|
||||
on_name_lost (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_printerr ("Error: Could not acquire the NM autoipd service.");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GDBusConnection *connection;
|
||||
char *event, *iface, *address;
|
||||
GMainLoop *loop;
|
||||
GError *error = NULL;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
if (argc != 4) {
|
||||
g_printerr ("Error: expected 3 arguments (event, interface, address).\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
event = argv[1];
|
||||
iface = argv[2];
|
||||
address = argv[3] ? argv[3] : "";
|
||||
|
||||
if (!event || !iface || !strlen (event) || !strlen (iface)) {
|
||||
g_printerr ("Error: unexpected arguments received from avahi-autoipd.\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Get a connection to the system bus */
|
||||
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||
if (error) {
|
||||
char *remote_error = g_dbus_error_get_remote_error (error);
|
||||
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
g_printerr ("Error: could not get the system bus. Make sure "
|
||||
"the message bus daemon is running! Message: (%s) %s\n",
|
||||
remote_error, error->message);
|
||||
g_free (remote_error);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Acquire the bus name */
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
g_bus_own_name_on_connection (connection,
|
||||
NM_AVAHI_AUTOIPD_DBUS_SERVICE,
|
||||
0,
|
||||
on_name_acquired,
|
||||
on_name_lost,
|
||||
loop, NULL);
|
||||
g_main_loop_run (loop);
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
/* Send the signal */
|
||||
if (!g_dbus_connection_emit_signal (connection,
|
||||
NULL,
|
||||
"/",
|
||||
NM_AVAHI_AUTOIPD_DBUS_INTERFACE,
|
||||
"Event",
|
||||
g_variant_new ("(sss)",
|
||||
event,
|
||||
iface,
|
||||
address),
|
||||
&error)) {
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
g_printerr ("Error: Could not send autoipd Event signal: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!g_dbus_connection_flush_sync (connection, NULL, &error)) {
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
g_printerr ("Error: Could not flush D-Bus connection: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_object_unref (connection);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<policy user="root">
|
||||
<allow own="org.freedesktop.nm_avahi_autoipd"/>
|
||||
</policy>
|
||||
<policy context="default">
|
||||
<deny own="org.freedesktop.nm_avahi_autoipd"/>
|
||||
<deny send_destination="org.freedesktop.nm_avahi_autoipd"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 - 2012 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#define NMD_SCRIPT_DIR_DEFAULT NMCONFDIR "/dispatcher.d"
|
||||
#define NMD_SCRIPT_DIR_PRE_UP NMD_SCRIPT_DIR_DEFAULT "/pre-up.d"
|
||||
#define NMD_SCRIPT_DIR_PRE_DOWN NMD_SCRIPT_DIR_DEFAULT "/pre-down.d"
|
||||
|
||||
/* dbus-glib types for dispatcher call return value (used by src/nm-dispatcher.c) */
|
||||
#define DISPATCHER_TYPE_RESULT (dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID))
|
||||
#define DISPATCHER_TYPE_RESULT_ARRAY (dbus_g_type_get_collection ("GPtrArray", DISPATCHER_TYPE_RESULT))
|
||||
|
||||
#define NM_DISPATCHER_DBUS_SERVICE "org.freedesktop.nm_dispatcher"
|
||||
#define NM_DISPATCHER_DBUS_INTERFACE "org.freedesktop.nm_dispatcher"
|
||||
#define NM_DISPATCHER_DBUS_PATH "/org/freedesktop/nm_dispatcher"
|
||||
|
||||
#define NMD_CONNECTION_PROPS_PATH "path"
|
||||
|
||||
#define NMD_DEVICE_PROPS_INTERFACE "interface"
|
||||
#define NMD_DEVICE_PROPS_IP_INTERFACE "ip-interface"
|
||||
#define NMD_DEVICE_PROPS_TYPE "type"
|
||||
#define NMD_DEVICE_PROPS_STATE "state"
|
||||
#define NMD_DEVICE_PROPS_PATH "path"
|
||||
|
||||
/* Actions */
|
||||
#define NMD_ACTION_HOSTNAME "hostname"
|
||||
#define NMD_ACTION_PRE_UP "pre-up"
|
||||
#define NMD_ACTION_UP "up"
|
||||
#define NMD_ACTION_PRE_DOWN "pre-down"
|
||||
#define NMD_ACTION_DOWN "down"
|
||||
#define NMD_ACTION_VPN_PRE_UP "vpn-pre-up"
|
||||
#define NMD_ACTION_VPN_UP "vpn-up"
|
||||
#define NMD_ACTION_VPN_PRE_DOWN "vpn-pre-down"
|
||||
#define NMD_ACTION_VPN_DOWN "vpn-down"
|
||||
#define NMD_ACTION_DHCP4_CHANGE "dhcp4-change"
|
||||
#define NMD_ACTION_DHCP6_CHANGE "dhcp6-change"
|
||||
|
||||
typedef enum {
|
||||
DISPATCH_RESULT_UNKNOWN = 0,
|
||||
DISPATCH_RESULT_SUCCESS = 1,
|
||||
DISPATCH_RESULT_EXEC_FAILED = 2,
|
||||
DISPATCH_RESULT_FAILED = 3,
|
||||
DISPATCH_RESULT_TIMEOUT = 4,
|
||||
} DispatchResult;
|
||||
|
||||
|
|
@ -1,471 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 - 2011 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <nm-dbus-interface.h>
|
||||
#include <nm-connection.h>
|
||||
#include <nm-setting-ip4-config.h>
|
||||
#include <nm-setting-ip6-config.h>
|
||||
#include <nm-setting-connection.h>
|
||||
|
||||
#include "nm-dispatcher-api.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
#include "nm-dispatcher-utils.h"
|
||||
|
||||
static GSList *
|
||||
construct_basic_items (GSList *list,
|
||||
const char *uuid,
|
||||
const char *id,
|
||||
const char *iface,
|
||||
const char *ip_iface)
|
||||
{
|
||||
if (uuid)
|
||||
list = g_slist_prepend (list, g_strdup_printf ("CONNECTION_UUID=%s", uuid));
|
||||
if (id)
|
||||
list = g_slist_prepend (list, g_strdup_printf ("CONNECTION_ID=%s", id));
|
||||
if (iface)
|
||||
list = g_slist_prepend (list, g_strdup_printf ("DEVICE_IFACE=%s", iface));
|
||||
if (ip_iface)
|
||||
list = g_slist_prepend (list, g_strdup_printf ("DEVICE_IP_IFACE=%s", ip_iface));
|
||||
return list;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
add_domains (GSList *items,
|
||||
GVariant *dict,
|
||||
const char *prefix,
|
||||
const char four_or_six)
|
||||
{
|
||||
GVariant *val;
|
||||
char **domains = NULL;
|
||||
GString *tmp;
|
||||
guint i;
|
||||
|
||||
/* Search domains */
|
||||
val = g_variant_lookup_value (dict, "domains", G_VARIANT_TYPE_STRING_ARRAY);
|
||||
if (!val)
|
||||
return items;
|
||||
|
||||
domains = g_variant_dup_strv (val, NULL);
|
||||
g_variant_unref (val);
|
||||
if (!domains[0]) {
|
||||
g_strfreev (domains);
|
||||
return items;
|
||||
}
|
||||
|
||||
tmp = g_string_new (NULL);
|
||||
g_string_append_printf (tmp, "%sIP%c_DOMAINS=", prefix, four_or_six);
|
||||
for (i = 0; domains[i]; i++) {
|
||||
if (i > 0)
|
||||
g_string_append_c (tmp, ' ');
|
||||
g_string_append (tmp, domains[i]);
|
||||
}
|
||||
items = g_slist_prepend (items, g_string_free (tmp, FALSE));
|
||||
|
||||
g_strfreev (domains);
|
||||
return items;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
construct_ip4_items (GSList *items, GVariant *ip4_config, const char *prefix)
|
||||
{
|
||||
GPtrArray *addresses, *routes;
|
||||
char **dns, **wins;
|
||||
GString *tmp;
|
||||
GVariant *val;
|
||||
char str_addr[INET_ADDRSTRLEN];
|
||||
char str_gw[INET_ADDRSTRLEN];
|
||||
int i;
|
||||
|
||||
if (ip4_config == NULL)
|
||||
return items;
|
||||
|
||||
if (prefix == NULL)
|
||||
prefix = "";
|
||||
|
||||
/* IP addresses */
|
||||
val = g_variant_lookup_value (ip4_config, "addresses", G_VARIANT_TYPE ("aau"));
|
||||
if (val) {
|
||||
addresses = nm_utils_ip4_addresses_from_variant (val);
|
||||
|
||||
for (i = 0; i < addresses->len; i++) {
|
||||
NMIP4Address *addr = addresses->pdata[i];
|
||||
guint32 ip_prefix = nm_ip4_address_get_prefix (addr);
|
||||
char *addrtmp;
|
||||
|
||||
nm_utils_inet4_ntop (nm_ip4_address_get_address (addr), str_addr);
|
||||
nm_utils_inet4_ntop (nm_ip4_address_get_gateway (addr), str_gw);
|
||||
|
||||
addrtmp = g_strdup_printf ("%sIP4_ADDRESS_%d=%s/%d %s", prefix, i, str_addr, ip_prefix, str_gw);
|
||||
items = g_slist_prepend (items, addrtmp);
|
||||
}
|
||||
if (addresses->len)
|
||||
items = g_slist_prepend (items, g_strdup_printf ("%sIP4_NUM_ADDRESSES=%d", prefix, addresses->len));
|
||||
g_ptr_array_unref (addresses);
|
||||
g_variant_unref (val);
|
||||
}
|
||||
|
||||
/* DNS servers */
|
||||
val = g_variant_lookup_value (ip4_config, "nameservers", G_VARIANT_TYPE ("au"));
|
||||
if (val) {
|
||||
dns = nm_utils_ip4_dns_from_variant (val);
|
||||
|
||||
if (dns[0]) {
|
||||
tmp = g_string_new (NULL);
|
||||
g_string_append_printf (tmp, "%sIP4_NAMESERVERS=", prefix);
|
||||
for (i = 0; dns[i]; i++) {
|
||||
if (i != 0)
|
||||
g_string_append_c (tmp, ' ');
|
||||
g_string_append (tmp, dns[i]);
|
||||
}
|
||||
|
||||
items = g_slist_prepend (items, g_string_free (tmp, FALSE));
|
||||
}
|
||||
g_strfreev (dns);
|
||||
g_variant_unref (val);
|
||||
}
|
||||
|
||||
/* Search domains */
|
||||
items = add_domains (items, ip4_config, prefix, '4');
|
||||
|
||||
/* WINS servers */
|
||||
val = g_variant_lookup_value (ip4_config, "wins-servers", G_VARIANT_TYPE ("au"));
|
||||
if (val) {
|
||||
wins = nm_utils_ip4_dns_from_variant (val);
|
||||
|
||||
if (wins[0]) {
|
||||
tmp = g_string_new (NULL);
|
||||
g_string_append_printf (tmp, "%sIP4_WINS_SERVERS=", prefix);
|
||||
|
||||
for (i = 0; wins[i]; i++) {
|
||||
if (i != 0)
|
||||
g_string_append_c (tmp, ' ');
|
||||
g_string_append (tmp, wins[i]);
|
||||
}
|
||||
|
||||
items = g_slist_prepend (items, g_string_free (tmp, FALSE));
|
||||
}
|
||||
g_strfreev (wins);
|
||||
g_variant_unref (val);
|
||||
}
|
||||
|
||||
/* Static routes */
|
||||
val = g_variant_lookup_value (ip4_config, "routes", G_VARIANT_TYPE ("aau"));
|
||||
if (val) {
|
||||
routes = nm_utils_ip4_routes_from_variant (val);
|
||||
|
||||
for (i = 0; i < routes->len; i++) {
|
||||
NMIP4Route *route = routes->pdata[i];
|
||||
guint32 ip_prefix = nm_ip4_route_get_prefix (route);
|
||||
guint32 metric = nm_ip4_route_get_metric (route);
|
||||
char *routetmp;
|
||||
|
||||
nm_utils_inet4_ntop (nm_ip4_route_get_dest (route), str_addr);
|
||||
nm_utils_inet4_ntop (nm_ip4_route_get_next_hop (route), str_gw);
|
||||
|
||||
routetmp = g_strdup_printf ("%sIP4_ROUTE_%d=%s/%d %s %d", prefix, i, str_addr, ip_prefix, str_gw, metric);
|
||||
items = g_slist_prepend (items, routetmp);
|
||||
}
|
||||
items = g_slist_prepend (items, g_strdup_printf ("%sIP4_NUM_ROUTES=%d", prefix, routes->len));
|
||||
g_ptr_array_unref (routes);
|
||||
g_variant_unref (val);
|
||||
} else
|
||||
items = g_slist_prepend (items, g_strdup_printf ("%sIP4_NUM_ROUTES=0", prefix));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
construct_device_dhcp4_items (GSList *items, GVariant *dhcp4_config)
|
||||
{
|
||||
GVariantIter iter;
|
||||
const char *key, *tmp;
|
||||
GVariant *val;
|
||||
char *ucased;
|
||||
|
||||
if (dhcp4_config == NULL)
|
||||
return items;
|
||||
|
||||
g_variant_iter_init (&iter, dhcp4_config);
|
||||
while (g_variant_iter_next (&iter, "{&sv}", &key, &val)) {
|
||||
ucased = g_ascii_strup (key, -1);
|
||||
tmp = g_variant_get_string (val, NULL);
|
||||
items = g_slist_prepend (items, g_strdup_printf ("DHCP4_%s=%s", ucased, tmp));
|
||||
g_free (ucased);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
construct_ip6_items (GSList *items, GVariant *ip6_config, const char *prefix)
|
||||
{
|
||||
GPtrArray *addresses, *routes;
|
||||
char **dns;
|
||||
GString *tmp;
|
||||
GVariant *val;
|
||||
char str_addr[INET6_ADDRSTRLEN];
|
||||
char str_gw[INET6_ADDRSTRLEN];
|
||||
int i;
|
||||
|
||||
if (ip6_config == NULL)
|
||||
return items;
|
||||
|
||||
if (prefix == NULL)
|
||||
prefix = "";
|
||||
|
||||
/* IP addresses */
|
||||
val = g_variant_lookup_value (ip6_config, "addresses", G_VARIANT_TYPE ("a(ayuay)"));
|
||||
if (val) {
|
||||
addresses = nm_utils_ip6_addresses_from_variant (val);
|
||||
|
||||
for (i = 0; i < addresses->len; i++) {
|
||||
NMIP6Address *addr = addresses->pdata[i];
|
||||
guint32 ip_prefix = nm_ip6_address_get_prefix (addr);
|
||||
char *addrtmp;
|
||||
|
||||
nm_utils_inet6_ntop (nm_ip6_address_get_address (addr), str_addr);
|
||||
nm_utils_inet6_ntop (nm_ip6_address_get_gateway (addr), str_gw);
|
||||
|
||||
addrtmp = g_strdup_printf ("%sIP6_ADDRESS_%d=%s/%d %s", prefix, i, str_addr, ip_prefix, str_gw);
|
||||
items = g_slist_prepend (items, addrtmp);
|
||||
}
|
||||
if (addresses->len)
|
||||
items = g_slist_prepend (items, g_strdup_printf ("%sIP6_NUM_ADDRESSES=%d", prefix, addresses->len));
|
||||
g_ptr_array_unref (addresses);
|
||||
g_variant_unref (val);
|
||||
}
|
||||
|
||||
/* DNS servers */
|
||||
val = g_variant_lookup_value (ip6_config, "nameservers", G_VARIANT_TYPE ("aay"));
|
||||
if (val) {
|
||||
dns = nm_utils_ip6_dns_from_variant (val);
|
||||
|
||||
if (dns[0]) {
|
||||
tmp = g_string_new (NULL);
|
||||
g_string_append_printf (tmp, "%sIP6_NAMESERVERS=", prefix);
|
||||
|
||||
for (i = 0; dns[i]; i++) {
|
||||
if (i != 0)
|
||||
g_string_append_c (tmp, ' ');
|
||||
g_string_append (tmp, dns[i]);
|
||||
}
|
||||
|
||||
items = g_slist_prepend (items, g_string_free (tmp, FALSE));
|
||||
}
|
||||
g_strfreev (dns);
|
||||
g_variant_unref (val);
|
||||
}
|
||||
|
||||
/* Search domains */
|
||||
items = add_domains (items, ip6_config, prefix, '6');
|
||||
|
||||
/* Static routes */
|
||||
val = g_variant_lookup_value (ip6_config, "routes", G_VARIANT_TYPE ("a(ayuayu)"));
|
||||
if (val) {
|
||||
routes = nm_utils_ip6_routes_from_variant (val);
|
||||
|
||||
for (i = 0; i < routes->len; i++) {
|
||||
NMIP6Route *route = routes->pdata[i];
|
||||
guint32 ip_prefix = nm_ip6_route_get_prefix (route);
|
||||
guint32 metric = nm_ip6_route_get_metric (route);
|
||||
char *routetmp;
|
||||
|
||||
nm_utils_inet6_ntop (nm_ip6_route_get_dest (route), str_addr);
|
||||
nm_utils_inet6_ntop (nm_ip6_route_get_next_hop (route), str_gw);
|
||||
|
||||
routetmp = g_strdup_printf ("%sIP6_ROUTE_%d=%s/%d %s %d", prefix, i, str_addr, ip_prefix, str_gw, metric);
|
||||
items = g_slist_prepend (items, routetmp);
|
||||
}
|
||||
if (routes->len)
|
||||
items = g_slist_prepend (items, g_strdup_printf ("%sIP6_NUM_ROUTES=%d", prefix, routes->len));
|
||||
g_ptr_array_unref (routes);
|
||||
g_variant_unref (val);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
construct_device_dhcp6_items (GSList *items, GVariant *dhcp6_config)
|
||||
{
|
||||
GVariantIter iter;
|
||||
const char *key, *tmp;
|
||||
GVariant *val;
|
||||
char *ucased;
|
||||
|
||||
if (dhcp6_config == NULL)
|
||||
return items;
|
||||
|
||||
g_variant_iter_init (&iter, dhcp6_config);
|
||||
while (g_variant_iter_next (&iter, "{&sv}", &key, &val)) {
|
||||
ucased = g_ascii_strup (key, -1);
|
||||
tmp = g_variant_get_string (val, NULL);
|
||||
items = g_slist_prepend (items, g_strdup_printf ("DHCP6_%s=%s", ucased, tmp));
|
||||
g_free (ucased);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
char **
|
||||
nm_dispatcher_utils_construct_envp (const char *action,
|
||||
GVariant *connection_dict,
|
||||
GVariant *connection_props,
|
||||
GVariant *device_props,
|
||||
GVariant *device_ip4_props,
|
||||
GVariant *device_ip6_props,
|
||||
GVariant *device_dhcp4_props,
|
||||
GVariant *device_dhcp6_props,
|
||||
const char *vpn_ip_iface,
|
||||
GVariant *vpn_ip4_props,
|
||||
GVariant *vpn_ip6_props,
|
||||
char **out_iface)
|
||||
{
|
||||
const char *iface = NULL, *ip_iface = NULL;
|
||||
const char *uuid = NULL, *id = NULL, *path;
|
||||
NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN;
|
||||
GVariant *value;
|
||||
char **envp = NULL, *path_item;
|
||||
GSList *items = NULL, *iter;
|
||||
guint i;
|
||||
GVariant *con_setting;
|
||||
|
||||
g_return_val_if_fail (action != NULL, NULL);
|
||||
g_return_val_if_fail (out_iface != NULL, NULL);
|
||||
g_return_val_if_fail (*out_iface == NULL, NULL);
|
||||
|
||||
/* Hostname changes don't require a device nor contain a connection */
|
||||
if (!strcmp (action, "hostname"))
|
||||
goto done;
|
||||
|
||||
/* Canonicalize the VPN interface name; "" is used when passing it through
|
||||
* D-Bus so make sure that's fixed up here.
|
||||
*/
|
||||
if (vpn_ip_iface && !strlen (vpn_ip_iface))
|
||||
vpn_ip_iface = NULL;
|
||||
|
||||
/* interface name */
|
||||
if (!g_variant_lookup (device_props, NMD_DEVICE_PROPS_INTERFACE, "&s", &iface)) {
|
||||
g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_INTERFACE "!");
|
||||
return NULL;
|
||||
}
|
||||
if (!*iface)
|
||||
iface = NULL;
|
||||
|
||||
/* IP interface name */
|
||||
value = g_variant_lookup_value (device_props, NMD_DEVICE_PROPS_IP_INTERFACE, NULL);
|
||||
if (value) {
|
||||
if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) {
|
||||
g_warning ("Invalid value " NMD_DEVICE_PROPS_IP_INTERFACE "!");
|
||||
return NULL;
|
||||
}
|
||||
g_variant_unref (value);
|
||||
g_variant_lookup (device_props, NMD_DEVICE_PROPS_IP_INTERFACE, "&s", &ip_iface);
|
||||
}
|
||||
|
||||
/* Device type */
|
||||
if (!g_variant_lookup (device_props, NMD_DEVICE_PROPS_TYPE, "u", NULL)) {
|
||||
g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_TYPE "!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Device state */
|
||||
value = g_variant_lookup_value (device_props, NMD_DEVICE_PROPS_STATE, G_VARIANT_TYPE_UINT32);
|
||||
if (!value) {
|
||||
g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_STATE "!");
|
||||
return NULL;
|
||||
}
|
||||
dev_state = g_variant_get_uint32 (value);
|
||||
g_variant_unref (value);
|
||||
|
||||
/* device itself */
|
||||
if (!g_variant_lookup (device_props, NMD_DEVICE_PROPS_PATH, "o", NULL)) {
|
||||
g_warning ("Missing or invalid required value " NMD_DEVICE_PROPS_PATH "!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* UUID and ID */
|
||||
con_setting = g_variant_lookup_value (connection_dict, NM_SETTING_CONNECTION_SETTING_NAME, NM_VARIANT_TYPE_SETTING);
|
||||
if (!con_setting) {
|
||||
g_warning ("Failed to read connection setting");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!g_variant_lookup (con_setting, NM_SETTING_CONNECTION_UUID, "&s", &uuid)) {
|
||||
g_warning ("Connection hash did not contain the UUID");
|
||||
g_variant_unref (con_setting);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!g_variant_lookup (con_setting, NM_SETTING_CONNECTION_ID, "&s", &id)) {
|
||||
g_warning ("Connection hash did not contain the ID");
|
||||
g_variant_unref (con_setting);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
items = construct_basic_items (items, uuid, id, iface, ip_iface);
|
||||
g_variant_unref (con_setting);
|
||||
|
||||
/* Device it's aren't valid if the device isn't activated */
|
||||
if (iface && (dev_state == NM_DEVICE_STATE_ACTIVATED)) {
|
||||
items = construct_ip4_items (items, device_ip4_props, NULL);
|
||||
items = construct_ip6_items (items, device_ip6_props, NULL);
|
||||
items = construct_device_dhcp4_items (items, device_dhcp4_props);
|
||||
items = construct_device_dhcp6_items (items, device_dhcp6_props);
|
||||
}
|
||||
|
||||
if (vpn_ip_iface) {
|
||||
items = g_slist_prepend (items, g_strdup_printf ("VPN_IP_IFACE=%s", vpn_ip_iface));
|
||||
items = construct_ip4_items (items, vpn_ip4_props, "VPN_");
|
||||
items = construct_ip6_items (items, vpn_ip6_props, "VPN_");
|
||||
}
|
||||
|
||||
/* Backwards compat: 'iface' is set in this order:
|
||||
* 1) VPN interface name
|
||||
* 2) Device IP interface name
|
||||
* 3) Device interface anme
|
||||
*/
|
||||
if (vpn_ip_iface)
|
||||
*out_iface = g_strdup (vpn_ip_iface);
|
||||
else if (ip_iface)
|
||||
*out_iface = g_strdup (ip_iface);
|
||||
else
|
||||
*out_iface = g_strdup (iface);
|
||||
|
||||
done:
|
||||
path = g_getenv ("PATH");
|
||||
if (path) {
|
||||
path_item = g_strdup_printf ("PATH=%s", path);
|
||||
items = g_slist_prepend (items, path_item);
|
||||
}
|
||||
|
||||
/* Convert the list to an environment pointer */
|
||||
envp = g_new0 (char *, g_slist_length (items) + 1);
|
||||
for (iter = items, i = 0; iter; iter = g_slist_next (iter), i++)
|
||||
envp[i] = (char *) iter->data;
|
||||
g_slist_free (items);
|
||||
|
||||
return envp;
|
||||
}
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 - 2011 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NETWORKMANAGER_DISPATCHER_UTILS_H__
|
||||
#define __NETWORKMANAGER_DISPATCHER_UTILS_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
char **
|
||||
nm_dispatcher_utils_construct_envp (const char *action,
|
||||
GVariant *connection_dict,
|
||||
GVariant *connection_props,
|
||||
GVariant *device_props,
|
||||
GVariant *device_ip4_props,
|
||||
GVariant *device_ip6_props,
|
||||
GVariant *device_dhcp4_props,
|
||||
GVariant *device_dhcp6_props,
|
||||
const char *vpn_ip_iface,
|
||||
GVariant *vpn_ip4_props,
|
||||
GVariant *vpn_ip6_props,
|
||||
char **out_iface);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DISPATCHER_UTILS_H__ */
|
||||
|
||||
|
|
@ -1,706 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 - 2012 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include <syslog.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-unix.h>
|
||||
|
||||
|
||||
#include "nm-dispatcher-api.h"
|
||||
#include "nm-dispatcher-utils.h"
|
||||
#include "nm-glib-compat.h"
|
||||
|
||||
#include "nmdbus-dispatcher.h"
|
||||
|
||||
static GMainLoop *loop = NULL;
|
||||
static gboolean debug = FALSE;
|
||||
static gboolean persist = FALSE;
|
||||
static guint quit_id;
|
||||
|
||||
typedef struct Request Request;
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
|
||||
/* Private data */
|
||||
NMDBusDispatcher *dbus_dispatcher;
|
||||
|
||||
Request *current_request;
|
||||
GQueue *pending_requests;
|
||||
} Handler;
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
} HandlerClass;
|
||||
|
||||
GType handler_get_type (void);
|
||||
|
||||
#define HANDLER_TYPE (handler_get_type ())
|
||||
#define HANDLER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), HANDLER_TYPE, Handler))
|
||||
#define HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HANDLER_TYPE, HandlerClass))
|
||||
|
||||
G_DEFINE_TYPE(Handler, handler, G_TYPE_OBJECT)
|
||||
|
||||
static gboolean
|
||||
handle_action (NMDBusDispatcher *dbus_dispatcher,
|
||||
GDBusMethodInvocation *context,
|
||||
const char *str_action,
|
||||
GVariant *connection_dict,
|
||||
GVariant *connection_props,
|
||||
GVariant *device_props,
|
||||
GVariant *device_ip4_props,
|
||||
GVariant *device_ip6_props,
|
||||
GVariant *device_dhcp4_props,
|
||||
GVariant *device_dhcp6_props,
|
||||
const char *vpn_ip_iface,
|
||||
GVariant *vpn_ip4_props,
|
||||
GVariant *vpn_ip6_props,
|
||||
gboolean request_debug,
|
||||
gpointer user_data);
|
||||
|
||||
static void
|
||||
handler_init (Handler *h)
|
||||
{
|
||||
h->pending_requests = g_queue_new ();
|
||||
h->dbus_dispatcher = nmdbus_dispatcher_skeleton_new ();
|
||||
g_signal_connect (h->dbus_dispatcher, "handle-action",
|
||||
G_CALLBACK (handle_action), h);
|
||||
}
|
||||
|
||||
static void
|
||||
handler_class_init (HandlerClass *h_class)
|
||||
{
|
||||
}
|
||||
|
||||
static void dispatch_one_script (Request *request);
|
||||
|
||||
typedef struct {
|
||||
Request *request;
|
||||
|
||||
char *script;
|
||||
GPid pid;
|
||||
DispatchResult result;
|
||||
char *error;
|
||||
} ScriptInfo;
|
||||
|
||||
struct Request {
|
||||
Handler *handler;
|
||||
|
||||
GDBusMethodInvocation *context;
|
||||
char *action;
|
||||
char *iface;
|
||||
char **envp;
|
||||
gboolean debug;
|
||||
|
||||
GPtrArray *scripts; /* list of ScriptInfo */
|
||||
guint idx;
|
||||
|
||||
guint script_watch_id;
|
||||
guint script_timeout_id;
|
||||
};
|
||||
|
||||
static void
|
||||
script_info_free (gpointer ptr)
|
||||
{
|
||||
ScriptInfo *info = ptr;
|
||||
|
||||
g_free (info->script);
|
||||
g_free (info->error);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
request_free (Request *request)
|
||||
{
|
||||
g_free (request->action);
|
||||
g_free (request->iface);
|
||||
g_strfreev (request->envp);
|
||||
if (request->scripts)
|
||||
g_ptr_array_free (request->scripts, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
quit_timeout_cb (gpointer user_data)
|
||||
{
|
||||
g_main_loop_quit (loop);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
quit_timeout_cancel (void)
|
||||
{
|
||||
if (quit_id) {
|
||||
g_source_remove (quit_id);
|
||||
quit_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
quit_timeout_reschedule (void)
|
||||
{
|
||||
quit_timeout_cancel ();
|
||||
if (!persist)
|
||||
quit_id = g_timeout_add_seconds (10, quit_timeout_cb, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
start_request (Request *request)
|
||||
{
|
||||
if (request->iface)
|
||||
g_message ("Dispatching action '%s' for %s", request->action, request->iface);
|
||||
else
|
||||
g_message ("Dispatching action '%s'", request->action);
|
||||
|
||||
request->handler->current_request = request;
|
||||
dispatch_one_script (request);
|
||||
}
|
||||
|
||||
static void
|
||||
next_request (Handler *h)
|
||||
{
|
||||
Request *request = g_queue_pop_head (h->pending_requests);
|
||||
|
||||
if (request) {
|
||||
start_request (request);
|
||||
return;
|
||||
}
|
||||
|
||||
h->current_request = NULL;
|
||||
quit_timeout_reschedule ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
next_script (gpointer user_data)
|
||||
{
|
||||
Request *request = user_data;
|
||||
Handler *h = request->handler;
|
||||
GVariantBuilder results;
|
||||
GVariant *ret;
|
||||
guint i;
|
||||
|
||||
request->idx++;
|
||||
if (request->idx < request->scripts->len) {
|
||||
dispatch_one_script (request);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
g_variant_builder_init (&results, G_VARIANT_TYPE ("a(sus)"));
|
||||
for (i = 0; i < request->scripts->len; i++) {
|
||||
ScriptInfo *script = g_ptr_array_index (request->scripts, i);
|
||||
|
||||
g_variant_builder_add (&results, "(sus)",
|
||||
script->script,
|
||||
script->result,
|
||||
script->error ? script->error : "");
|
||||
}
|
||||
|
||||
ret = g_variant_new ("(a(sus))", &results);
|
||||
g_dbus_method_invocation_return_value (request->context, ret);
|
||||
|
||||
if (request->debug) {
|
||||
if (request->iface)
|
||||
g_message ("Dispatch '%s' on %s complete", request->action, request->iface);
|
||||
else
|
||||
g_message ("Dispatch '%s' complete", request->action);
|
||||
}
|
||||
request_free (request);
|
||||
|
||||
next_request (h);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
script_watch_cb (GPid pid, gint status, gpointer user_data)
|
||||
{
|
||||
ScriptInfo *script = user_data;
|
||||
guint err;
|
||||
|
||||
g_assert (pid == script->pid);
|
||||
|
||||
script->request->script_watch_id = 0;
|
||||
g_source_remove (script->request->script_timeout_id);
|
||||
script->request->script_timeout_id = 0;
|
||||
|
||||
if (WIFEXITED (status)) {
|
||||
err = WEXITSTATUS (status);
|
||||
if (err == 0)
|
||||
script->result = DISPATCH_RESULT_SUCCESS;
|
||||
else {
|
||||
script->error = g_strdup_printf ("Script '%s' exited with error status %d.",
|
||||
script->script, err);
|
||||
}
|
||||
} else if (WIFSTOPPED (status)) {
|
||||
script->error = g_strdup_printf ("Script '%s' stopped unexpectedly with signal %d.",
|
||||
script->script, WSTOPSIG (status));
|
||||
} else if (WIFSIGNALED (status)) {
|
||||
script->error = g_strdup_printf ("Script '%s' died with signal %d",
|
||||
script->script, WTERMSIG (status));
|
||||
} else {
|
||||
script->error = g_strdup_printf ("Script '%s' died from an unknown cause",
|
||||
script->script);
|
||||
}
|
||||
|
||||
if (script->result == DISPATCH_RESULT_SUCCESS) {
|
||||
if (script->request->debug)
|
||||
g_message ("Script '%s' complete", script->script);
|
||||
} else {
|
||||
script->result = DISPATCH_RESULT_FAILED;
|
||||
g_warning ("%s", script->error);
|
||||
}
|
||||
|
||||
g_spawn_close_pid (script->pid);
|
||||
next_script (script->request);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
script_timeout_cb (gpointer user_data)
|
||||
{
|
||||
ScriptInfo *script = user_data;
|
||||
|
||||
g_source_remove (script->request->script_watch_id);
|
||||
script->request->script_watch_id = 0;
|
||||
script->request->script_timeout_id = 0;
|
||||
|
||||
g_warning ("Script '%s' took too long; killing it.", script->script);
|
||||
|
||||
if (kill (script->pid, 0) == 0)
|
||||
kill (script->pid, SIGKILL);
|
||||
waitpid (script->pid, NULL, 0);
|
||||
|
||||
script->error = g_strdup_printf ("Script '%s' timed out.", script->script);
|
||||
script->result = DISPATCH_RESULT_TIMEOUT;
|
||||
|
||||
g_spawn_close_pid (script->pid);
|
||||
g_idle_add (next_script, script->request);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
check_permissions (struct stat *s, const char **out_error_msg)
|
||||
{
|
||||
g_return_val_if_fail (s != NULL, FALSE);
|
||||
g_return_val_if_fail (out_error_msg != NULL, FALSE);
|
||||
g_return_val_if_fail (*out_error_msg == NULL, FALSE);
|
||||
|
||||
/* Only accept regular files */
|
||||
if (!S_ISREG (s->st_mode)) {
|
||||
*out_error_msg = "not a regular file.";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Only accept files owned by root */
|
||||
if (s->st_uid != 0) {
|
||||
*out_error_msg = "not owned by root.";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Only accept files not writable by group or other, and not SUID */
|
||||
if (s->st_mode & (S_IWGRP | S_IWOTH | S_ISUID)) {
|
||||
*out_error_msg = "writable by group or other, or set-UID.";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Only accept files executable by the owner */
|
||||
if (!(s->st_mode & S_IXUSR)) {
|
||||
*out_error_msg = "not executable by owner.";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_filename (const char *file_name)
|
||||
{
|
||||
char *bad_suffixes[] = { "~", ".rpmsave", ".rpmorig", ".rpmnew", NULL };
|
||||
char *tmp;
|
||||
guint i;
|
||||
|
||||
/* File must not be a backup file, package management file, or start with '.' */
|
||||
|
||||
if (file_name[0] == '.')
|
||||
return FALSE;
|
||||
for (i = 0; bad_suffixes[i]; i++) {
|
||||
if (g_str_has_suffix (file_name, bad_suffixes[i]))
|
||||
return FALSE;
|
||||
}
|
||||
tmp = g_strrstr (file_name, ".dpkg-");
|
||||
if (tmp && (tmp == strrchr (file_name, '.')))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
child_setup (gpointer user_data G_GNUC_UNUSED)
|
||||
{
|
||||
/* We are in the child process at this point */
|
||||
/* Give child a different process group to ensure signal separation. */
|
||||
pid_t pid = getpid ();
|
||||
setpgid (pid, pid);
|
||||
}
|
||||
|
||||
#define SCRIPT_TIMEOUT 600 /* 10 minutes */
|
||||
|
||||
static void
|
||||
dispatch_one_script (Request *request)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *argv[4];
|
||||
ScriptInfo *script = g_ptr_array_index (request->scripts, request->idx);
|
||||
|
||||
argv[0] = script->script;
|
||||
argv[1] = request->iface ? request->iface : "none";
|
||||
argv[2] = request->action;
|
||||
argv[3] = NULL;
|
||||
|
||||
if (request->debug)
|
||||
g_message ("Running script '%s'", script->script);
|
||||
|
||||
if (g_spawn_async ("/", argv, request->envp, G_SPAWN_DO_NOT_REAP_CHILD, child_setup, request, &script->pid, &error)) {
|
||||
request->script_watch_id = g_child_watch_add (script->pid, (GChildWatchFunc) script_watch_cb, script);
|
||||
request->script_timeout_id = g_timeout_add_seconds (SCRIPT_TIMEOUT, script_timeout_cb, script);
|
||||
} else {
|
||||
g_warning ("Failed to execute script '%s': (%d) %s",
|
||||
script->script, error->code, error->message);
|
||||
script->result = DISPATCH_RESULT_EXEC_FAILED;
|
||||
script->error = g_strdup (error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
/* Try the next script */
|
||||
g_idle_add (next_script, request);
|
||||
}
|
||||
}
|
||||
|
||||
static GSList *
|
||||
find_scripts (const char *str_action)
|
||||
{
|
||||
GDir *dir;
|
||||
const char *filename;
|
||||
GSList *sorted = NULL;
|
||||
GError *error = NULL;
|
||||
const char *dirname;
|
||||
|
||||
if ( strcmp (str_action, NMD_ACTION_PRE_UP) == 0
|
||||
|| strcmp (str_action, NMD_ACTION_VPN_PRE_UP) == 0)
|
||||
dirname = NMD_SCRIPT_DIR_PRE_UP;
|
||||
else if ( strcmp (str_action, NMD_ACTION_PRE_DOWN) == 0
|
||||
|| strcmp (str_action, NMD_ACTION_VPN_PRE_DOWN) == 0)
|
||||
dirname = NMD_SCRIPT_DIR_PRE_DOWN;
|
||||
else
|
||||
dirname = NMD_SCRIPT_DIR_DEFAULT;
|
||||
|
||||
if (!(dir = g_dir_open (dirname, 0, &error))) {
|
||||
g_message ("Failed to open dispatcher directory '%s': (%d) %s",
|
||||
dirname, error->code, error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((filename = g_dir_read_name (dir))) {
|
||||
char *path;
|
||||
struct stat st;
|
||||
int err;
|
||||
const char *err_msg = NULL;
|
||||
|
||||
if (!check_filename (filename))
|
||||
continue;
|
||||
|
||||
path = g_build_filename (dirname, filename, NULL);
|
||||
|
||||
err = stat (path, &st);
|
||||
if (err)
|
||||
g_warning ("Failed to stat '%s': %d", path, err);
|
||||
else if (S_ISDIR (st.st_mode))
|
||||
; /* silently skip. */
|
||||
else if (!check_permissions (&st, &err_msg))
|
||||
g_warning ("Cannot execute '%s': %s", path, err_msg);
|
||||
else {
|
||||
/* success */
|
||||
sorted = g_slist_insert_sorted (sorted, path, (GCompareFunc) g_strcmp0);
|
||||
path = NULL;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
g_dir_close (dir);
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_action (NMDBusDispatcher *dbus_dispatcher,
|
||||
GDBusMethodInvocation *context,
|
||||
const char *str_action,
|
||||
GVariant *connection_dict,
|
||||
GVariant *connection_props,
|
||||
GVariant *device_props,
|
||||
GVariant *device_ip4_props,
|
||||
GVariant *device_ip6_props,
|
||||
GVariant *device_dhcp4_props,
|
||||
GVariant *device_dhcp6_props,
|
||||
const char *vpn_ip_iface,
|
||||
GVariant *vpn_ip4_props,
|
||||
GVariant *vpn_ip6_props,
|
||||
gboolean request_debug,
|
||||
gpointer user_data)
|
||||
{
|
||||
Handler *h = user_data;
|
||||
GSList *sorted_scripts = NULL;
|
||||
GSList *iter;
|
||||
Request *request;
|
||||
char **p;
|
||||
char *iface = NULL;
|
||||
|
||||
sorted_scripts = find_scripts (str_action);
|
||||
|
||||
if (!sorted_scripts) {
|
||||
GVariant *results;
|
||||
|
||||
results = g_variant_new_array (G_VARIANT_TYPE ("(sus)"), NULL, 0);
|
||||
g_dbus_method_invocation_return_value (context, g_variant_new ("(@a(sus))", results));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
quit_timeout_cancel ();
|
||||
|
||||
request = g_malloc0 (sizeof (*request));
|
||||
request->handler = h;
|
||||
request->debug = request_debug || debug;
|
||||
request->context = context;
|
||||
request->action = g_strdup (str_action);
|
||||
|
||||
request->envp = nm_dispatcher_utils_construct_envp (str_action,
|
||||
connection_dict,
|
||||
connection_props,
|
||||
device_props,
|
||||
device_ip4_props,
|
||||
device_ip6_props,
|
||||
device_dhcp4_props,
|
||||
device_dhcp6_props,
|
||||
vpn_ip_iface,
|
||||
vpn_ip4_props,
|
||||
vpn_ip6_props,
|
||||
&iface);
|
||||
|
||||
if (request->debug) {
|
||||
g_message ("------------ Action ID %p '%s' Interface %s Environment ------------",
|
||||
context, str_action, iface ? iface : "(none)");
|
||||
for (p = request->envp; *p; p++)
|
||||
g_message (" %s", *p);
|
||||
g_message ("\n");
|
||||
}
|
||||
|
||||
request->iface = g_strdup (iface);
|
||||
|
||||
request->scripts = g_ptr_array_new_full (5, script_info_free);
|
||||
for (iter = sorted_scripts; iter; iter = g_slist_next (iter)) {
|
||||
ScriptInfo *s = g_malloc0 (sizeof (*s));
|
||||
s->request = request;
|
||||
s->script = iter->data;
|
||||
g_ptr_array_add (request->scripts, s);
|
||||
}
|
||||
g_slist_free (sorted_scripts);
|
||||
|
||||
if (h->current_request)
|
||||
g_queue_push_tail (h->pending_requests, request);
|
||||
else
|
||||
start_request (request);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean ever_acquired_name = FALSE;
|
||||
|
||||
static void
|
||||
on_name_acquired (GDBusConnection *connection,
|
||||
const char *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
ever_acquired_name = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_name_lost (GDBusConnection *connection,
|
||||
const char *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (!connection) {
|
||||
g_warning ("Could not get the system bus. Make sure the message bus daemon is running!");
|
||||
exit (1);
|
||||
} else if (!ever_acquired_name) {
|
||||
g_warning ("Could not acquire the " NM_DISPATCHER_DBUS_SERVICE " service.");
|
||||
exit (1);
|
||||
} else {
|
||||
g_message ("Lost the " NM_DISPATCHER_DBUS_SERVICE " name. Exiting");
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
log_handler (const gchar *log_domain,
|
||||
GLogLevelFlags log_level,
|
||||
const gchar *message,
|
||||
gpointer ignored)
|
||||
{
|
||||
int syslog_priority;
|
||||
|
||||
switch (log_level) {
|
||||
case G_LOG_LEVEL_ERROR:
|
||||
syslog_priority = LOG_CRIT;
|
||||
break;
|
||||
case G_LOG_LEVEL_CRITICAL:
|
||||
syslog_priority = LOG_ERR;
|
||||
break;
|
||||
case G_LOG_LEVEL_WARNING:
|
||||
syslog_priority = LOG_WARNING;
|
||||
break;
|
||||
case G_LOG_LEVEL_MESSAGE:
|
||||
syslog_priority = LOG_NOTICE;
|
||||
break;
|
||||
case G_LOG_LEVEL_DEBUG:
|
||||
syslog_priority = LOG_DEBUG;
|
||||
break;
|
||||
case G_LOG_LEVEL_INFO:
|
||||
default:
|
||||
syslog_priority = LOG_INFO;
|
||||
break;
|
||||
}
|
||||
|
||||
syslog (syslog_priority, "%s", message);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
logging_setup (void)
|
||||
{
|
||||
openlog (G_LOG_DOMAIN, LOG_CONS, LOG_DAEMON);
|
||||
g_log_set_handler (G_LOG_DOMAIN,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
|
||||
log_handler,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
logging_shutdown (void)
|
||||
{
|
||||
closelog ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
signal_handler (gpointer user_data)
|
||||
{
|
||||
int signo = GPOINTER_TO_INT (user_data);
|
||||
|
||||
g_message ("Caught signal %d, shutting down...", signo);
|
||||
g_main_loop_quit (loop);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GOptionContext *opt_ctx;
|
||||
GError *error = NULL;
|
||||
GDBusConnection *bus;
|
||||
Handler *handler;
|
||||
|
||||
GOptionEntry entries[] = {
|
||||
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Output to console rather than syslog", NULL },
|
||||
{ "persist", 0, 0, G_OPTION_ARG_NONE, &persist, "Don't quit after a short timeout", NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
opt_ctx = g_option_context_new (NULL);
|
||||
g_option_context_set_summary (opt_ctx, "Executes scripts upon actions by NetworkManager.");
|
||||
g_option_context_add_main_entries (opt_ctx, entries, NULL);
|
||||
|
||||
if (!g_option_context_parse (opt_ctx, &argc, &argv, &error)) {
|
||||
g_warning ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_option_context_free (opt_ctx);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM));
|
||||
g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT));
|
||||
|
||||
if (!debug)
|
||||
logging_setup ();
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
||||
if (!bus) {
|
||||
g_warning ("Could not get the system bus (%s). Make sure the message bus daemon is running!",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
handler = g_object_new (HANDLER_TYPE, NULL);
|
||||
g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (handler->dbus_dispatcher),
|
||||
bus,
|
||||
NM_DISPATCHER_DBUS_PATH,
|
||||
&error);
|
||||
if (error) {
|
||||
g_warning ("Could not export Dispatcher D-Bus interface: %s", error->message);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_bus_own_name_on_connection (bus,
|
||||
NM_DISPATCHER_DBUS_SERVICE,
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||
on_name_acquired,
|
||||
on_name_lost,
|
||||
NULL, NULL);
|
||||
g_object_unref (bus);
|
||||
|
||||
if (!persist)
|
||||
quit_id = g_timeout_add_seconds (10, quit_timeout_cb, NULL);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
||||
g_queue_free (handler->pending_requests);
|
||||
g_object_unref (handler);
|
||||
|
||||
if (!debug)
|
||||
logging_shutdown ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
|
||||
<interface name="org.freedesktop.nm_dispatcher">
|
||||
<annotation name="org.gtk.GDBus.C.Name" value="Dispatcher"/>
|
||||
|
||||
<method name="Action">
|
||||
<tp:docstring>
|
||||
INTERNAL; not public API. Perform an action.
|
||||
</tp:docstring>
|
||||
|
||||
<arg name="action" type="s" direction="in">
|
||||
<tp:docstring>
|
||||
The action being performed.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="connection" type="a{sa{sv}}" direction="in">
|
||||
<tp:docstring>
|
||||
The connection for which this action was triggered.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="connection_properties" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the connection, including service and path.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="device_properties" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the device, including type, path, interface, and state.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="device_ip4_config" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the device's IPv4 configuration.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="device_ip6_config" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the device's IPv6 configuration.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="device_dhcp4_config" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the device's DHCPv4 configuration.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="device_dhcp6_config" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the device's DHCPv6 configuration.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="vpn_ip_iface" type="s" direction="in">
|
||||
<tp:docstring>VPN interface name.</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="vpn_ip4_config" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the VPN's IPv4 configuration.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="vpn_ip6_config" type="a{sv}" direction="in">
|
||||
<tp:docstring>
|
||||
Properties of the VPN's IPv6 configuration.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="debug" type="b" direction="in">
|
||||
<tp:docstring>
|
||||
Whether to log debug output.
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
<arg name="results" type="a(sus)" direction="out">
|
||||
<tp:docstring>
|
||||
Results of dispatching operations. Each element of the returned
|
||||
array is a struct containing the path of an executed script (s),
|
||||
the result of running that script (u), and a description of the
|
||||
result (s).
|
||||
</tp:docstring>
|
||||
</arg>
|
||||
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
if ENABLE_TESTS
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/libnm-core \
|
||||
-I$(top_builddir)/libnm-core \
|
||||
-I$(top_srcdir)/callouts \
|
||||
-I$(top_builddir)/callouts \
|
||||
-DNETWORKMANAGER_COMPILATION \
|
||||
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
|
||||
-DSRCDIR=\"$(abs_srcdir)\" \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(DBUS_CFLAGS)
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
test-dispatcher-envp
|
||||
|
||||
####### dispatcher envp #######
|
||||
|
||||
test_dispatcher_envp_SOURCES = \
|
||||
test-dispatcher-envp.c
|
||||
|
||||
test_dispatcher_envp_LDADD = \
|
||||
$(top_builddir)/libnm/libnm.la \
|
||||
$(top_builddir)/callouts/libtest-dispatcher-envp.la \
|
||||
$(GLIB_LIBS) \
|
||||
$(DBUS_LIBS)
|
||||
|
||||
###########################################
|
||||
|
||||
TESTS = test-dispatcher-envp
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST= \
|
||||
dispatcher-old-down \
|
||||
dispatcher-old-up \
|
||||
dispatcher-old-vpn-down \
|
||||
dispatcher-old-vpn-up
|
||||
|
|
@ -1,585 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-dispatcher-utils.h"
|
||||
#include "nm-dispatcher-api.h"
|
||||
|
||||
/*******************************************/
|
||||
|
||||
static gboolean
|
||||
parse_main (GKeyFile *kf,
|
||||
GVariant **out_con_dict,
|
||||
GVariant **out_con_props,
|
||||
char **out_expected_iface,
|
||||
char **out_action,
|
||||
char **out_vpn_ip_iface,
|
||||
GError **error)
|
||||
{
|
||||
char *uuid, *id;
|
||||
NMConnection *connection;
|
||||
NMSettingConnection *s_con;
|
||||
GVariantBuilder props;
|
||||
|
||||
*out_expected_iface = g_key_file_get_string (kf, "main", "expected-iface", error);
|
||||
if (*out_expected_iface == NULL)
|
||||
return FALSE;
|
||||
|
||||
*out_vpn_ip_iface = g_key_file_get_string (kf, "main", "vpn-ip-iface", NULL);
|
||||
|
||||
*out_action = g_key_file_get_string (kf, "main", "action", error);
|
||||
if (*out_action == NULL)
|
||||
return FALSE;
|
||||
|
||||
uuid = g_key_file_get_string (kf, "main", "uuid", error);
|
||||
if (uuid == NULL)
|
||||
return FALSE;
|
||||
id = g_key_file_get_string (kf, "main", "id", error);
|
||||
if (id == NULL)
|
||||
return FALSE;
|
||||
|
||||
connection = nm_simple_connection_new ();
|
||||
g_assert (connection);
|
||||
s_con = (NMSettingConnection *) nm_setting_connection_new ();
|
||||
g_assert (s_con);
|
||||
g_object_set (s_con,
|
||||
NM_SETTING_CONNECTION_UUID, uuid,
|
||||
NM_SETTING_CONNECTION_ID, id,
|
||||
NULL);
|
||||
g_free (uuid);
|
||||
g_free (id);
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_con));
|
||||
|
||||
*out_con_dict = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
|
||||
g_object_unref (connection);
|
||||
|
||||
g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
"connection-path",
|
||||
g_variant_new_object_path ("/org/freedesktop/NetworkManager/Connections/5"));
|
||||
*out_con_props = g_variant_builder_end (&props);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_device (GKeyFile *kf, GVariant **out_device_props, GError **error)
|
||||
{
|
||||
GVariantBuilder props;
|
||||
char *tmp;
|
||||
gint i;
|
||||
|
||||
g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
|
||||
|
||||
i = g_key_file_get_integer (kf, "device", "state", error);
|
||||
if (i == 0)
|
||||
return FALSE;
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
NMD_DEVICE_PROPS_STATE,
|
||||
g_variant_new_uint32 (i));
|
||||
|
||||
i = g_key_file_get_integer (kf, "device", "type", error);
|
||||
if (i == 0)
|
||||
return FALSE;
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
NMD_DEVICE_PROPS_TYPE,
|
||||
g_variant_new_uint32 (i));
|
||||
|
||||
tmp = g_key_file_get_string (kf, "device", "interface", error);
|
||||
if (tmp == NULL)
|
||||
return FALSE;
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
NMD_DEVICE_PROPS_INTERFACE,
|
||||
g_variant_new_string (tmp));
|
||||
g_free (tmp);
|
||||
|
||||
tmp = g_key_file_get_string (kf, "device", "ip-interface", error);
|
||||
if (tmp == NULL)
|
||||
return FALSE;
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
NMD_DEVICE_PROPS_IP_INTERFACE,
|
||||
g_variant_new_string (tmp));
|
||||
g_free (tmp);
|
||||
|
||||
tmp = g_key_file_get_string (kf, "device", "path", error);
|
||||
if (tmp == NULL)
|
||||
return FALSE;
|
||||
g_variant_builder_add (&props, "{sv}",
|
||||
NMD_DEVICE_PROPS_PATH,
|
||||
g_variant_new_object_path (tmp));
|
||||
g_free (tmp);
|
||||
|
||||
*out_device_props = g_variant_builder_end (&props);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_uint_array (GKeyFile *kf,
|
||||
GVariantBuilder *props,
|
||||
const char *section,
|
||||
const char *key,
|
||||
GError **error)
|
||||
{
|
||||
char *tmp;
|
||||
char **split, **iter;
|
||||
GArray *items;
|
||||
|
||||
tmp = g_key_file_get_string (kf, section, key, error);
|
||||
if (tmp == NULL) {
|
||||
g_clear_error (error);
|
||||
return TRUE;
|
||||
}
|
||||
split = g_strsplit_set (tmp, " ", -1);
|
||||
g_free (tmp);
|
||||
|
||||
if (g_strv_length (split) > 0) {
|
||||
items = g_array_sized_new (FALSE, TRUE, sizeof (guint32), g_strv_length (split));
|
||||
for (iter = split; iter && *iter; iter++) {
|
||||
if (strlen (g_strstrip (*iter))) {
|
||||
guint32 addr;
|
||||
|
||||
g_assert_cmpint (inet_pton (AF_INET, *iter, &addr), ==, 1);
|
||||
g_array_append_val (items, addr);
|
||||
}
|
||||
}
|
||||
g_variant_builder_add (props, "{sv}", key,
|
||||
g_variant_new_fixed_array (G_VARIANT_TYPE_UINT32,
|
||||
items->data, items->len,
|
||||
sizeof (guint32)));
|
||||
g_array_unref (items);
|
||||
}
|
||||
g_strfreev (split);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_ip4 (GKeyFile *kf, GVariant **out_props, const char *section, GError **error)
|
||||
{
|
||||
GVariantBuilder props;
|
||||
char *tmp;
|
||||
char **split, **iter;
|
||||
GPtrArray *addresses, *routes;
|
||||
|
||||
g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
|
||||
|
||||
/* search domains */
|
||||
/* Use char** for domains. (DBUS_TYPE_G_ARRAY_OF_STRING of NMIP4Config
|
||||
* becomes G_TYPE_STRV when sending the value over D-Bus)
|
||||
*/
|
||||
tmp = g_key_file_get_string (kf, section, "domains", error);
|
||||
if (tmp == NULL)
|
||||
return FALSE;
|
||||
split = g_strsplit_set (tmp, " ", -1);
|
||||
g_free (tmp);
|
||||
|
||||
if (g_strv_length (split) > 0) {
|
||||
for (iter = split; iter && *iter; iter++)
|
||||
g_strstrip (*iter);
|
||||
g_variant_builder_add (&props, "{sv}", "domains", g_variant_new_strv ((gpointer) split, -1));
|
||||
g_strfreev (split);
|
||||
}
|
||||
|
||||
/* nameservers */
|
||||
if (!add_uint_array (kf, &props, "ip4", "nameservers", error))
|
||||
return FALSE;
|
||||
/* wins-servers */
|
||||
if (!add_uint_array (kf, &props, "ip4", "wins-servers", error))
|
||||
return FALSE;
|
||||
|
||||
/* Addresses */
|
||||
tmp = g_key_file_get_string (kf, section, "addresses", error);
|
||||
if (tmp == NULL)
|
||||
return FALSE;
|
||||
split = g_strsplit_set (tmp, ",", -1);
|
||||
g_free (tmp);
|
||||
|
||||
if (g_strv_length (split) > 0) {
|
||||
addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip4_address_unref);
|
||||
for (iter = split; iter && *iter; iter++) {
|
||||
NMIP4Address *addr;
|
||||
guint32 a;
|
||||
char *p;
|
||||
|
||||
if (strlen (g_strstrip (*iter)) == 0)
|
||||
continue;
|
||||
|
||||
addr = nm_ip4_address_new ();
|
||||
|
||||
p = strchr (*iter, '/');
|
||||
g_assert (p);
|
||||
*p++ = '\0';
|
||||
|
||||
g_assert_cmpint (inet_pton (AF_INET, *iter, &a), ==, 1);
|
||||
nm_ip4_address_set_address (addr, a);
|
||||
nm_ip4_address_set_prefix (addr, (guint) atoi (p));
|
||||
|
||||
p = strchr (p, ' ');
|
||||
g_assert (p);
|
||||
p++;
|
||||
|
||||
g_assert_cmpint (inet_pton (AF_INET, p, &a), ==, 1);
|
||||
nm_ip4_address_set_gateway (addr, a);
|
||||
|
||||
g_ptr_array_add (addresses, addr);
|
||||
}
|
||||
|
||||
g_variant_builder_add (&props, "{sv}", "addresses",
|
||||
nm_utils_ip4_addresses_to_variant (addresses));
|
||||
g_ptr_array_unref (addresses);
|
||||
}
|
||||
g_strfreev (split);
|
||||
|
||||
/* Routes */
|
||||
tmp = g_key_file_get_string (kf, section, "routes", error);
|
||||
g_clear_error (error);
|
||||
if (tmp) {
|
||||
split = g_strsplit_set (tmp, ",", -1);
|
||||
g_free (tmp);
|
||||
|
||||
if (g_strv_length (split) > 0) {
|
||||
routes = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip4_route_unref);
|
||||
for (iter = split; iter && *iter; iter++) {
|
||||
NMIP4Route *route;
|
||||
guint32 a;
|
||||
char *p;
|
||||
|
||||
if (strlen (g_strstrip (*iter)) == 0)
|
||||
continue;
|
||||
|
||||
route = nm_ip4_route_new ();
|
||||
|
||||
p = strchr (*iter, '/');
|
||||
g_assert (p);
|
||||
*p++ = '\0';
|
||||
|
||||
g_assert_cmpint (inet_pton (AF_INET, *iter, &a), ==, 1);
|
||||
nm_ip4_route_set_dest (route, a);
|
||||
nm_ip4_route_set_prefix (route, (guint) atoi (p));
|
||||
|
||||
p = strchr (p, ' ');
|
||||
g_assert (p);
|
||||
p++;
|
||||
|
||||
g_assert_cmpint (inet_pton (AF_INET, p, &a), ==, 1);
|
||||
nm_ip4_route_set_next_hop (route, a);
|
||||
|
||||
p = strchr (p, ' ');
|
||||
g_assert (p);
|
||||
p++;
|
||||
nm_ip4_route_set_metric (route, (guint) atoi (p));
|
||||
|
||||
g_ptr_array_add (routes, route);
|
||||
}
|
||||
|
||||
g_variant_builder_add (&props, "{sv}", "routes",
|
||||
nm_utils_ip4_routes_to_variant (routes));
|
||||
g_ptr_array_unref (routes);
|
||||
}
|
||||
g_strfreev (split);
|
||||
}
|
||||
|
||||
*out_props = g_variant_builder_end (&props);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_dhcp (GKeyFile *kf,
|
||||
const char *group_name,
|
||||
GVariant **out_props,
|
||||
GError **error)
|
||||
{
|
||||
char **keys, **iter, *val;
|
||||
GVariantBuilder props;
|
||||
|
||||
keys = g_key_file_get_keys (kf, group_name, NULL, error);
|
||||
if (!keys)
|
||||
return FALSE;
|
||||
|
||||
g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
|
||||
for (iter = keys; iter && *iter; iter++) {
|
||||
val = g_key_file_get_string (kf, group_name, *iter, error);
|
||||
if (!val)
|
||||
return FALSE;
|
||||
g_variant_builder_add (&props, "{sv}", *iter, g_variant_new_string (val));
|
||||
g_free (val);
|
||||
}
|
||||
|
||||
*out_props = g_variant_builder_end (&props);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_dispatcher_file (const char *file,
|
||||
GVariant **out_con_dict,
|
||||
GVariant **out_con_props,
|
||||
GVariant **out_device_props,
|
||||
GVariant **out_device_ip4_props,
|
||||
GVariant **out_device_ip6_props,
|
||||
GVariant **out_device_dhcp4_props,
|
||||
GVariant **out_device_dhcp6_props,
|
||||
char **out_vpn_ip_iface,
|
||||
GVariant **out_vpn_ip4_props,
|
||||
GVariant **out_vpn_ip6_props,
|
||||
char **out_expected_iface,
|
||||
char **out_action,
|
||||
GHashTable **out_env,
|
||||
GError **error)
|
||||
{
|
||||
GKeyFile *kf;
|
||||
gboolean success = FALSE;
|
||||
char **keys, **iter, *val;
|
||||
|
||||
kf = g_key_file_new ();
|
||||
if (!g_key_file_load_from_file (kf, file, G_KEY_FILE_NONE, error))
|
||||
return FALSE;
|
||||
|
||||
if (!parse_main (kf,
|
||||
out_con_dict,
|
||||
out_con_props,
|
||||
out_expected_iface,
|
||||
out_action,
|
||||
out_vpn_ip_iface,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
if (!parse_device (kf, out_device_props, error))
|
||||
goto out;
|
||||
|
||||
if (g_key_file_has_group (kf, "ip4")) {
|
||||
if (!parse_ip4 (kf, out_device_ip4_props, "ip4", error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (g_key_file_has_group (kf, "dhcp4")) {
|
||||
if (!parse_dhcp (kf, "dhcp4", out_device_dhcp4_props, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (g_key_file_has_group (kf, "dhcp6")) {
|
||||
if (!parse_dhcp (kf, "dhcp6", out_device_dhcp4_props, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_assert (g_key_file_has_group (kf, "env"));
|
||||
keys = g_key_file_get_keys (kf, "env", NULL, error);
|
||||
*out_env = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
for (iter = keys; iter && *iter; iter++) {
|
||||
val = g_key_file_get_string (kf, "env", *iter, error);
|
||||
if (!val)
|
||||
goto out;
|
||||
g_hash_table_insert (*out_env,
|
||||
g_strdup_printf ("%s=%s", *iter, val),
|
||||
GUINT_TO_POINTER (1));
|
||||
g_free (val);
|
||||
}
|
||||
g_strfreev (keys);
|
||||
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
g_key_file_free (kf);
|
||||
return success;
|
||||
}
|
||||
|
||||
/*******************************************/
|
||||
|
||||
static void
|
||||
test_generic (const char *file, const char *override_vpn_ip_iface)
|
||||
{
|
||||
GVariant *con_dict = NULL;
|
||||
GVariant *con_props = NULL;
|
||||
GVariant *device_props = NULL;
|
||||
GVariant *device_ip4_props = NULL;
|
||||
GVariant *device_ip6_props = NULL;
|
||||
GVariant *device_dhcp4_props = NULL;
|
||||
GVariant *device_dhcp6_props = NULL;
|
||||
char *vpn_ip_iface = NULL;
|
||||
GVariant *vpn_ip4_props = NULL;
|
||||
GVariant *vpn_ip6_props = NULL;
|
||||
char *expected_iface = NULL;
|
||||
char *action = NULL;
|
||||
char *out_iface = NULL;
|
||||
GHashTable *expected_env = NULL;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
char *p;
|
||||
char **denv, **iter;
|
||||
|
||||
/* Read in the test file */
|
||||
p = g_build_filename (SRCDIR, file, NULL);
|
||||
success = get_dispatcher_file (p,
|
||||
&con_dict,
|
||||
&con_props,
|
||||
&device_props,
|
||||
&device_ip4_props,
|
||||
&device_ip6_props,
|
||||
&device_dhcp4_props,
|
||||
&device_dhcp6_props,
|
||||
&vpn_ip_iface,
|
||||
&vpn_ip4_props,
|
||||
&vpn_ip6_props,
|
||||
&expected_iface,
|
||||
&action,
|
||||
&expected_env,
|
||||
&error);
|
||||
g_free (p);
|
||||
g_assert_no_error (error);
|
||||
g_assert (success);
|
||||
|
||||
/* Get the environment from the dispatcher code */
|
||||
denv = nm_dispatcher_utils_construct_envp (action,
|
||||
con_dict,
|
||||
con_props,
|
||||
device_props,
|
||||
device_ip4_props,
|
||||
device_ip6_props,
|
||||
device_dhcp4_props,
|
||||
device_dhcp6_props,
|
||||
override_vpn_ip_iface ? override_vpn_ip_iface : vpn_ip_iface,
|
||||
vpn_ip4_props,
|
||||
vpn_ip6_props,
|
||||
&out_iface);
|
||||
|
||||
/* Print out environment for now */
|
||||
#ifdef DEBUG
|
||||
g_message ("\n******* Generated environment:");
|
||||
for (iter = denv; iter && *iter; iter++)
|
||||
g_message (" %s", *iter);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
GHashTableIter k;
|
||||
const char *key;
|
||||
|
||||
g_message ("\n******* Expected environment:");
|
||||
g_hash_table_iter_init (&k, expected_env);
|
||||
while (g_hash_table_iter_next (&k, (gpointer) &key, NULL))
|
||||
g_message (" %s", key);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_assert_cmpint (g_strv_length (denv), ==, g_hash_table_size (expected_env));
|
||||
|
||||
/* Compare dispatcher generated env and expected env */
|
||||
for (iter = denv; iter && *iter; iter++) {
|
||||
gpointer foo;
|
||||
const char *i_value = *iter;
|
||||
|
||||
if (strstr (i_value, "PATH=") == i_value) {
|
||||
g_assert_cmpstr (&i_value[strlen("PATH=")], ==, g_getenv ("PATH"));
|
||||
|
||||
/* The path is constructed dynamically. Ignore the actual value. */
|
||||
i_value = "PATH=";
|
||||
}
|
||||
|
||||
foo = g_hash_table_lookup (expected_env, i_value);
|
||||
if (!foo)
|
||||
g_warning ("Failed to find %s in environment", i_value);
|
||||
g_assert (foo);
|
||||
}
|
||||
|
||||
g_assert_cmpstr (expected_iface, ==, out_iface);
|
||||
|
||||
g_free (out_iface);
|
||||
g_free (vpn_ip_iface);
|
||||
g_free (expected_iface);
|
||||
g_free (action);
|
||||
g_variant_unref (con_dict);
|
||||
g_variant_unref (con_props);
|
||||
g_variant_unref (device_props);
|
||||
if (device_ip4_props)
|
||||
g_variant_unref (device_ip4_props);
|
||||
if (device_ip6_props)
|
||||
g_variant_unref (device_ip6_props);
|
||||
if (device_dhcp4_props)
|
||||
g_variant_unref (device_dhcp4_props);
|
||||
if (device_dhcp6_props)
|
||||
g_variant_unref (device_dhcp6_props);
|
||||
if (vpn_ip4_props)
|
||||
g_variant_unref (vpn_ip4_props);
|
||||
if (vpn_ip6_props)
|
||||
g_variant_unref (vpn_ip6_props);
|
||||
g_hash_table_destroy (expected_env);
|
||||
}
|
||||
|
||||
/*******************************************/
|
||||
|
||||
static void
|
||||
test_old_up (void)
|
||||
{
|
||||
test_generic ("dispatcher-old-up", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_old_down (void)
|
||||
{
|
||||
test_generic ("dispatcher-old-down", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_old_vpn_up (void)
|
||||
{
|
||||
test_generic ("dispatcher-old-vpn-up", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_old_vpn_down (void)
|
||||
{
|
||||
test_generic ("dispatcher-old-vpn-down", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_up_empty_vpn_iface (void)
|
||||
{
|
||||
/* Test that an empty VPN iface variable, like is passed through D-Bus
|
||||
* from NM, is ignored by the dispatcher environment construction code.
|
||||
*/
|
||||
test_generic ("dispatcher-old-up", "");
|
||||
}
|
||||
|
||||
/*******************************************/
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
g_test_add_func ("/dispatcher/old_up", test_old_up);
|
||||
g_test_add_func ("/dispatcher/old_down", test_old_down);
|
||||
g_test_add_func ("/dispatcher/old_vpn_up", test_old_vpn_up);
|
||||
g_test_add_func ("/dispatcher/old_vpn_down", test_old_vpn_down);
|
||||
|
||||
g_test_add_func ("/dispatcher/up_empty_vpn_iface", test_up_empty_vpn_iface);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
SUBDIRS = cli tui
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I${top_srcdir}/libnm-core \
|
||||
-I${top_builddir}/libnm-core \
|
||||
-I${top_srcdir}/libnm \
|
||||
-I${top_builddir}/libnm \
|
||||
$(GLIB_CFLAGS) \
|
||||
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
|
||||
-DNMLOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
bin_PROGRAMS = nm-online
|
||||
|
||||
nm_online_SOURCES = nm-online.c
|
||||
nm_online_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\""nm-online"\" \
|
||||
$(AM_CPPFLAGS)
|
||||
|
||||
nm_online_LDADD = \
|
||||
$(top_builddir)/libnm/libnm.la \
|
||||
$(GLIB_LIBS)
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
bin_PROGRAMS = \
|
||||
nmcli
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I${top_srcdir} \
|
||||
-I${top_builddir} \
|
||||
-I${top_srcdir}/include \
|
||||
-I${top_srcdir}/libnm-core \
|
||||
-I${top_builddir}/libnm-core \
|
||||
-I${top_srcdir}/libnm \
|
||||
-I${top_builddir}/libnm \
|
||||
$(GLIB_CFLAGS) \
|
||||
-DG_LOG_DOMAIN=\""nmcli"\" \
|
||||
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
|
||||
-DNMCLI_LOCALEDIR=\"$(datadir)/locale\"
|
||||
|
||||
nmcli_SOURCES = \
|
||||
common.c \
|
||||
common.h \
|
||||
connections.c \
|
||||
connections.h \
|
||||
devices.c \
|
||||
devices.h \
|
||||
general.c \
|
||||
general.h \
|
||||
settings.c \
|
||||
settings.h \
|
||||
nmcli.c \
|
||||
nmcli.h \
|
||||
utils.c \
|
||||
utils.h
|
||||
|
||||
nmcli_LDADD = \
|
||||
$(GLIB_LIBS) \
|
||||
$(READLINE_LIBS) \
|
||||
$(top_builddir)/libnm/libnm.la
|
||||
|
||||
if BUILD_SETTING_DOCS
|
||||
settings-docs.c: settings-docs.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml
|
||||
$(AM_V_GEN) xsltproc --output $@ $^
|
||||
|
||||
BUILT_SOURCES = settings-docs.c
|
||||
endif
|
||||
|
||||
DISTCLEANFILES = settings-docs.c
|
||||
|
||||
EXTRA_DIST = settings-docs.c settings-docs.xsl
|
||||
|
||||
completiondir = $(datadir)/bash-completion/completions
|
||||
|
||||
install-data-hook:
|
||||
$(mkinstalldirs) $(DESTDIR)$(completiondir)
|
||||
$(INSTALL_DATA) $(srcdir)/nmcli-completion $(DESTDIR)$(completiondir)/nmcli
|
||||
|
||||
uninstall-hook:
|
||||
rm -f $(DESTDIR)$(completiondir)/nmcli
|
||||
|
||||
EXTRA_DIST += nmcli-completion
|
||||
220
clients/cli/agent.c
Normal file
220
clients/cli/agent.c
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "agent.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
#include "nm-secret-agent-simple.h"
|
||||
#include "polkit-agent.h"
|
||||
|
||||
static void
|
||||
usage (void)
|
||||
{
|
||||
g_printerr (_("Usage: nmcli agent { COMMAND | help }\n\n"
|
||||
"COMMAND := { secret | polkit | all }\n\n"
|
||||
));
|
||||
}
|
||||
|
||||
static void
|
||||
usage_agent_secret (void)
|
||||
{
|
||||
g_printerr (_("Usage: nmcli agent secret { help }\n"
|
||||
"\n"
|
||||
"Runs nmcli as NetworkManager secret agent. When NetworkManager requires\n"
|
||||
"a password it asks registered agents for it. This command keeps nmcli running\n"
|
||||
"and if a password is required asks the user for it.\n\n"));
|
||||
}
|
||||
|
||||
static void
|
||||
usage_agent_polkit (void)
|
||||
{
|
||||
g_printerr (_("Usage: nmcli agent polkit { help }\n"
|
||||
"\n"
|
||||
"Registers nmcli as a polkit action for the user session.\n"
|
||||
"When a polkit daemon requires an authorization, nmcli asks the user and gives\n"
|
||||
"the response back to polkit.\n\n"));
|
||||
}
|
||||
|
||||
static void
|
||||
usage_agent_all (void)
|
||||
{
|
||||
g_printerr (_("Usage: nmcli agent all { help }\n"
|
||||
"\n"
|
||||
"Runs nmcli as both NetworkManager secret and a polkit agent.\n\n"));
|
||||
}
|
||||
|
||||
/* for pre-filling a string to readline prompt */
|
||||
static char *pre_input_deftext;
|
||||
static int
|
||||
set_deftext (void)
|
||||
{
|
||||
if (pre_input_deftext && rl_startup_hook) {
|
||||
rl_insert_text (pre_input_deftext);
|
||||
g_free (pre_input_deftext);
|
||||
pre_input_deftext = NULL;
|
||||
rl_startup_hook = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_secrets_from_user (const NmcConfig *nmc_config,
|
||||
const char *request_id,
|
||||
const char *title,
|
||||
const char *msg,
|
||||
GPtrArray *secrets)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < secrets->len; i++) {
|
||||
NMSecretAgentSimpleSecret *secret = secrets->pdata[i];
|
||||
char *pwd = NULL;
|
||||
|
||||
/* Ask user for the password */
|
||||
if (msg)
|
||||
g_print ("%s\n", msg);
|
||||
if (secret->value) {
|
||||
/* Prefill the password if we have it. */
|
||||
rl_startup_hook = set_deftext;
|
||||
pre_input_deftext = g_strdup (secret->value);
|
||||
}
|
||||
if (secret->no_prompt_entry_id)
|
||||
pwd = nmc_readline (nmc_config, "%s: ", secret->pretty_name);
|
||||
else
|
||||
pwd = nmc_readline (nmc_config, "%s (%s): ", secret->pretty_name, secret->entry_id);
|
||||
|
||||
/* No password provided, cancel the secrets. */
|
||||
if (!pwd)
|
||||
return FALSE;
|
||||
g_free (secret->value);
|
||||
secret->value = pwd;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
secrets_requested (NMSecretAgentSimple *agent,
|
||||
const char *request_id,
|
||||
const char *title,
|
||||
const char *msg,
|
||||
GPtrArray *secrets,
|
||||
gpointer user_data)
|
||||
{
|
||||
NmCli *nmc = user_data;
|
||||
gboolean success;
|
||||
|
||||
if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY)
|
||||
nmc_terminal_erase_line ();
|
||||
|
||||
success = get_secrets_from_user (&nmc->nmc_config, request_id, title, msg, secrets);
|
||||
nm_secret_agent_simple_response (agent,
|
||||
request_id,
|
||||
success ? secrets : NULL);
|
||||
}
|
||||
|
||||
static NMCResultCode
|
||||
do_agent_secret (NmCli *nmc, int argc, char **argv)
|
||||
{
|
||||
next_arg (nmc, &argc, &argv, NULL);
|
||||
if (nmc->complete)
|
||||
return nmc->return_value;
|
||||
|
||||
/* Create secret agent */
|
||||
nmc->secret_agent = nm_secret_agent_simple_new ("nmcli-agent");
|
||||
if (nmc->secret_agent) {
|
||||
/* We keep running */
|
||||
nmc->should_wait++;
|
||||
|
||||
nm_secret_agent_simple_enable (nmc->secret_agent, NULL);
|
||||
g_signal_connect (nmc->secret_agent,
|
||||
NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS,
|
||||
G_CALLBACK (secrets_requested),
|
||||
nmc);
|
||||
g_print (_("nmcli successfully registered as a NetworkManager's secret agent.\n"));
|
||||
} else {
|
||||
g_string_printf (nmc->return_text, _("Error: secret agent initialization failed"));
|
||||
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
return nmc->return_value;
|
||||
}
|
||||
|
||||
static NMCResultCode
|
||||
do_agent_polkit (NmCli *nmc, int argc, char **argv)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
next_arg (nmc, &argc, &argv, NULL);
|
||||
if (nmc->complete)
|
||||
return nmc->return_value;
|
||||
|
||||
/* Initialize polkit agent */
|
||||
if (!nmc_polkit_agent_init (nmc, TRUE, &error)) {
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
g_string_printf (nmc->return_text, _("Error: polkit agent initialization failed: %s"),
|
||||
error->message);
|
||||
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
|
||||
g_error_free (error);
|
||||
} else {
|
||||
/* We keep running */
|
||||
nmc->should_wait++;
|
||||
|
||||
g_print (_("nmcli successfully registered as a polkit agent.\n"));
|
||||
}
|
||||
|
||||
return nmc->return_value;
|
||||
}
|
||||
|
||||
static NMCResultCode
|
||||
do_agent_all (NmCli *nmc, int argc, char **argv)
|
||||
{
|
||||
NMCResultCode secret_res;
|
||||
|
||||
next_arg (nmc, &argc, &argv, NULL);
|
||||
if (nmc->complete)
|
||||
return nmc->return_value;
|
||||
|
||||
/* Run both secret and polkit agent */
|
||||
secret_res = do_agent_secret (nmc, argc, argv);
|
||||
if (secret_res != NMC_RESULT_SUCCESS) {
|
||||
g_printerr ("%s\n", nmc->return_text->str);
|
||||
g_string_truncate (nmc->return_text, 0);
|
||||
}
|
||||
|
||||
nmc->return_value = do_agent_polkit (nmc, argc, argv);
|
||||
if (nmc->return_value != NMC_RESULT_SUCCESS) {
|
||||
g_printerr ("%s\n", nmc->return_text->str);
|
||||
g_string_truncate (nmc->return_text, 0);
|
||||
}
|
||||
|
||||
if (nmc->return_value == NMC_RESULT_SUCCESS && secret_res != NMC_RESULT_SUCCESS)
|
||||
nmc->return_value = secret_res;
|
||||
|
||||
return nmc->return_value;
|
||||
}
|
||||
|
||||
static const NMCCommand agent_cmds[] = {
|
||||
{ "secret", do_agent_secret, usage_agent_secret, TRUE, TRUE },
|
||||
{ "polkit", do_agent_polkit, usage_agent_polkit, TRUE, TRUE },
|
||||
{ "all", do_agent_all, usage_agent_all, TRUE, TRUE },
|
||||
{ NULL, do_agent_all, usage, TRUE, TRUE },
|
||||
};
|
||||
|
||||
NMCResultCode
|
||||
do_agent (NmCli *nmc, int argc, char **argv)
|
||||
{
|
||||
next_arg (nmc, &argc, &argv, NULL);
|
||||
nmc_do_cmd (nmc, agent_cmds, *argv, argc, argv);
|
||||
|
||||
return nmc->return_value;
|
||||
}
|
||||
13
clients/cli/agent.h
Normal file
13
clients/cli/agent.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NMC_AGENT_H__
|
||||
#define __NMC_AGENT_H__
|
||||
|
||||
#include "nmcli.h"
|
||||
|
||||
NMCResultCode do_agent (NmCli *nmc, int argc, char **argv);
|
||||
|
||||
#endif /* __NMC_AGENT_H__ */
|
||||
2312
clients/cli/common.c
2312
clients/cli/common.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,60 +1,97 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* nmcli - command-line tool for controlling NetworkManager
|
||||
* Common functions and data shared between files.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2012 - 2014 Red Hat, Inc.
|
||||
* Copyright (C) 2012 - 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMC_COMMON_H
|
||||
#define NMC_COMMON_H
|
||||
|
||||
#include "nmcli.h"
|
||||
#include "nm-secret-agent-simple.h"
|
||||
|
||||
gboolean print_ip4_config (NMIP4Config *cfg4, NmCli *nmc, const char *group_prefix, const char *one_field);
|
||||
gboolean print_ip6_config (NMIP6Config *cfg6, NmCli *nmc, const char *group_prefix, const char *one_field);
|
||||
gboolean print_dhcp4_config (NMDhcp4Config *dhcp4, NmCli *nmc, const char *group_prefix, const char *one_field);
|
||||
gboolean print_dhcp6_config (NMDhcp6Config *dhcp6, NmCli *nmc, const char *group_prefix, const char *one_field);
|
||||
|
||||
NMIP4Address *nmc_parse_and_build_ip4_address (const char *ip_str, const char *gw_str, GError **error);
|
||||
NMIP6Address *nmc_parse_and_build_ip6_address (const char *ip_str, const char *gw_str, GError **error);
|
||||
gboolean print_ip_config (NMIPConfig *cfg,
|
||||
int addr_family,
|
||||
const NmcConfig *nmc_config,
|
||||
const char *one_field);
|
||||
|
||||
NMIP4Route *nmc_parse_and_build_ip4_route (const char *first, const char *second, const char *third, GError **error);
|
||||
NMIP6Route *nmc_parse_and_build_ip6_route (const char *first, const char *second, const char *third, GError **error);
|
||||
|
||||
const char * nmc_device_state_to_string (NMDeviceState state);
|
||||
const char * nmc_device_reason_to_string (NMDeviceStateReason reason);
|
||||
|
||||
char **
|
||||
nmc_vlan_parse_priority_maps (const char *priority_map,
|
||||
NMVlanPriorityMap map_type,
|
||||
GError **error);
|
||||
|
||||
const char *nmc_bond_validate_mode (const char *mode, GError **error);
|
||||
gboolean nmc_team_check_config (const char *config, char **out_config, GError **error);
|
||||
gboolean print_dhcp_config (NMDhcpConfig *dhcp,
|
||||
int addr_family,
|
||||
const NmcConfig *nmc_config,
|
||||
const char *one_field);
|
||||
|
||||
NMConnection *nmc_find_connection (const GPtrArray *connections,
|
||||
const char *filter_type,
|
||||
const char *filter_val,
|
||||
int *start);
|
||||
GPtrArray **out_result,
|
||||
gboolean complete);
|
||||
|
||||
NMActiveConnection *nmc_find_active_connection (const GPtrArray *active_cons,
|
||||
const char *filter_type,
|
||||
const char *filter_val,
|
||||
GPtrArray **out_result,
|
||||
gboolean complete);
|
||||
|
||||
void nmc_secrets_requested (NMSecretAgentSimple *agent,
|
||||
const char *request_id,
|
||||
const char *title,
|
||||
const char *msg,
|
||||
GPtrArray *secrets,
|
||||
gpointer user_data);
|
||||
|
||||
char *nmc_unique_connection_name (const GPtrArray *connections,
|
||||
const char *try_name);
|
||||
|
||||
void nmc_cleanup_readline (void);
|
||||
char *nmc_readline (const char *prompt_fmt, ...) G_GNUC_PRINTF (1, 2);
|
||||
char *nmc_rl_gen_func_basic (const char *text, int state, const char **words);
|
||||
char *nmc_readline (const NmcConfig *nmc_config,
|
||||
const char *prompt_fmt,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
char *nmc_readline_echo (const NmcConfig *nmc_config,
|
||||
gboolean echo_on,
|
||||
const char *prompt_fmt,
|
||||
...) G_GNUC_PRINTF (3, 4);
|
||||
NmcCompEntryFunc nmc_rl_compentry_func_wrap (const char *const*values);
|
||||
char *nmc_rl_gen_func_basic (const char *text, int state, const char *const*words);
|
||||
char *nmc_rl_gen_func_ifnames (const char *text, int state);
|
||||
gboolean nmc_get_in_readline (void);
|
||||
void nmc_set_in_readline (gboolean in_readline);
|
||||
|
||||
/* for pre-filling a string to readline prompt */
|
||||
extern char *nmc_rl_pre_input_deftext;
|
||||
int nmc_rl_set_deftext (void);
|
||||
|
||||
char *nmc_parse_lldp_capabilities (guint value);
|
||||
|
||||
typedef struct {
|
||||
const char *cmd;
|
||||
NMCResultCode (*func) (NmCli *nmc, int argc, char **argv);
|
||||
void (*usage) (void);
|
||||
gboolean needs_client;
|
||||
gboolean needs_nm_running;
|
||||
} NMCCommand;
|
||||
|
||||
void nmc_do_cmd (NmCli *nmc, const NMCCommand cmds[], const char *cmd, int argc, char **argv);
|
||||
|
||||
void nmc_complete_strv (const char *prefix, gssize nargs, const char *const*args);
|
||||
|
||||
#define nmc_complete_strings(prefix, ...) nmc_complete_strv ((prefix), NM_NARG (__VA_ARGS__), (const char *const[]) { __VA_ARGS__ })
|
||||
|
||||
void nmc_complete_bool (const char *prefix);
|
||||
|
||||
const char *nmc_error_get_simple_message (GError *error);
|
||||
|
||||
extern const NmcMetaGenericInfo *const metagen_ip4_config[];
|
||||
extern const NmcMetaGenericInfo *const metagen_ip6_config[];
|
||||
extern const NmcMetaGenericInfo *const metagen_dhcp_config[];
|
||||
|
||||
const char *nm_connectivity_to_string (NMConnectivityState connectivity);
|
||||
|
||||
GVariant *nmc_dbus_call_sync (NmCli *nmc,
|
||||
const char *object_path,
|
||||
const char *interface_name,
|
||||
const char *method_name,
|
||||
GVariant *parameters,
|
||||
const GVariantType *reply_type,
|
||||
GError **error);
|
||||
|
||||
#endif /* NMC_COMMON_H */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,20 +1,6 @@
|
|||
/* nmcli - command-line tool to control NetworkManager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2010 - 2014 Red Hat, Inc.
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMC_CONNECTIONS_H
|
||||
|
|
@ -24,4 +10,22 @@
|
|||
|
||||
NMCResultCode do_connections (NmCli *nmc, int argc, char **argv);
|
||||
|
||||
void monitor_connections (NmCli *nmc);
|
||||
|
||||
gboolean
|
||||
nmc_read_connection_properties (NmCli *nmc,
|
||||
NMConnection *connection,
|
||||
int *argc,
|
||||
char ***argv,
|
||||
GError **error);
|
||||
|
||||
NMMetaColor nmc_active_connection_state_to_color (NMActiveConnectionState state);
|
||||
|
||||
int nmc_active_connection_cmp (NMActiveConnection *ac_a, NMActiveConnection *ac_b);
|
||||
|
||||
extern const NmcMetaGenericInfo *const metagen_con_show[];
|
||||
extern const NmcMetaGenericInfo *const metagen_con_active_general[];
|
||||
extern const NmcMetaGenericInfo *const metagen_con_active_vpn[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_con_active_details_groups[];
|
||||
|
||||
#endif /* NMC_CONNECTIONS_H */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,20 +1,6 @@
|
|||
/* nmcli - command-line tool to control NetworkManager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2010 Red Hat, Inc.
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMC_DEVICES_H
|
||||
|
|
@ -24,4 +10,30 @@
|
|||
|
||||
NMCResultCode do_devices (NmCli *nmc, int argc, char **argv);
|
||||
|
||||
void nmc_complete_device (NMClient *client, const char *prefix, gboolean wifi_only);
|
||||
|
||||
void nmc_complete_bssid (NMClient *client, const char *ifname, const char *bssid_prefix);
|
||||
|
||||
void monitor_devices (NmCli *nmc);
|
||||
|
||||
NMDevice ** nmc_get_devices_sorted (NMClient *client);
|
||||
|
||||
NMMetaColor nmc_device_state_to_color (NMDeviceState state);
|
||||
|
||||
extern const NmcMetaGenericInfo *const metagen_device_status[];
|
||||
extern const NmcMetaGenericInfo *const metagen_device_detail_general[];
|
||||
extern const NmcMetaGenericInfo *const metagen_device_detail_connections[];
|
||||
extern const NmcMetaGenericInfo *const metagen_device_detail_capabilities[];
|
||||
extern const NmcMetaGenericInfo *const metagen_device_detail_wired_properties[];
|
||||
extern const NmcMetaGenericInfo *const metagen_device_detail_wifi_properties[];
|
||||
extern const NmcMetaGenericInfo *const metagen_device_detail_wimax_properties[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_wifi_list[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_wimax_list[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_master_prop[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_team_prop[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_vlan_prop[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_bluetooth[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_show_sections[];
|
||||
extern const NmcMetaGenericInfo *const nmc_fields_dev_lldp_list[];
|
||||
|
||||
#endif /* NMC_DEVICES_H */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,20 +1,6 @@
|
|||
/* nmcli - command-line tool to control NetworkManager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2010 - 2014 Red Hat, Inc.
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMC_GENERAL_H
|
||||
|
|
@ -25,5 +11,7 @@
|
|||
NMCResultCode do_general (NmCli *nmc, int argc, char **argv);
|
||||
NMCResultCode do_networking (NmCli *nmc, int argc, char **argv);
|
||||
NMCResultCode do_radio (NmCli *nmc, int argc, char **argv);
|
||||
NMCResultCode do_monitor (NmCli *nmc, int argc, char **argv);
|
||||
NMCResultCode do_overview (NmCli *nmc, int argc, char **argv);
|
||||
|
||||
#endif /* NMC_GENERAL_H */
|
||||
|
|
|
|||
41
clients/cli/meson.build
Normal file
41
clients/cli/meson.build
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
name = 'nmcli'
|
||||
|
||||
# FIXME: nmcli-completion should be renamed to nmcli
|
||||
install_data(
|
||||
'nmcli-completion',
|
||||
install_dir: join_paths(nm_datadir, 'bash-completion', 'completions'),
|
||||
)
|
||||
|
||||
sources = files(
|
||||
'agent.c',
|
||||
'common.c',
|
||||
'connections.c',
|
||||
'devices.c',
|
||||
'general.c',
|
||||
'nmcli.c',
|
||||
'polkit-agent.c',
|
||||
'settings.c',
|
||||
'utils.c',
|
||||
)
|
||||
|
||||
deps = [
|
||||
libnmc_base_dep,
|
||||
libnmc_dep,
|
||||
readline_dep,
|
||||
]
|
||||
|
||||
if enable_polkit_agent
|
||||
sources += nm_polkit_listener
|
||||
|
||||
deps += polkit_agent_dep
|
||||
endif
|
||||
|
||||
executable(
|
||||
name,
|
||||
sources,
|
||||
dependencies: deps,
|
||||
c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)],
|
||||
link_args: ldflags_linker_script_binary,
|
||||
link_depends: linker_script_binary,
|
||||
install: true,
|
||||
)
|
||||
File diff suppressed because it is too large
Load diff
1271
clients/cli/nmcli.c
1271
clients/cli/nmcli.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,26 +1,17 @@
|
|||
/* nmcli - command-line tool to control NetworkManager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2010 - 2014 Red Hat, Inc.
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMC_NMCLI_H
|
||||
#define NMC_NMCLI_H
|
||||
|
||||
#include <NetworkManager.h>
|
||||
#include "nm-secret-agent-simple.h"
|
||||
#include "nm-meta-setting-desc.h"
|
||||
|
||||
struct _NMPolkitListener;
|
||||
|
||||
typedef char *(*NmcCompEntryFunc) (const char *, int);
|
||||
|
||||
/* nmcli exit codes */
|
||||
typedef enum {
|
||||
|
|
@ -51,11 +42,14 @@ typedef enum {
|
|||
/* NetworkManager is not running */
|
||||
NMC_RESULT_ERROR_NM_NOT_RUNNING = 8,
|
||||
|
||||
/* nmcli and NetworkManager versions mismatch */
|
||||
/* No more used, keep to preserve API */
|
||||
NMC_RESULT_ERROR_VERSIONS_MISMATCH = 9,
|
||||
|
||||
/* Connection/Device/AP not found */
|
||||
NMC_RESULT_ERROR_NOT_FOUND = 10
|
||||
NMC_RESULT_ERROR_NOT_FOUND = 10,
|
||||
|
||||
/* --complete-args signals a file name may follow */
|
||||
NMC_RESULT_COMPLETE_FILE = 65,
|
||||
} NMCResultCode;
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -64,79 +58,104 @@ typedef enum {
|
|||
NMC_PRINT_PRETTY = 2
|
||||
} NMCPrintOutput;
|
||||
|
||||
/* === Output fields === */
|
||||
/* Flags for NmcOutputField */
|
||||
#define NMC_OF_FLAG_FIELD_NAMES 0x00000001 /* Print field names instead of values */
|
||||
#define NMC_OF_FLAG_SECTION_PREFIX 0x00000002 /* Use the first value as section prefix for the other field names - just in multiline */
|
||||
#define NMC_OF_FLAG_MAIN_HEADER_ADD 0x00000004 /* Print main header in addition to values/field names */
|
||||
#define NMC_OF_FLAG_MAIN_HEADER_ONLY 0x00000008 /* Print main header only */
|
||||
static inline NMMetaAccessorGetType
|
||||
nmc_print_output_to_accessor_get_type (NMCPrintOutput print_output)
|
||||
{
|
||||
return NM_IN_SET (print_output, NMC_PRINT_NORMAL, NMC_PRINT_PRETTY)
|
||||
? NM_META_ACCESSOR_GET_TYPE_PRETTY
|
||||
: NM_META_ACCESSOR_GET_TYPE_PARSABLE;
|
||||
}
|
||||
|
||||
typedef struct _NmcOutputField {
|
||||
const char *name; /* Field's name */
|
||||
const char *name_l10n; /* Field's name for translation */
|
||||
/* === Output fields === */
|
||||
|
||||
typedef enum {
|
||||
NMC_OF_FLAG_FIELD_NAMES = 0x00000001, /* Print field names instead of values */
|
||||
NMC_OF_FLAG_SECTION_PREFIX = 0x00000002, /* Use the first value as section prefix for the other field names - just in multiline */
|
||||
NMC_OF_FLAG_MAIN_HEADER_ADD = 0x00000004, /* Print main header in addition to values/field names */
|
||||
NMC_OF_FLAG_MAIN_HEADER_ONLY = 0x00000008, /* Print main header only */
|
||||
} NmcOfFlags;
|
||||
|
||||
extern const NMMetaType nmc_meta_type_generic_info;
|
||||
|
||||
typedef struct _NmcOutputField NmcOutputField;
|
||||
typedef struct _NmcMetaGenericInfo NmcMetaGenericInfo;
|
||||
|
||||
struct _NmcOutputField {
|
||||
const NMMetaAbstractInfo *info;
|
||||
int width; /* Width in screen columns */
|
||||
struct _NmcOutputField *group; /* Points to an array with available section field names if this is a section (group) field */
|
||||
void *value; /* Value of current field - char* or char** (NULL-terminated array) */
|
||||
gboolean value_is_array; /* Whether value is char** instead of char* */
|
||||
gboolean free_value; /* Whether to free the value */
|
||||
guint32 flags; /* Flags - whether and how to print values/field names/headers */
|
||||
} NmcOutputField;
|
||||
NmcOfFlags flags; /* Flags - whether and how to print values/field names/headers */
|
||||
NMMetaColor color; /* Use this color to print value */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GArray *indices; /* Array of field indices to the array of allowed fields */
|
||||
char *header_name; /* Name of the output */
|
||||
int indent; /* Indent by this number of spaces */
|
||||
} NmcPrintFields;
|
||||
typedef struct _NmcConfig {
|
||||
NMCPrintOutput print_output; /* Output mode */
|
||||
bool use_colors; /* Whether to use colors for output: option '--color' */
|
||||
bool multiline_output; /* Multiline output instead of default tabular */
|
||||
bool escape_values; /* Whether to escape ':' and '\' in terse tabular mode */
|
||||
bool in_editor; /* Whether running the editor - nmcli con edit' */
|
||||
bool show_secrets; /* Whether to display secrets (both input and output): option '--show-secrets' */
|
||||
bool overview; /* Overview mode (hide default values) */
|
||||
const char *palette[_NM_META_COLOR_NUM]; /* Color palette */
|
||||
} NmcConfig;
|
||||
|
||||
typedef enum {
|
||||
NMC_TERM_COLOR_NORMAL = 0,
|
||||
NMC_TERM_COLOR_BLACK = 1,
|
||||
NMC_TERM_COLOR_RED = 2,
|
||||
NMC_TERM_COLOR_GREEN = 3,
|
||||
NMC_TERM_COLOR_YELLOW = 4,
|
||||
NMC_TERM_COLOR_BLUE = 5,
|
||||
NMC_TERM_COLOR_MAGENTA = 6,
|
||||
NMC_TERM_COLOR_CYAN = 7,
|
||||
NMC_TERM_COLOR_WHITE = 8
|
||||
} NmcTermColor;
|
||||
typedef struct _NmcOutputData {
|
||||
GPtrArray *output_data; /* GPtrArray of arrays of NmcOutputField structs - accumulates data for output */
|
||||
} NmcOutputData;
|
||||
|
||||
/* NmCli - main structure */
|
||||
typedef struct _NmCli {
|
||||
NMClient *client; /* Pointer to NMClient of libnm */
|
||||
NMClient *(*get_client) (struct _NmCli *nmc); /* Pointer to function for creating NMClient */
|
||||
|
||||
NMCResultCode return_value; /* Return code of nmcli */
|
||||
GString *return_text; /* Reason text */
|
||||
pid_t pager_pid; /* PID of a pager, if one was spawned */
|
||||
|
||||
int timeout; /* Operation timeout */
|
||||
|
||||
const GPtrArray *connections; /* List of connections */
|
||||
NMSecretAgentSimple *secret_agent; /* Secret agent */
|
||||
GHashTable *pwds_hash; /* Hash table with passwords in passwd-file */
|
||||
struct _NMPolkitListener *pk_listener; /* polkit agent listener */
|
||||
|
||||
gboolean should_wait; /* Indication that nmcli should not end yet */
|
||||
int should_wait; /* Semaphore indicating whether nmcli should not end or not yet */
|
||||
gboolean nowait_flag; /* '--nowait' option; used for passing to callbacks */
|
||||
NMCPrintOutput print_output; /* Output mode */
|
||||
gboolean multiline_output; /* Multiline output instead of default tabular */
|
||||
gboolean mode_specified; /* Whether tabular/multiline mode was specified via '--mode' option */
|
||||
gboolean escape_values; /* Whether to escape ':' and '\' in terse tabular mode */
|
||||
union {
|
||||
const NmcConfig nmc_config;
|
||||
NmcConfig nmc_config_mutable;
|
||||
};
|
||||
char *required_fields; /* Required fields in output: '--fields' option */
|
||||
GPtrArray *output_data; /* GPtrArray of arrays of NmcOutputField structs - accumulates data for output */
|
||||
NmcPrintFields print_fields; /* Structure with field indices to print */
|
||||
gboolean nocheck_ver; /* Don't check nmcli and NM versions: option '--nocheck' */
|
||||
gboolean ask; /* Ask for missing parameters: option '--ask' */
|
||||
gboolean in_editor; /* Whether running the editor - nmcli con edit' */
|
||||
gboolean complete; /* Autocomplete the command line */
|
||||
gboolean editor_status_line; /* Whether to display status line in connection editor */
|
||||
gboolean editor_save_confirmation; /* Whether to ask for confirmation on saving connections with 'autoconnect=yes' */
|
||||
gboolean editor_show_secrets; /* Whether to display secrets in the editor' */
|
||||
NmcTermColor editor_prompt_color; /* Color of prompt in connection editor */
|
||||
|
||||
char *palette_buffer; /* Buffer with sequences for terminal-colors.d(5)-based coloring. */
|
||||
} NmCli;
|
||||
|
||||
extern NmCli nm_cli;
|
||||
|
||||
/* Error quark for GError domain */
|
||||
#define NMCLI_ERROR (nmcli_error_quark ())
|
||||
GQuark nmcli_error_quark (void);
|
||||
|
||||
extern GMainLoop *loop;
|
||||
|
||||
gboolean nmc_seen_sigint (void);
|
||||
void nmc_clear_sigint (void);
|
||||
void nmc_set_sigquit_internal (void);
|
||||
void nmc_exit (void);
|
||||
|
||||
void nm_cli_spawn_pager (NmCli *nmc);
|
||||
|
||||
void nmc_empty_output_fields (NmcOutputData *output_data);
|
||||
|
||||
#define NMC_OUTPUT_DATA_DEFINE_SCOPED(out) \
|
||||
gs_unref_array GArray *out##_indices = NULL; \
|
||||
nm_auto (nmc_empty_output_fields) NmcOutputData out = { \
|
||||
.output_data = g_ptr_array_new_full (20, g_free), \
|
||||
}
|
||||
|
||||
#endif /* NMC_NMCLI_H */
|
||||
|
|
|
|||
129
clients/cli/polkit-agent.c
Normal file
129
clients/cli/polkit-agent.c
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "polkit-agent.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "nm-polkit-listener.h"
|
||||
#include "common.h"
|
||||
|
||||
#if WITH_POLKIT_AGENT
|
||||
static char *
|
||||
polkit_request (NMPolkitListener *listener,
|
||||
const char *request,
|
||||
const char *action_id,
|
||||
const char *message,
|
||||
const char *icon_name,
|
||||
const char *user,
|
||||
gboolean echo_on,
|
||||
gpointer user_data)
|
||||
{
|
||||
NmCli *nmc = user_data;
|
||||
|
||||
g_print ("%s\n", message);
|
||||
g_print ("(action_id: %s)\n", action_id);
|
||||
|
||||
/* Ask user for polkit authorization password */
|
||||
if (user) {
|
||||
gs_free char *tmp = NULL;
|
||||
char *p;
|
||||
|
||||
/* chop of ": " if present */
|
||||
tmp = g_strdup (request);
|
||||
p = strrchr (tmp, ':');
|
||||
if (p && nm_streq (p, ": "))
|
||||
*p = '\0';
|
||||
return nmc_readline_echo (&nmc->nmc_config, echo_on, "%s (%s): ", tmp, user);
|
||||
}
|
||||
|
||||
return nmc_readline_echo (&nmc->nmc_config, echo_on, "%s", request);
|
||||
}
|
||||
|
||||
static void
|
||||
polkit_show_info (NMPolkitListener *listener,
|
||||
const char *text,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_print (_("Authentication message: %s\n"), text);
|
||||
}
|
||||
|
||||
static void
|
||||
polkit_show_error (NMPolkitListener *listener,
|
||||
const char *text,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_print (_("Authentication error: %s\n"), text);
|
||||
}
|
||||
|
||||
static void
|
||||
polkit_completed (NMPolkitListener *listener,
|
||||
gboolean gained_authorization,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* We don't print anything here. The outcome will be evident from
|
||||
* the operation result anyway. */
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
nmc_polkit_agent_init (NmCli* nmc, gboolean for_session, GError **error)
|
||||
{
|
||||
#if WITH_POLKIT_AGENT
|
||||
static const NMPolkitListenVtable vtable = {
|
||||
.on_request = polkit_request,
|
||||
.on_show_info = polkit_show_info,
|
||||
.on_show_error = polkit_show_error,
|
||||
.on_completed = polkit_completed,
|
||||
};
|
||||
NMPolkitListener *listener;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
listener = nm_polkit_listener_new (for_session, error);
|
||||
if (!listener)
|
||||
return FALSE;
|
||||
|
||||
nm_polkit_listener_set_vtable (listener, &vtable, nmc);
|
||||
|
||||
nmc->pk_listener = listener;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nmc_polkit_agent_fini (NmCli* nmc)
|
||||
{
|
||||
#if WITH_POLKIT_AGENT
|
||||
if (nmc->pk_listener) {
|
||||
nm_polkit_listener_set_vtable (nmc->pk_listener, NULL, NULL);
|
||||
g_clear_object (&nmc->pk_listener);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
nmc_start_polkit_agent_start_try (NmCli *nmc)
|
||||
{
|
||||
#if WITH_POLKIT_AGENT
|
||||
GError *error = NULL;
|
||||
|
||||
/* We don't register polkit agent at all when running non-interactively */
|
||||
if (!nmc->ask)
|
||||
return TRUE;
|
||||
|
||||
if (!nmc_polkit_agent_init (nmc, FALSE, &error)) {
|
||||
g_printerr (_("Warning: polkit agent initialization failed: %s\n"),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
16
clients/cli/polkit-agent.h
Normal file
16
clients/cli/polkit-agent.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NMC_POLKIT_AGENT_H__
|
||||
#define __NMC_POLKIT_AGENT_H__
|
||||
|
||||
#include "nmcli.h"
|
||||
|
||||
gboolean nmc_polkit_agent_init (NmCli *nmc, gboolean for_session, GError **error);
|
||||
void nmc_polkit_agent_fini (NmCli* nmc);
|
||||
|
||||
gboolean nmc_start_polkit_agent_start_try (NmCli *nmc);
|
||||
|
||||
#endif /* __NMC_POLKIT_AGENT_H__ */
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output
|
||||
method="text"
|
||||
doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
||||
/>
|
||||
|
||||
<xsl:template match="nm-setting-docs">/* Generated file. Do not edit. */
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *docs;
|
||||
} NmcPropertyDesc;
|
||||
<xsl:apply-templates select="setting" mode="properties"><xsl:sort select="@name"/></xsl:apply-templates>
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
NmcPropertyDesc *properties;
|
||||
int n_properties;
|
||||
} NmcSettingDesc;
|
||||
|
||||
NmcSettingDesc all_settings[] = {
|
||||
<xsl:apply-templates select="setting" mode="settings"><xsl:sort select="@name"/></xsl:apply-templates>
|
||||
};
|
||||
|
||||
static int
|
||||
find_by_name (gconstpointer keyv, gconstpointer cmpv)
|
||||
{
|
||||
const char *key = keyv;
|
||||
struct { const char *name; gpointer data; } *cmp = (gpointer)cmpv;
|
||||
|
||||
return strcmp (key, cmp->name);
|
||||
}
|
||||
|
||||
static const char *
|
||||
nmc_setting_get_property_doc (NMSetting *setting, const char *prop)
|
||||
{
|
||||
NmcSettingDesc *setting_desc;
|
||||
NmcPropertyDesc *property_desc;
|
||||
|
||||
setting_desc = bsearch (nm_setting_get_name (setting),
|
||||
all_settings, G_N_ELEMENTS (all_settings),
|
||||
sizeof (NmcSettingDesc), find_by_name);
|
||||
if (!setting_desc)
|
||||
return NULL;
|
||||
property_desc = bsearch (prop,
|
||||
setting_desc->properties, setting_desc->n_properties,
|
||||
sizeof (NmcPropertyDesc), find_by_name);
|
||||
if (!property_desc)
|
||||
return NULL;
|
||||
return property_desc->docs;
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="setting" mode="properties">
|
||||
NmcPropertyDesc setting_<xsl:value-of select="translate(@name,'-','_')"/>[] = {<xsl:apply-templates select="property"><xsl:sort select="@name"/></xsl:apply-templates>
|
||||
};
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="property">
|
||||
<xsl:variable name="docs">
|
||||
<xsl:call-template name="escape_quotes">
|
||||
<xsl:with-param name="string" select="@description"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
{ "<xsl:value-of select="@name"/>", "<xsl:value-of select="$docs"/>" },</xsl:template>
|
||||
|
||||
<xsl:template match="setting" mode="settings">
|
||||
{ "<xsl:value-of select="@name"/>", setting_<xsl:value-of select="translate(@name,'-','_')"/>, <xsl:value-of select="count(./property)"/> },</xsl:template>
|
||||
|
||||
<xsl:template name="escape_quotes">
|
||||
<xsl:param name="string" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($string, '"')">
|
||||
<xsl:value-of select="substring-before($string, '"')" />\"<xsl:call-template name="escape_quotes"><xsl:with-param name="string" select="substring-after($string, '"')" /></xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$string" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,66 +1,40 @@
|
|||
/* nmcli - command-line tool to control NetworkManager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2010 - 2014 Red Hat, Inc.
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMC_SETTINGS_H
|
||||
#define NMC_SETTINGS_H
|
||||
|
||||
#include "nm-meta-setting.h"
|
||||
#include "nm-meta-setting-desc.h"
|
||||
|
||||
#include "nmcli.h"
|
||||
#include "utils.h"
|
||||
|
||||
/* --- Functions --- */
|
||||
/*****************************************************************************/
|
||||
|
||||
void nmc_properties_init (void);
|
||||
void nmc_properties_cleanup (void);
|
||||
|
||||
NMSetting *nmc_setting_new_for_name (const char *name);
|
||||
void nmc_setting_custom_init (NMSetting *setting);
|
||||
void nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting);
|
||||
void nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting);
|
||||
void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting);
|
||||
void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting);
|
||||
void nmc_setting_proxy_connect_handlers (NMSettingProxy *setting);
|
||||
void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting);
|
||||
void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection);
|
||||
|
||||
char **nmc_setting_get_valid_properties (NMSetting *setting);
|
||||
char *nmc_setting_get_property_desc (NMSetting *setting, const char *prop);
|
||||
const char *nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop);
|
||||
const char *const*nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop, char ***out_to_free);
|
||||
char *nmc_setting_get_property (NMSetting *setting,
|
||||
const char *prop,
|
||||
GError **error);
|
||||
char *nmc_setting_get_property_out2in (NMSetting *setting,
|
||||
const char *prop,
|
||||
GError **error);
|
||||
gboolean nmc_setting_set_property (NMSetting *setting,
|
||||
char *nmc_setting_get_property_parsable (NMSetting *setting,
|
||||
const char *prop,
|
||||
GError **error);
|
||||
gboolean nmc_setting_set_property (NMClient *client,
|
||||
NMSetting *setting,
|
||||
const char *prop,
|
||||
NMMetaAccessorModifier modifier,
|
||||
const char *val,
|
||||
GError **error);
|
||||
gboolean nmc_setting_reset_property (NMSetting *setting,
|
||||
const char *prop,
|
||||
GError **error);
|
||||
gboolean nmc_setting_remove_property_option (NMSetting *setting,
|
||||
const char *prop,
|
||||
const char *option,
|
||||
guint32 idx,
|
||||
GError **error);
|
||||
void nmc_property_set_default_value (NMSetting *setting, const char *prop);
|
||||
|
||||
gboolean nmc_property_get_gvalue (NMSetting *setting, const char *prop, GValue *value);
|
||||
gboolean nmc_property_set_gvalue (NMSetting *setting, const char *prop, GValue *value);
|
||||
|
||||
gboolean setting_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets);
|
||||
gboolean setting_details (const NmcConfig *nmc_config, NMSetting *setting, const char *one_prop);
|
||||
|
||||
#endif /* NMC_SETTINGS_H */
|
||||
|
|
|
|||
2011
clients/cli/utils.c
2011
clients/cli/utils.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,20 +1,6 @@
|
|||
/* nmcli - command-line tool to control NetworkManager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2010 - 2014 Red Hat, Inc.
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMC_UTILS_H
|
||||
|
|
@ -33,64 +19,324 @@ typedef struct {
|
|||
} nmc_arg_t;
|
||||
|
||||
/* === Functions === */
|
||||
int matches (const char *cmd, const char *pattern);
|
||||
int next_arg (int *argc, char ***argv);
|
||||
int next_arg (NmCli *nmc, int *argc, char ***argv, ...);
|
||||
gboolean nmc_arg_is_help (const char *arg);
|
||||
gboolean nmc_arg_is_option (const char *arg, const char *opt_name);
|
||||
gboolean nmc_parse_args (nmc_arg_t *arg_arr, gboolean last, int *argc, char ***argv, GError **error);
|
||||
char *ssid_to_hex (const char *str, gsize len);
|
||||
gboolean nmc_string_to_int_base (const char *str,
|
||||
int base,
|
||||
gboolean range_check,
|
||||
long int min,
|
||||
long int max,
|
||||
long int *value);
|
||||
gboolean nmc_string_to_uint_base (const char *str,
|
||||
int base,
|
||||
gboolean range_check,
|
||||
unsigned long int min,
|
||||
unsigned long int max,
|
||||
unsigned long int *value);
|
||||
gboolean nmc_string_to_int (const char *str,
|
||||
gboolean range_check,
|
||||
long int min,
|
||||
long int max,
|
||||
long int *value);
|
||||
gboolean nmc_string_to_uint (const char *str,
|
||||
gboolean range_check,
|
||||
unsigned long int min,
|
||||
unsigned long int max,
|
||||
unsigned long int *value);
|
||||
gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error);
|
||||
char *nmc_ip4_address_as_string (guint32 ip, GError **error);
|
||||
char *nmc_ip6_address_as_string (const struct in6_addr *ip, GError **error);
|
||||
void nmc_terminal_erase_line (void);
|
||||
void nmc_terminal_show_progress (const char *str);
|
||||
const char *nmc_term_color_sequence (NmcTermColor color);
|
||||
char *nmc_colorize (NmcTermColor color, const char * fmt, ...);
|
||||
pid_t nmc_terminal_spawn_pager (const NmcConfig *nmc_config);
|
||||
char *nmc_colorize (const NmcConfig *nmc_config, NMMetaColor color, const char * fmt, ...) _nm_printf (3, 4);
|
||||
void nmc_filter_out_colors_inplace (char *str);
|
||||
char *nmc_filter_out_colors (const char *str);
|
||||
char *nmc_get_user_input (const char *ask_str);
|
||||
int nmc_string_to_arg_array (const char *line, const char *delim, char ***argv, int *argc);
|
||||
int nmc_string_to_arg_array (const char *line, const char *delim, gboolean unquote,
|
||||
char ***argv, int *argc);
|
||||
const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error);
|
||||
GSList *nmc_util_strv_to_slist (char **strv);
|
||||
char * nmc_util_strv_for_display (const char **strv);
|
||||
char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens);
|
||||
char * nmc_util_strv_for_display (const char *const*strv, gboolean brackets);
|
||||
int nmc_string_screen_width (const char *start, const char *end);
|
||||
void set_val_str (NmcOutputField fields_array[], guint32 index, char *value);
|
||||
void set_val_strc (NmcOutputField fields_array[], guint32 index, const char *value);
|
||||
void set_val_arr (NmcOutputField fields_array[], guint32 index, char **value);
|
||||
void set_val_arrc (NmcOutputField fields_array[], guint32 index, const char **value);
|
||||
void set_val_color_all (NmcOutputField fields_array[], NMMetaColor color);
|
||||
void nmc_free_output_field_values (NmcOutputField fields_array[]);
|
||||
|
||||
GArray *parse_output_fields (const char *fields_str,
|
||||
const NmcOutputField fields_array[],
|
||||
const NMMetaAbstractInfo *const* fields_array,
|
||||
gboolean parse_groups,
|
||||
GPtrArray **group_fields,
|
||||
GError **error);
|
||||
char *nmc_get_allowed_fields (const NmcOutputField fields_array[], int group_idx);
|
||||
gboolean nmc_terse_option_check (NMCPrintOutput print_output, const char *fields, GError **error);
|
||||
NmcOutputField *nmc_dup_fields_array (NmcOutputField fields[], size_t size, guint32 flags);
|
||||
void nmc_empty_output_fields (NmCli *nmc);
|
||||
void print_required_fields (NmCli *nmc, const NmcOutputField field_values[]);
|
||||
void print_data (NmCli *nmc);
|
||||
gboolean nmc_versions_match (NmCli *nmc);
|
||||
NmcOutputField *nmc_dup_fields_array (const NMMetaAbstractInfo *const*fields, NmcOfFlags flags);
|
||||
void nmc_empty_output_fields (NmcOutputData *output_data);
|
||||
void print_required_fields (const NmcConfig *nmc_config,
|
||||
NmcOfFlags of_flags,
|
||||
const GArray *indices,
|
||||
const char *header_name,
|
||||
int indent,
|
||||
const NmcOutputField *field_values);
|
||||
void print_data_prepare_width (GPtrArray *output_data);
|
||||
void print_data (const NmcConfig *nmc_config,
|
||||
const GArray *indices,
|
||||
const char *header_name,
|
||||
int indent,
|
||||
const NmcOutputData *out);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
extern const NMMetaEnvironment *const nmc_meta_environment;
|
||||
extern NmCli *const nmc_meta_environment_arg;
|
||||
|
||||
typedef enum {
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_RUNNING = 0,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_VERSION,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STATE,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STARTUP,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_CONNECTIVITY,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NETWORKING,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI_HW,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIFI,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN_HW,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WWAN,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX_HW,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_WIMAX,
|
||||
_NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_PERMISSION = 0,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_VALUE,
|
||||
_NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_LEVEL = 0,
|
||||
NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_DOMAINS,
|
||||
_NMC_GENERIC_INFO_TYPE_GENERAL_LOGGING_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ADDRESS = 0,
|
||||
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_GATEWAY,
|
||||
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_ROUTE,
|
||||
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DNS,
|
||||
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DOMAIN,
|
||||
NMC_GENERIC_INFO_TYPE_IP4_CONFIG_WINS,
|
||||
_NMC_GENERIC_INFO_TYPE_IP4_CONFIG_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_IP6_CONFIG_ADDRESS = 0,
|
||||
NMC_GENERIC_INFO_TYPE_IP6_CONFIG_GATEWAY,
|
||||
NMC_GENERIC_INFO_TYPE_IP6_CONFIG_ROUTE,
|
||||
NMC_GENERIC_INFO_TYPE_IP6_CONFIG_DNS,
|
||||
NMC_GENERIC_INFO_TYPE_IP6_CONFIG_DOMAIN,
|
||||
_NMC_GENERIC_INFO_TYPE_IP6_CONFIG_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_DHCP_CONFIG_OPTION = 0,
|
||||
_NMC_GENERIC_INFO_TYPE_DHCP_CONFIG_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_NAME = 0,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_UUID,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_TYPE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_TIMESTAMP,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_TIMESTAMP_REAL,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_AUTOCONNECT,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_AUTOCONNECT_PRIORITY,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_READONLY,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_DBUS_PATH,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_ACTIVE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_DEVICE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_STATE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_ACTIVE_PATH,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_SLAVE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_SHOW_FILENAME,
|
||||
_NMC_GENERIC_INFO_TYPE_CON_SHOW_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_NAME = 0,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_UUID,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_DEVICES,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_IP_IFACE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_STATE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_DEFAULT,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_DEFAULT6,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_SPEC_OBJECT,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_VPN,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_DBUS_PATH,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_CON_PATH,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_ZONE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_MASTER_PATH,
|
||||
_NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_CON_VPN_TYPE = 0,
|
||||
NMC_GENERIC_INFO_TYPE_CON_VPN_USERNAME,
|
||||
NMC_GENERIC_INFO_TYPE_CON_VPN_GATEWAY,
|
||||
NMC_GENERIC_INFO_TYPE_CON_VPN_BANNER,
|
||||
NMC_GENERIC_INFO_TYPE_CON_VPN_VPN_STATE,
|
||||
NMC_GENERIC_INFO_TYPE_CON_VPN_CFG,
|
||||
_NMC_GENERIC_INFO_TYPE_CON_ACTIVE_VPN_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_DEVICE = 0,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_TYPE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_STATE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_IP4_CONNECTIVITY,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_IP6_CONNECTIVITY,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_DBUS_PATH,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_CONNECTION,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_CON_UUID,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_CON_PATH,
|
||||
_NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_DEVICE = 0,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_TYPE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_NM_TYPE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_VENDOR,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_PRODUCT,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_DRIVER,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_DRIVER_VERSION,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_FIRMWARE_VERSION,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_HWADDR,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_MTU,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_STATE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_REASON,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_IP4_CONNECTIVITY,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_IP6_CONNECTIVITY,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_UDI,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_IP_IFACE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_IS_SOFTWARE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_NM_MANAGED,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_AUTOCONNECT,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_FIRMWARE_MISSING,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_NM_PLUGIN_MISSING,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_PHYS_PORT_ID,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_CONNECTION,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_CON_UUID,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_CON_PATH,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_METERED,
|
||||
_NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CONNECTIONS_AVAILABLE_CONNECTION_PATHS = 0,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CONNECTIONS_AVAILABLE_CONNECTIONS,
|
||||
_NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CONNECTIONS_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CAPABILITIES_CARRIER_DETECT = 0,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CAPABILITIES_SPEED,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CAPABILITIES_IS_SOFTWARE,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CAPABILITIES_SRIOV,
|
||||
_NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_CAPABILITIES_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIRED_PROPERTIES_CARRIER = 0,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIRED_PROPERTIES_S390_SUBCHANNELS,
|
||||
_NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIRED_PROPERTIES_NUM,
|
||||
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WEP = 0,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WPA,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_WPA2,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_TKIP,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_CCMP,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_AP,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_ADHOC,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_2GHZ,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_5GHZ,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_MESH,
|
||||
NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_IBSS_RSN,
|
||||
_NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_WIFI_PROPERTIES_NUM,
|
||||
|
||||
} NmcGenericInfoType;
|
||||
|
||||
#define NMC_HANDLE_COLOR(color) \
|
||||
G_STMT_START { \
|
||||
if (get_type == NM_META_ACCESSOR_GET_TYPE_COLOR) \
|
||||
return GINT_TO_POINTER (color); \
|
||||
} G_STMT_END
|
||||
|
||||
struct _NmcMetaGenericInfo {
|
||||
union {
|
||||
NMObjBaseInst parent;
|
||||
const NMMetaType *meta_type;
|
||||
};
|
||||
NmcGenericInfoType info_type;
|
||||
const char *name;
|
||||
const char *name_header;
|
||||
const NmcMetaGenericInfo *const*nested;
|
||||
|
||||
#define NMC_META_GENERIC_INFO_GET_FCN_ARGS \
|
||||
const NMMetaEnvironment *environment, \
|
||||
gpointer environment_user_data, \
|
||||
const NmcMetaGenericInfo *info, \
|
||||
gpointer target, \
|
||||
gpointer target_data, \
|
||||
NMMetaAccessorGetType get_type, \
|
||||
NMMetaAccessorGetFlags get_flags, \
|
||||
NMMetaAccessorGetOutFlags *out_flags, \
|
||||
gboolean *out_is_default, \
|
||||
gpointer *out_to_free
|
||||
|
||||
gconstpointer (*get_fcn) (NMC_META_GENERIC_INFO_GET_FCN_ARGS);
|
||||
};
|
||||
|
||||
#define NMC_META_GENERIC(n, ...) \
|
||||
(&((NmcMetaGenericInfo) { \
|
||||
.meta_type = &nmc_meta_type_generic_info, \
|
||||
.name = n, \
|
||||
__VA_ARGS__ \
|
||||
}))
|
||||
|
||||
#define NMC_META_GENERIC_WITH_NESTED(n, nest, ...) \
|
||||
NMC_META_GENERIC (n, .nested = (nest), __VA_ARGS__)
|
||||
|
||||
#define NMC_META_GENERIC_GROUP(_group_name, _nested, _name_header) \
|
||||
((const NMMetaAbstractInfo *const*) ((const NmcMetaGenericInfo *const[]) { \
|
||||
NMC_META_GENERIC_WITH_NESTED (_group_name,_nested, .name_header = _name_header), \
|
||||
NULL, \
|
||||
}))
|
||||
|
||||
static inline const char *
|
||||
nmc_meta_generic_get_str_i18n (const char *s, NMMetaAccessorGetType get_type)
|
||||
{
|
||||
if (!NM_IN_SET (get_type, NM_META_ACCESSOR_GET_TYPE_PRETTY,
|
||||
NM_META_ACCESSOR_GET_TYPE_PARSABLE))
|
||||
g_return_val_if_reached (NULL);
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
return gettext (s);
|
||||
return s;
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
nmc_meta_generic_get_bool (gboolean val, NMMetaAccessorGetType get_type)
|
||||
{
|
||||
return nmc_meta_generic_get_str_i18n (val ? N_("yes") : N_("no"), get_type);
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
nmc_meta_generic_get_bool_onoff (gboolean val, NMMetaAccessorGetType get_type)
|
||||
{
|
||||
return nmc_meta_generic_get_str_i18n (val ? N_("on") : N_("off"), get_type);
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
NMC_META_GENERIC_GET_ENUM_TYPE_PARENTHESES,
|
||||
NMC_META_GENERIC_GET_ENUM_TYPE_DASH,
|
||||
} NmcMetaGenericGetEnumType;
|
||||
|
||||
static inline char *
|
||||
nmc_meta_generic_get_enum_with_detail (NmcMetaGenericGetEnumType get_enum_type, gint64 enum_val, const char *str_val, NMMetaAccessorGetType get_type)
|
||||
{
|
||||
if (!NM_IN_SET (get_type, NM_META_ACCESSOR_GET_TYPE_PRETTY,
|
||||
NM_META_ACCESSOR_GET_TYPE_PARSABLE))
|
||||
g_return_val_if_reached (NULL);
|
||||
|
||||
if (!str_val) {
|
||||
/* Pass %NULL for only printing the numeric value. */
|
||||
return g_strdup_printf ("%lld", (long long) enum_val);
|
||||
}
|
||||
|
||||
switch (get_enum_type) {
|
||||
case NMC_META_GENERIC_GET_ENUM_TYPE_PARENTHESES:
|
||||
/* note that this function will always print "$NUM ($NICK)", also in PARSABLE
|
||||
* mode. That might not be desired, but it's done for certain properties to preserve
|
||||
* previous behavior. */
|
||||
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
return g_strdup_printf (_("%lld (%s)"), (long long) enum_val, gettext (str_val));
|
||||
return g_strdup_printf ("%lld (%s)", (long long) enum_val, str_val);
|
||||
case NMC_META_GENERIC_GET_ENUM_TYPE_DASH:
|
||||
/* note that this function will always print "$NUM ($NICK)", also in PARSABLE
|
||||
* mode. That might not be desired, but it's done for certain properties to preserve
|
||||
* previous behavior. */
|
||||
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
|
||||
return g_strdup_printf (_("%lld - %s"), (long long) enum_val, gettext (str_val));
|
||||
return g_strdup_printf ("%lld - %s", (long long) enum_val, str_val);
|
||||
}
|
||||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean nmc_print (const NmcConfig *nmc_config,
|
||||
gpointer const *targets,
|
||||
gpointer targets_data,
|
||||
const char *header_name_no_l10n,
|
||||
const NMMetaAbstractInfo *const*fields,
|
||||
const char *fields_str,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* NMC_UTILS_H */
|
||||
|
|
|
|||
75
clients/common/meson.build
Normal file
75
clients/common/meson.build
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
common_inc = include_directories('.')
|
||||
|
||||
nm_polkit_listener = files('nm-polkit-listener.c')
|
||||
|
||||
common_deps = [
|
||||
libnm_dep,
|
||||
libnm_nm_default_dep,
|
||||
]
|
||||
|
||||
common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="libnmc"']
|
||||
|
||||
sources = files(
|
||||
'nm-client-utils.c',
|
||||
'nm-secret-agent-simple.c',
|
||||
'nm-vpn-helpers.c',
|
||||
)
|
||||
|
||||
libnmc_base = static_library(
|
||||
'nmc-base',
|
||||
sources: sources,
|
||||
dependencies: common_deps,
|
||||
c_args: common_c_flags,
|
||||
)
|
||||
|
||||
libnmc_base_dep = declare_dependency(
|
||||
include_directories: common_inc,
|
||||
dependencies: common_deps,
|
||||
link_with: libnmc_base,
|
||||
)
|
||||
|
||||
settings_docs = 'settings-docs.h'
|
||||
|
||||
if enable_introspection
|
||||
settings_docs_source = custom_target(
|
||||
settings_docs,
|
||||
input: nm_property_docs,
|
||||
output: settings_docs,
|
||||
command: [xsltproc, '--output', '@OUTPUT@', join_paths(meson.current_source_dir(), 'settings-docs.xsl'), '@INPUT@'],
|
||||
)
|
||||
|
||||
test(
|
||||
'check-settings-docs',
|
||||
find_program(join_paths(source_root, 'tools', 'check-settings-docs.sh')),
|
||||
args: [source_root, build_root, 'clients/common/' + settings_docs],
|
||||
)
|
||||
else
|
||||
settings_docs_source = configure_file(
|
||||
input: settings_docs + '.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: configuration_data(),
|
||||
)
|
||||
endif
|
||||
|
||||
sources = nm_meta_setting_source + [settings_docs_source] + files(
|
||||
'nm-meta-setting-access.c',
|
||||
'nm-meta-setting-desc.c',
|
||||
)
|
||||
|
||||
libnmc = static_library(
|
||||
'nmc',
|
||||
sources: sources,
|
||||
dependencies: common_deps + [libnm_libnm_core_aux_dep],
|
||||
c_args: c_flags,
|
||||
link_depends: settings_docs_source,
|
||||
)
|
||||
|
||||
libnmc_dep = declare_dependency(
|
||||
include_directories: common_inc,
|
||||
dependencies: common_deps,
|
||||
link_with: libnmc,
|
||||
)
|
||||
|
||||
if (enable_introspection or enable_nmtui) and enable_tests
|
||||
subdir('tests')
|
||||
endif
|
||||
588
clients/common/nm-client-utils.c
Normal file
588
clients/common/nm-client-utils.c
Normal file
|
|
@ -0,0 +1,588 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2017 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-client-utils.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
#include "nm-device-bond.h"
|
||||
#include "nm-device-bridge.h"
|
||||
#include "nm-device-team.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int
|
||||
_nmc_objects_sort_by_path_cmp (gconstpointer pa, gconstpointer pb, gpointer user_data)
|
||||
{
|
||||
NMObject *a = *((NMObject **) pa);
|
||||
NMObject *b = *((NMObject **) pb);
|
||||
|
||||
NM_CMP_SELF (a, b);
|
||||
NM_CMP_RETURN (nm_utils_dbus_path_cmp (nm_object_get_path (a),
|
||||
nm_object_get_path (b)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
const NMObject **
|
||||
nmc_objects_sort_by_path (const NMObject *const* objs, gssize len)
|
||||
{
|
||||
const NMObject **arr;
|
||||
gsize i, l;
|
||||
|
||||
if (len < 0)
|
||||
l = NM_PTRARRAY_LEN (objs);
|
||||
else
|
||||
l = len;
|
||||
|
||||
arr = g_new (const NMObject *, l + 1);
|
||||
for (i = 0; i < l; i++)
|
||||
arr[i] = objs[i];
|
||||
arr[l] = NULL;
|
||||
|
||||
if (l > 1) {
|
||||
g_qsort_with_data (arr,
|
||||
l,
|
||||
sizeof (gpointer),
|
||||
_nmc_objects_sort_by_path_cmp,
|
||||
NULL);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* Convert string to unsigned integer.
|
||||
* If required, the resulting number is checked to be in the <min,max> range.
|
||||
*/
|
||||
static gboolean
|
||||
nmc_string_to_uint_base (const char *str,
|
||||
int base,
|
||||
gboolean range_check,
|
||||
unsigned long int min,
|
||||
unsigned long int max,
|
||||
unsigned long int *value)
|
||||
{
|
||||
char *end;
|
||||
unsigned long int tmp;
|
||||
|
||||
if (!str || !str[0])
|
||||
return FALSE;
|
||||
|
||||
/* FIXME: don't use this function, replace by _nm_utils_ascii_str_to_int64() */
|
||||
errno = 0;
|
||||
tmp = strtoul (str, &end, base);
|
||||
if (errno || *end != '\0' || (range_check && (tmp < min || tmp > max))) {
|
||||
return FALSE;
|
||||
}
|
||||
*value = tmp;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nmc_string_to_uint (const char *str,
|
||||
gboolean range_check,
|
||||
unsigned long int min,
|
||||
unsigned long int max,
|
||||
unsigned long int *value)
|
||||
{
|
||||
return nmc_string_to_uint_base (str, 10, range_check, min, max, value);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error)
|
||||
{
|
||||
const char *s_true[] = { "true", "yes", "on", "1", NULL };
|
||||
const char *s_false[] = { "false", "no", "off", "0", NULL };
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (g_strcmp0 (str, "o") == 0) {
|
||||
g_set_error (error, 1, 0,
|
||||
/* TRANSLATORS: the first %s is the partial value entered by
|
||||
* the user, the second %s a list of compatible values.
|
||||
*/
|
||||
_("'%s' is ambiguous (%s)"), str, "on x off");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nmc_string_is_valid (str, s_true, NULL))
|
||||
*val_bool = TRUE;
|
||||
else if (nmc_string_is_valid (str, s_false, NULL))
|
||||
*val_bool = FALSE;
|
||||
else {
|
||||
g_set_error (error, 1, 0,
|
||||
_("'%s' is not valid; use [%s] or [%s]"),
|
||||
str, "true, yes, on", "false, no, off");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nmc_string_to_ternary (const char *str, NMTernary *val, GError **error)
|
||||
{
|
||||
const char *s_true[] = { "true", "yes", "on", NULL };
|
||||
const char *s_false[] = { "false", "no", "off", NULL };
|
||||
const char *s_unknown[] = { "unknown", NULL };
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (g_strcmp0 (str, "o") == 0) {
|
||||
g_set_error (error, 1, 0,
|
||||
/* TRANSLATORS: the first %s is the partial value entered by
|
||||
* the user, the second %s a list of compatible values.
|
||||
*/
|
||||
_("'%s' is ambiguous (%s)"), str, "on x off");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nmc_string_is_valid (str, s_true, NULL))
|
||||
*val = NM_TERNARY_TRUE;
|
||||
else if (nmc_string_is_valid (str, s_false, NULL))
|
||||
*val = NM_TERNARY_FALSE;
|
||||
else if (nmc_string_is_valid (str, s_unknown, NULL))
|
||||
*val = NM_TERNARY_DEFAULT;
|
||||
else {
|
||||
g_set_error (error, 1, 0,
|
||||
_("'%s' is not valid; use [%s], [%s] or [%s]"),
|
||||
str, "true, yes, on", "false, no, off", "unknown");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether 'input' is contained in 'allowed' array. It performs case
|
||||
* insensitive comparison and supports shortcut strings if they are unique.
|
||||
* Returns: a pointer to found string in allowed array on success or NULL.
|
||||
* On failure: error->code : 0 - string not found; 1 - string is ambiguous
|
||||
*/
|
||||
const char *
|
||||
nmc_string_is_valid (const char *input, const char **allowed, GError **error)
|
||||
{
|
||||
const char **p;
|
||||
size_t input_ln, p_len;
|
||||
const char *partial_match = NULL;
|
||||
gboolean ambiguous = FALSE;
|
||||
|
||||
g_return_val_if_fail (!error || !*error, NULL);
|
||||
|
||||
if (!input || !*input)
|
||||
goto finish;
|
||||
|
||||
input_ln = strlen (input);
|
||||
for (p = allowed; p && *p; p++) {
|
||||
p_len = strlen (*p);
|
||||
if (g_ascii_strncasecmp (input, *p, input_ln) == 0) {
|
||||
if (input_ln == p_len)
|
||||
return *p;
|
||||
if (!partial_match)
|
||||
partial_match = *p;
|
||||
else
|
||||
ambiguous = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ambiguous) {
|
||||
GString *candidates = g_string_new ("");
|
||||
|
||||
for (p = allowed; *p; p++) {
|
||||
if (g_ascii_strncasecmp (input, *p, input_ln) == 0) {
|
||||
if (candidates->len > 0)
|
||||
g_string_append (candidates, ", ");
|
||||
g_string_append (candidates, *p);
|
||||
}
|
||||
}
|
||||
g_set_error (error, 1, 1, _("'%s' is ambiguous: %s"),
|
||||
input, candidates->str);
|
||||
g_string_free (candidates, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
finish:
|
||||
if (!partial_match) {
|
||||
char *valid_vals = g_strjoinv (", ", (char **) allowed);
|
||||
|
||||
if (!input || !*input)
|
||||
g_set_error (error, 1, 0, _("missing name, try one of [%s]"), valid_vals);
|
||||
else
|
||||
g_set_error (error, 1, 0, _("'%s' not among [%s]"), input, valid_vals);
|
||||
|
||||
g_free (valid_vals);
|
||||
}
|
||||
|
||||
return partial_match;
|
||||
}
|
||||
|
||||
gboolean
|
||||
matches (const char *cmd, const char *pattern)
|
||||
{
|
||||
size_t len = strlen (cmd);
|
||||
if (!len || len > strlen (pattern))
|
||||
return FALSE;
|
||||
return memcmp (pattern, cmd, len) == 0;
|
||||
}
|
||||
|
||||
const char *
|
||||
nmc_bond_validate_mode (const char *mode, GError **error)
|
||||
{
|
||||
unsigned long mode_int;
|
||||
static const char *valid_modes[] = { "balance-rr",
|
||||
"active-backup",
|
||||
"balance-xor",
|
||||
"broadcast",
|
||||
"802.3ad",
|
||||
"balance-tlb",
|
||||
"balance-alb",
|
||||
NULL };
|
||||
if (nmc_string_to_uint (mode, TRUE, 0, 6, &mode_int)) {
|
||||
/* Translate bonding mode numbers to mode names:
|
||||
* https://www.kernel.org/doc/Documentation/networking/bonding.txt
|
||||
*/
|
||||
return valid_modes[mode_int];
|
||||
} else
|
||||
return nmc_string_is_valid (mode, valid_modes, error);
|
||||
}
|
||||
|
||||
NM_UTILS_LOOKUP_STR_DEFINE (nmc_device_state_to_string, NMDeviceState,
|
||||
NM_UTILS_LOOKUP_DEFAULT (N_("unknown")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_UNMANAGED, N_("unmanaged")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_UNAVAILABLE, N_("unavailable")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_DISCONNECTED, N_("disconnected")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_PREPARE, N_("connecting (prepare)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_CONFIG, N_("connecting (configuring)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_NEED_AUTH, N_("connecting (need authentication)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_IP_CONFIG, N_("connecting (getting IP configuration)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_IP_CHECK, N_("connecting (checking IP connectivity)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_SECONDARIES, N_("connecting (starting secondary connections)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_ACTIVATED, N_("connected")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_DEACTIVATING, N_("deactivating")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_FAILED, N_("connection failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_UNKNOWN, N_("unknown")),
|
||||
)
|
||||
|
||||
NM_UTILS_LOOKUP_STR_DEFINE (nmc_device_metered_to_string, NMMetered,
|
||||
NM_UTILS_LOOKUP_DEFAULT (N_("unknown")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_METERED_YES, N_("yes")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_METERED_NO, N_("no")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_METERED_GUESS_YES, N_("yes (guessed)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_METERED_GUESS_NO, N_("no (guessed)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_METERED_UNKNOWN, N_("unknown")),
|
||||
)
|
||||
|
||||
NM_UTILS_LOOKUP_STR_DEFINE (nmc_device_reason_to_string, NMDeviceStateReason,
|
||||
/* TRANSLATORS: Unknown reason for a device state change (NMDeviceStateReason) */
|
||||
NM_UTILS_LOOKUP_DEFAULT (N_("Unknown")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_NONE, N_("No reason given")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_UNKNOWN, N_("Unknown error")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_NOW_MANAGED, N_("Device is now managed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_NOW_UNMANAGED, N_("Device is now unmanaged")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_CONFIG_FAILED, N_("The device could not be readied for configuration")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE, N_("IP configuration could not be reserved (no available address, timeout, etc.)")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED, N_("The IP configuration is no longer valid")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_NO_SECRETS, N_("Secrets were required, but not provided")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT, N_("802.1X supplicant disconnected")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED, N_("802.1X supplicant configuration failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED, N_("802.1X supplicant failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT, N_("802.1X supplicant took too long to authenticate")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_PPP_START_FAILED, N_("PPP service failed to start")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_PPP_DISCONNECT, N_("PPP service disconnected")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_PPP_FAILED, N_("PPP failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_DHCP_START_FAILED, N_("DHCP client failed to start")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_DHCP_ERROR, N_("DHCP client error")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_DHCP_FAILED, N_("DHCP client failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SHARED_START_FAILED, N_("Shared connection service failed to start")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SHARED_FAILED, N_("Shared connection service failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED, N_("AutoIP service failed to start")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_AUTOIP_ERROR, N_("AutoIP service error")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_AUTOIP_FAILED, N_("AutoIP service failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_BUSY, N_("The line is busy")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE, N_("No dial tone")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER, N_("No carrier could be established")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT, N_("The dialing request timed out")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED, N_("The dialing attempt failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED, N_("Modem initialization failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_APN_FAILED, N_("Failed to select the specified APN")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING, N_("Not searching for networks")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED, N_("Network registration denied")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT, N_("Network registration timed out")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED, N_("Failed to register with the requested network")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED, N_("PIN check failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_FIRMWARE_MISSING, N_("Necessary firmware for the device may be missing")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_REMOVED, N_("The device was removed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SLEEPING, N_("NetworkManager went to sleep")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, N_("The device's active connection disappeared")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_USER_REQUESTED, N_("Device disconnected by user or client")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_CARRIER, N_("Carrier/link changed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED, N_("The device's existing connection was assumed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE, N_("The supplicant is now available")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_NOT_FOUND, N_("The modem could not be found")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_BT_FAILED, N_("The Bluetooth connection failed or timed out")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED, N_("GSM Modem's SIM card not inserted")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED, N_("GSM Modem's SIM PIN required")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED, N_("GSM Modem's SIM PUK required")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_GSM_SIM_WRONG, N_("GSM Modem's SIM wrong")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_INFINIBAND_MODE, N_("InfiniBand device does not support connected mode")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED, N_("A dependency of the connection failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_BR2684_FAILED, N_("A problem with the RFC 2684 Ethernet over ADSL bridge")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE, N_("ModemManager is unavailable")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SSID_NOT_FOUND, N_("The Wi-Fi network could not be found")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED, N_("A secondary connection of the base connection failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED, N_("DCB or FCoE setup failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED, N_("teamd control failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_FAILED, N_("Modem failed or no longer available")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_MODEM_AVAILABLE, N_("Modem now ready and available")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT, N_("SIM PIN was incorrect")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_NEW_ACTIVATION, N_("New connection activation was enqueued")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_PARENT_CHANGED, N_("The device's parent changed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED, N_("The device parent's management changed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_OVSDB_FAILED, N_("Open vSwitch database connection failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_IP_ADDRESS_DUPLICATE, N_("A duplicate IP address was detected")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_IP_METHOD_UNSUPPORTED, N_("The selected IP method is not supported")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_SRIOV_CONFIGURATION_FAILED, N_("Failed to configure SR-IOV parameters")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_DEVICE_STATE_REASON_PEER_NOT_FOUND, N_("The Wi-Fi P2P peer could not be found")),
|
||||
)
|
||||
|
||||
NM_UTILS_LOOKUP_STR_DEFINE (nm_active_connection_state_reason_to_string, NMActiveConnectionStateReason,
|
||||
/* TRANSLATORS: Unknown reason for a connection state change (NMActiveConnectionStateReason) */
|
||||
NM_UTILS_LOOKUP_DEFAULT (N_("Unknown")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN, N_("Unknown reason")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_NONE, N_("The connection was disconnected")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_USER_DISCONNECTED, N_("Disconnected by user")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED, N_("The base network connection was interrupted")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_STOPPED, N_("The VPN service stopped unexpectedly")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_IP_CONFIG_INVALID, N_("The VPN service returned invalid configuration")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_CONNECT_TIMEOUT, N_("The connection attempt timed out")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT, N_("The VPN service did not start in time")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_START_FAILED, N_("The VPN service failed to start")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_NO_SECRETS, N_("No valid secrets")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_LOGIN_FAILED, N_("Invalid secrets")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_CONNECTION_REMOVED, N_("The connection was removed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_DEPENDENCY_FAILED, N_("Master connection failed")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_REALIZE_FAILED, N_("Could not create a software link")),
|
||||
NM_UTILS_LOOKUP_ITEM (NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_REMOVED, N_("The device disappeared")),
|
||||
)
|
||||
|
||||
NMActiveConnectionState
|
||||
nmc_activation_get_effective_state (NMActiveConnection *active,
|
||||
NMDevice *device,
|
||||
const char **reason)
|
||||
{
|
||||
NMActiveConnectionState ac_state;
|
||||
NMActiveConnectionStateReason ac_reason;
|
||||
NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN;
|
||||
NMDeviceStateReason dev_reason = NM_DEVICE_STATE_REASON_UNKNOWN;
|
||||
|
||||
g_return_val_if_fail (active, NM_ACTIVE_CONNECTION_STATE_UNKNOWN);
|
||||
g_return_val_if_fail (reason, NM_ACTIVE_CONNECTION_STATE_UNKNOWN);
|
||||
|
||||
*reason = NULL;
|
||||
ac_reason = nm_active_connection_get_state_reason (active);
|
||||
|
||||
if (device) {
|
||||
dev_state = nm_device_get_state (device);
|
||||
dev_reason = nm_device_get_state_reason (device);
|
||||
}
|
||||
|
||||
ac_state = nm_active_connection_get_state (active);
|
||||
switch (ac_state) {
|
||||
case NM_ACTIVE_CONNECTION_STATE_DEACTIVATED:
|
||||
if ( !device
|
||||
|| ac_reason != NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED
|
||||
|| nm_device_get_active_connection (device) != active) {
|
||||
/* (1)
|
||||
* - we have no device,
|
||||
* - or, @ac_reason is specific
|
||||
* - or, @device no longer references the current @active
|
||||
* >> we complete with @ac_reason. */
|
||||
*reason = gettext (nm_active_connection_state_reason_to_string (ac_reason));
|
||||
} else if ( dev_state <= NM_DEVICE_STATE_DISCONNECTED
|
||||
|| dev_state >= NM_DEVICE_STATE_FAILED) {
|
||||
/* (2)
|
||||
* - not (1)
|
||||
* - and, the device is no longer in an activated state,
|
||||
* >> we complete with @dev_reason. */
|
||||
*reason = gettext (nmc_device_reason_to_string (dev_reason));
|
||||
} else {
|
||||
/* (3)
|
||||
* we wait for the device go disconnect. We will get a better
|
||||
* failure reason from the device (2). */
|
||||
return NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
|
||||
}
|
||||
break;
|
||||
case NM_ACTIVE_CONNECTION_STATE_ACTIVATING:
|
||||
/* activating master connection does not automatically activate any slaves, so their
|
||||
* active connection state will not progress beyond ACTIVATING state.
|
||||
* Monitor the device instead. */
|
||||
if ( device
|
||||
&& ( NM_IS_DEVICE_BOND (device)
|
||||
|| NM_IS_DEVICE_TEAM (device)
|
||||
|| NM_IS_DEVICE_BRIDGE (device))
|
||||
&& dev_state >= NM_DEVICE_STATE_IP_CONFIG
|
||||
&& dev_state <= NM_DEVICE_STATE_ACTIVATED) {
|
||||
*reason = "master waiting for slaves";
|
||||
return NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ac_state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
can_show_utf8 (void)
|
||||
{
|
||||
static gboolean can_show_utf8_set = FALSE;
|
||||
static gboolean can_show_utf8 = TRUE;
|
||||
char *locale_str;
|
||||
|
||||
if (G_LIKELY (can_show_utf8_set))
|
||||
return can_show_utf8;
|
||||
|
||||
if (!g_get_charset (NULL)) {
|
||||
/* Non-UTF-8 locale */
|
||||
locale_str = g_locale_from_utf8 ("\342\226\202\342\226\204\342\226\206\342\226\210", -1, NULL, NULL, NULL);
|
||||
if (locale_str)
|
||||
g_free (locale_str);
|
||||
else
|
||||
can_show_utf8 = FALSE;
|
||||
}
|
||||
|
||||
return can_show_utf8;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
can_show_graphics (void)
|
||||
{
|
||||
static gboolean can_show_graphics_set = FALSE;
|
||||
static gboolean can_show_graphics = TRUE;
|
||||
|
||||
if (G_LIKELY (can_show_graphics_set))
|
||||
return can_show_graphics;
|
||||
|
||||
can_show_graphics = can_show_utf8 ();
|
||||
|
||||
/* The linux console font typically doesn't have characters we need */
|
||||
if (g_strcmp0 (g_getenv ("TERM"), "linux") == 0)
|
||||
can_show_graphics = FALSE;
|
||||
|
||||
return can_show_graphics;
|
||||
}
|
||||
|
||||
/**
|
||||
* nmc_wifi_strength_bars:
|
||||
* @strength: the access point strength, from 0 to 100
|
||||
*
|
||||
* Converts @strength into a 4-character-wide graphical representation of
|
||||
* strength suitable for printing to stdout. If the current locale and terminal
|
||||
* support it, this will use unicode graphics characters to represent
|
||||
* "bars". Otherwise it will use 0 to 4 asterisks.
|
||||
*
|
||||
* Returns: the graphical representation of the access point strength
|
||||
*/
|
||||
const char *
|
||||
nmc_wifi_strength_bars (guint8 strength)
|
||||
{
|
||||
if (!can_show_graphics ())
|
||||
return nm_utils_wifi_strength_bars (strength);
|
||||
|
||||
if (strength > 80)
|
||||
return /* ▂▄▆█ */ "\342\226\202\342\226\204\342\226\206\342\226\210";
|
||||
else if (strength > 55)
|
||||
return /* ▂▄▆_ */ "\342\226\202\342\226\204\342\226\206_";
|
||||
else if (strength > 30)
|
||||
return /* ▂▄__ */ "\342\226\202\342\226\204__";
|
||||
else if (strength > 5)
|
||||
return /* ▂___ */ "\342\226\202___";
|
||||
else
|
||||
return /* ____ */ "____";
|
||||
}
|
||||
|
||||
/**
|
||||
* nmc_utils_password_subst_char:
|
||||
*
|
||||
* Returns: the string substituted when hiding actual password glyphs
|
||||
*/
|
||||
const char *
|
||||
nmc_password_subst_char (void)
|
||||
{
|
||||
if (can_show_graphics ())
|
||||
return "\u2022"; /* Bullet */
|
||||
else
|
||||
return "*";
|
||||
}
|
||||
|
||||
/*
|
||||
* We actually use a small part of qrcodegen.c, but we'd prefer to keep it
|
||||
* intact. Include it instead of linking to it to give the compiler a
|
||||
* chance to optimize bits we don't need away.
|
||||
*/
|
||||
|
||||
#pragma GCC visibility push(hidden)
|
||||
NM_PRAGMA_WARNING_DISABLE("-Wdeclaration-after-statement")
|
||||
#define NDEBUG
|
||||
#include "qrcodegen.c"
|
||||
NM_PRAGMA_WARNING_REENABLE
|
||||
#pragma GCC visibility pop
|
||||
|
||||
void
|
||||
nmc_print_qrcode (const char *str)
|
||||
{
|
||||
uint8_t tempBuffer[qrcodegen_BUFFER_LEN_FOR_VERSION (qrcodegen_VERSION_MAX)];
|
||||
uint8_t qrcode[qrcodegen_BUFFER_LEN_FOR_VERSION (qrcodegen_VERSION_MAX)];
|
||||
gboolean term_linux;
|
||||
int size;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
term_linux = g_strcmp0 (g_getenv ("TERM"), "linux") == 0;
|
||||
if (!term_linux && !can_show_graphics ())
|
||||
return;
|
||||
|
||||
if (!qrcodegen_encodeText (str,
|
||||
tempBuffer,
|
||||
qrcode,
|
||||
qrcodegen_Ecc_LOW,
|
||||
qrcodegen_VERSION_MIN,
|
||||
qrcodegen_VERSION_MAX,
|
||||
qrcodegen_Mask_AUTO,
|
||||
FALSE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
size = qrcodegen_getSize (qrcode);
|
||||
|
||||
g_print ("\n");
|
||||
|
||||
if (term_linux) {
|
||||
/* G1 alternate character set on Linux console. */
|
||||
for (y = -1; y < size + 1; y += 1) {
|
||||
g_print (" \033[37;40;1m\016");
|
||||
for (x = -1; x < size + 1; x++) {
|
||||
g_print ( qrcodegen_getModule (qrcode, x, y)
|
||||
? " " : "\060\060");
|
||||
}
|
||||
g_print ("\017\033[0m\n");
|
||||
}
|
||||
} else {
|
||||
/* UTF-8 */
|
||||
for (y = -2; y < size + 2; y += 2) {
|
||||
g_print (" \033[37;40m");
|
||||
for (x = -2; x < size + 2; x++) {
|
||||
bool top = qrcodegen_getModule (qrcode, x, y);
|
||||
bool bottom = qrcodegen_getModule (qrcode, x, y + 1);
|
||||
if (top) {
|
||||
g_print (bottom ? " " : "\u2584");
|
||||
} else {
|
||||
g_print (bottom ? "\u2580" : "\u2588");
|
||||
}
|
||||
}
|
||||
g_print ("\033[0m\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
46
clients/common/nm-client-utils.h
Normal file
46
clients/common/nm-client-utils.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2017 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_CLIENT_UTILS_H__
|
||||
#define __NM_CLIENT_UTILS_H__
|
||||
|
||||
#include "nm-meta-setting.h"
|
||||
#include "nm-active-connection.h"
|
||||
#include "nm-device.h"
|
||||
#include "nm-libnm-core-intern/nm-libnm-core-utils.h"
|
||||
|
||||
const NMObject **nmc_objects_sort_by_path (const NMObject *const*objs, gssize len);
|
||||
|
||||
const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error);
|
||||
|
||||
gboolean nmc_string_to_uint (const char *str,
|
||||
gboolean range_check,
|
||||
unsigned long int min,
|
||||
unsigned long int max,
|
||||
unsigned long int *value);
|
||||
gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error);
|
||||
gboolean nmc_string_to_ternary (const char *str, NMTernary *val, GError **error);
|
||||
|
||||
gboolean matches (const char *cmd, const char *pattern);
|
||||
|
||||
/* FIXME: don't expose this function on its own, at least not from this file. */
|
||||
const char *nmc_bond_validate_mode (const char *mode, GError **error);
|
||||
|
||||
const char *nm_active_connection_state_reason_to_string (NMActiveConnectionStateReason reason);
|
||||
const char *nmc_device_state_to_string (NMDeviceState state);
|
||||
const char *nmc_device_reason_to_string (NMDeviceStateReason reason);
|
||||
const char *nmc_device_metered_to_string (NMMetered value);
|
||||
|
||||
NMActiveConnectionState nmc_activation_get_effective_state (NMActiveConnection *active,
|
||||
NMDevice *device,
|
||||
const char **reason);
|
||||
|
||||
const char *nmc_wifi_strength_bars (guint8 strength);
|
||||
|
||||
const char *nmc_password_subst_char (void);
|
||||
|
||||
void nmc_print_qrcode (const char *str);
|
||||
|
||||
#endif /* __NM_CLIENT_UTILS_H__ */
|
||||
632
clients/common/nm-meta-setting-access.c
Normal file
632
clients/common/nm-meta-setting-access.c
Normal file
|
|
@ -0,0 +1,632 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2017 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-meta-setting-access.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const NMMetaSettingInfoEditor *
|
||||
_get_meta_setting_info_editor_from_msi (const NMMetaSettingInfo *meta_setting_info)
|
||||
{
|
||||
const NMMetaSettingInfoEditor *setting_info;
|
||||
|
||||
if (!meta_setting_info)
|
||||
return NULL;
|
||||
|
||||
nm_assert (meta_setting_info->get_setting_gtype);
|
||||
nm_assert (meta_setting_info->meta_type < G_N_ELEMENTS (nm_meta_setting_infos_editor));
|
||||
|
||||
setting_info = &nm_meta_setting_infos_editor[meta_setting_info->meta_type];
|
||||
|
||||
nm_assert (setting_info->general == meta_setting_info);
|
||||
return setting_info;
|
||||
}
|
||||
|
||||
const NMMetaSettingInfoEditor *
|
||||
nm_meta_setting_info_editor_find_by_name (const char *setting_name, gboolean use_alias)
|
||||
{
|
||||
const NMMetaSettingInfoEditor *setting_info;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (setting_name, NULL);
|
||||
|
||||
setting_info = _get_meta_setting_info_editor_from_msi (nm_meta_setting_infos_by_name (setting_name));
|
||||
if (!setting_info && use_alias) {
|
||||
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
|
||||
if (nm_streq0 (nm_meta_setting_infos_editor[i].alias, setting_name)) {
|
||||
setting_info = &nm_meta_setting_infos_editor[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return setting_info;
|
||||
}
|
||||
|
||||
const NMMetaSettingInfoEditor *
|
||||
nm_meta_setting_info_editor_find_by_gtype (GType gtype)
|
||||
{
|
||||
return _get_meta_setting_info_editor_from_msi (nm_meta_setting_infos_by_gtype (gtype));
|
||||
}
|
||||
|
||||
const NMMetaSettingInfoEditor *
|
||||
nm_meta_setting_info_editor_find_by_setting (NMSetting *setting)
|
||||
{
|
||||
const NMMetaSettingInfoEditor *setting_info;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING (setting), NULL);
|
||||
|
||||
setting_info = nm_meta_setting_info_editor_find_by_gtype (G_OBJECT_TYPE (setting));
|
||||
|
||||
nm_assert (setting_info);
|
||||
nm_assert (G_TYPE_CHECK_INSTANCE_TYPE (setting, setting_info->general->get_setting_gtype ()));
|
||||
return setting_info;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const NMMetaPropertyInfo *
|
||||
nm_meta_setting_info_editor_get_property_info (const NMMetaSettingInfoEditor *setting_info, const char *property_name)
|
||||
{
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (setting_info, NULL);
|
||||
g_return_val_if_fail (property_name, NULL);
|
||||
|
||||
for (i = 0; i < setting_info->properties_num; i++) {
|
||||
nm_assert (setting_info->properties[i]->property_name);
|
||||
nm_assert (setting_info->properties[i]->setting_info == setting_info);
|
||||
if (nm_streq (setting_info->properties[i]->property_name, property_name))
|
||||
return setting_info->properties[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_meta_setting_info_editor_has_secrets (const NMMetaSettingInfoEditor *setting_info)
|
||||
{
|
||||
guint i;
|
||||
|
||||
if (!setting_info)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < setting_info->properties_num; i++) {
|
||||
if (setting_info->properties[i]->is_secret)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const NMMetaPropertyInfo *
|
||||
nm_meta_property_info_find_by_name (const char *setting_name, const char *property_name)
|
||||
{
|
||||
const NMMetaSettingInfoEditor *setting_info;
|
||||
const NMMetaPropertyInfo *property_info;
|
||||
|
||||
setting_info = nm_meta_setting_info_editor_find_by_name (setting_name, FALSE);
|
||||
if (!setting_info)
|
||||
return NULL;
|
||||
|
||||
property_info = nm_meta_setting_info_editor_get_property_info (setting_info, property_name);
|
||||
if (!property_info)
|
||||
return NULL;
|
||||
|
||||
nm_assert (property_info->setting_info == setting_info);
|
||||
|
||||
return property_info;
|
||||
}
|
||||
|
||||
const NMMetaPropertyInfo *
|
||||
nm_meta_property_info_find_by_setting (NMSetting *setting, const char *property_name)
|
||||
{
|
||||
const NMMetaSettingInfoEditor *setting_info;
|
||||
const NMMetaPropertyInfo *property_info;
|
||||
|
||||
setting_info = nm_meta_setting_info_editor_find_by_setting (setting);
|
||||
if (!setting_info)
|
||||
return NULL;
|
||||
property_info = nm_meta_setting_info_editor_get_property_info (setting_info, property_name);
|
||||
if (!property_info)
|
||||
return NULL;
|
||||
|
||||
nm_assert (property_info->setting_info == setting_info);
|
||||
nm_assert (property_info == nm_meta_property_info_find_by_name (nm_setting_get_name (setting), property_name));
|
||||
|
||||
return property_info;
|
||||
}
|
||||
|
||||
NMSetting *
|
||||
nm_meta_setting_info_editor_new_setting (const NMMetaSettingInfoEditor *setting_info,
|
||||
NMMetaAccessorSettingInitType init_type)
|
||||
{
|
||||
NMSetting *setting;
|
||||
|
||||
g_return_val_if_fail (setting_info, NULL);
|
||||
|
||||
setting = g_object_new (setting_info->general->get_setting_gtype (), NULL);
|
||||
|
||||
if ( setting_info->setting_init_fcn
|
||||
&& init_type != NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT) {
|
||||
setting_info->setting_init_fcn (setting_info,
|
||||
setting,
|
||||
init_type);
|
||||
}
|
||||
|
||||
return setting;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const NMMetaSettingInfoEditor *const*
|
||||
nm_meta_setting_infos_editor_p (void)
|
||||
{
|
||||
static const NMMetaSettingInfoEditor *cache[_NM_META_SETTING_TYPE_NUM + 1] = { NULL };
|
||||
guint i;
|
||||
|
||||
if (G_UNLIKELY (!cache[0])) {
|
||||
for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++)
|
||||
cache[i] = &nm_meta_setting_infos_editor[i];
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *
|
||||
nm_meta_abstract_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header)
|
||||
{
|
||||
const char *n;
|
||||
|
||||
nm_assert (abstract_info);
|
||||
nm_assert (abstract_info->meta_type);
|
||||
nm_assert (abstract_info->meta_type->get_name);
|
||||
n = abstract_info->meta_type->get_name (abstract_info, for_header);
|
||||
nm_assert (n && n[0]);
|
||||
return n;
|
||||
}
|
||||
|
||||
const NMMetaAbstractInfo *const*
|
||||
nm_meta_abstract_info_get_nested (const NMMetaAbstractInfo *abstract_info,
|
||||
guint *out_len,
|
||||
gpointer *nested_to_free)
|
||||
{
|
||||
const NMMetaAbstractInfo *const*nested;
|
||||
guint l = 0;
|
||||
gs_free gpointer f = NULL;
|
||||
|
||||
nm_assert (abstract_info);
|
||||
nm_assert (abstract_info->meta_type);
|
||||
nm_assert (nested_to_free && !*nested_to_free);
|
||||
|
||||
if (abstract_info->meta_type->get_nested) {
|
||||
nested = abstract_info->meta_type->get_nested (abstract_info, &l, &f);
|
||||
nm_assert (NM_PTRARRAY_LEN (nested) == l);
|
||||
nm_assert (!f || nested == f);
|
||||
if (nested && nested[0]) {
|
||||
NM_SET_OUT (out_len, l);
|
||||
*nested_to_free = g_steal_pointer (&f);
|
||||
return nested;
|
||||
}
|
||||
}
|
||||
NM_SET_OUT (out_len, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gconstpointer
|
||||
nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
gpointer target,
|
||||
gpointer target_data,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
nm_assert (abstract_info);
|
||||
nm_assert (abstract_info->meta_type);
|
||||
nm_assert (!out_to_free || !*out_to_free);
|
||||
nm_assert (out_flags);
|
||||
|
||||
*out_flags = NM_META_ACCESSOR_GET_OUT_FLAGS_NONE;
|
||||
NM_SET_OUT (out_is_default, FALSE);
|
||||
|
||||
if (!abstract_info->meta_type->get_fcn)
|
||||
g_return_val_if_reached (NULL);
|
||||
|
||||
return abstract_info->meta_type->get_fcn (abstract_info,
|
||||
environment,
|
||||
environment_user_data,
|
||||
target,
|
||||
target_data,
|
||||
get_type,
|
||||
get_flags,
|
||||
out_flags,
|
||||
out_is_default,
|
||||
out_to_free);
|
||||
}
|
||||
|
||||
const char *const*
|
||||
nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
const NMMetaOperationContext *operation_context,
|
||||
const char *text,
|
||||
gboolean *out_complete_filename,
|
||||
char ***out_to_free)
|
||||
{
|
||||
const char *const*values;
|
||||
gsize i, j, text_len;
|
||||
|
||||
nm_assert (abstract_info);
|
||||
nm_assert (abstract_info->meta_type);
|
||||
nm_assert (out_to_free && !*out_to_free);
|
||||
|
||||
*out_to_free = NULL;
|
||||
|
||||
if (!abstract_info->meta_type->complete_fcn)
|
||||
return NULL;
|
||||
|
||||
values = abstract_info->meta_type->complete_fcn (abstract_info,
|
||||
environment,
|
||||
environment_user_data,
|
||||
operation_context,
|
||||
text,
|
||||
out_complete_filename,
|
||||
out_to_free);
|
||||
|
||||
nm_assert (!*out_to_free || values == (const char *const*) *out_to_free);
|
||||
|
||||
if (!values)
|
||||
return NULL;
|
||||
|
||||
if (!values[0]) {
|
||||
nm_clear_g_free (out_to_free);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!text || !text[0])
|
||||
return values;
|
||||
|
||||
/* for convenience, we allow the complete_fcn() implementations to
|
||||
* ignore "text". We filter out invalid matches here. */
|
||||
|
||||
text_len = strlen (text);
|
||||
|
||||
if (*out_to_free) {
|
||||
char **v = *out_to_free;
|
||||
|
||||
for (i = 0, j = 0; v[i]; i++) {
|
||||
if (strncmp (v[i], text, text_len) != 0) {
|
||||
g_free (v[i]);
|
||||
continue;
|
||||
}
|
||||
v[j++] = v[i];
|
||||
}
|
||||
if (j)
|
||||
v[j++] = NULL;
|
||||
else {
|
||||
g_free (v);
|
||||
*out_to_free = v = NULL;
|
||||
}
|
||||
return (const char *const*) v;
|
||||
} else {
|
||||
const char *const*v = values;
|
||||
char **r;
|
||||
|
||||
for (i = 0, j = 0; v[i]; i++) {
|
||||
if (strncmp (v[i], text, text_len) != 0)
|
||||
continue;
|
||||
j++;
|
||||
}
|
||||
if (j == i)
|
||||
return values;
|
||||
else if (!j)
|
||||
return NULL;
|
||||
|
||||
r = g_new (char *, j + 1);
|
||||
v = values;
|
||||
for (i = 0, j = 0; v[i]; i++) {
|
||||
if (strncmp (v[i], text, text_len) != 0)
|
||||
continue;
|
||||
r[j++] = g_strdup (v[i]);
|
||||
}
|
||||
r[j++] = NULL;
|
||||
return (const char *const*) (*out_to_free = r);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
char *
|
||||
nm_meta_abstract_info_get_nested_names_str (const NMMetaAbstractInfo *abstract_info, const char *name_prefix)
|
||||
{
|
||||
gs_free gpointer nested_to_free = NULL;
|
||||
const NMMetaAbstractInfo *const*nested;
|
||||
|
||||
nested = nm_meta_abstract_info_get_nested (abstract_info, NULL, &nested_to_free);
|
||||
if (!nested)
|
||||
return NULL;
|
||||
|
||||
if (!name_prefix)
|
||||
name_prefix = nm_meta_abstract_info_get_name (abstract_info, FALSE);
|
||||
|
||||
return nm_meta_abstract_infos_get_names_str (nested, name_prefix);
|
||||
}
|
||||
|
||||
char *
|
||||
nm_meta_abstract_infos_get_names_str (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix)
|
||||
{
|
||||
GString *str;
|
||||
guint i;
|
||||
|
||||
if (!fields_array || !fields_array[0])
|
||||
return NULL;
|
||||
|
||||
str = g_string_sized_new (128);
|
||||
for (i = 0; fields_array[i]; i++) {
|
||||
if (str->len > 0)
|
||||
g_string_append_c (str, ',');
|
||||
if (name_prefix) {
|
||||
g_string_append (str, name_prefix);
|
||||
g_string_append_c (str, '.');
|
||||
}
|
||||
g_string_append (str, nm_meta_abstract_info_get_name (fields_array[i], FALSE));
|
||||
}
|
||||
return g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
guint idx;
|
||||
gsize self_offset_plus_1;
|
||||
gsize sub_offset_plus_1;
|
||||
} OutputSelectionItem;
|
||||
|
||||
static NMMetaSelectionResultList *
|
||||
_output_selection_pack (const NMMetaAbstractInfo *const* fields_array,
|
||||
GArray *array,
|
||||
GString *str)
|
||||
{
|
||||
NMMetaSelectionResultList *result;
|
||||
guint i;
|
||||
guint len;
|
||||
|
||||
len = array ? array->len : 0;
|
||||
|
||||
/* re-organize the collected output data in one buffer that can be freed using
|
||||
* g_free(). This makes allocation more complicated, but saves us from special
|
||||
* handling for free. */
|
||||
result = g_malloc0 (sizeof (NMMetaSelectionResultList) + (len * sizeof (NMMetaSelectionItem)) + (str ? str->len : 0));
|
||||
*((guint *) &result->num) = len;
|
||||
if (len > 0) {
|
||||
char *pdata = &((char *) result)[sizeof (NMMetaSelectionResultList) + (len * sizeof (NMMetaSelectionItem))];
|
||||
|
||||
if (str)
|
||||
memcpy (pdata, str->str, str->len);
|
||||
for (i = 0; i < len; i++) {
|
||||
const OutputSelectionItem *a = &g_array_index (array, OutputSelectionItem, i);
|
||||
NMMetaSelectionItem *p = (NMMetaSelectionItem *) &result->items[i];
|
||||
|
||||
p->info = fields_array[a->idx];
|
||||
p->idx = a->idx;
|
||||
if (a->self_offset_plus_1 > 0)
|
||||
p->self_selection = &pdata[a->self_offset_plus_1 - 1];
|
||||
if (a->sub_offset_plus_1 > 0)
|
||||
p->sub_selection = &pdata[a->sub_offset_plus_1 - 1];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_output_selection_select_one (const NMMetaAbstractInfo *const* fields_array,
|
||||
const char *fields_prefix,
|
||||
const char *fields_str,
|
||||
gboolean validate_nested,
|
||||
GArray **p_array,
|
||||
GString **p_str,
|
||||
GError **error)
|
||||
{
|
||||
guint i, j;
|
||||
const char *i_name;
|
||||
const char *right;
|
||||
gboolean found = FALSE;
|
||||
const NMMetaAbstractInfo *fields_array_failure = NULL;
|
||||
gs_free char *fields_str_clone = NULL;
|
||||
|
||||
nm_assert (fields_str);
|
||||
nm_assert (p_array);
|
||||
nm_assert (p_str);
|
||||
nm_assert (!error || !*error);
|
||||
|
||||
right = strchr (fields_str, '.');
|
||||
if (right) {
|
||||
fields_str_clone = g_strdup (fields_str);
|
||||
fields_str_clone[right - fields_str] = '\0';
|
||||
i_name = fields_str_clone;
|
||||
right = &fields_str_clone[right - fields_str + 1];
|
||||
} else
|
||||
i_name = fields_str;
|
||||
|
||||
if (!fields_array)
|
||||
goto not_found;
|
||||
|
||||
for (i = 0; fields_array[i]; i++) {
|
||||
const NMMetaAbstractInfo *fi = fields_array[i];
|
||||
const NMMetaAbstractInfo *const*nested;
|
||||
gs_free gpointer nested_to_free = NULL;
|
||||
|
||||
if (g_ascii_strcasecmp (i_name, nm_meta_abstract_info_get_name (fi, FALSE)) != 0)
|
||||
continue;
|
||||
|
||||
if (!right || !validate_nested) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
nested = nm_meta_abstract_info_get_nested (fi, NULL, &nested_to_free);
|
||||
if (nested) {
|
||||
for (j = 0; nested[j]; nested++) {
|
||||
if (g_ascii_strcasecmp (right, nm_meta_abstract_info_get_name (nested[j], FALSE)) == 0) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fields_array_failure = fields_array[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
not_found:
|
||||
if ( !right
|
||||
&& !fields_prefix
|
||||
&& ( !g_ascii_strcasecmp (i_name, "all")
|
||||
|| !g_ascii_strcasecmp (i_name, "common")))
|
||||
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, _("field '%s' has to be alone"), i_name);
|
||||
else {
|
||||
gs_free char *allowed_fields = NULL;
|
||||
|
||||
if (fields_array_failure) {
|
||||
gs_free char *p = NULL;
|
||||
|
||||
if (fields_prefix) {
|
||||
p = g_strdup_printf ("%s.%s", fields_prefix,
|
||||
nm_meta_abstract_info_get_name (fields_array_failure, FALSE));
|
||||
}
|
||||
allowed_fields = nm_meta_abstract_info_get_nested_names_str (fields_array_failure, p);
|
||||
} else
|
||||
allowed_fields = nm_meta_abstract_infos_get_names_str (fields_array, NULL);
|
||||
|
||||
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, _("invalid field '%s%s%s%s%s'; %s%s%s"),
|
||||
fields_prefix ?: "", fields_prefix ? "." : "",
|
||||
i_name, right ? "." : "", right ?: "",
|
||||
NM_PRINT_FMT_QUOTED (allowed_fields, "allowed fields: ", allowed_fields, "", "no fields"));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
{
|
||||
GString *str;
|
||||
OutputSelectionItem s = {
|
||||
.idx = i,
|
||||
};
|
||||
|
||||
if (!*p_str)
|
||||
*p_str = g_string_sized_new (64);
|
||||
str = *p_str;
|
||||
|
||||
s.self_offset_plus_1 = str->len + 1;
|
||||
if (fields_prefix) {
|
||||
g_string_append (str, fields_prefix);
|
||||
g_string_append_c (str, '.');
|
||||
}
|
||||
g_string_append_len (str, i_name, strlen (i_name) + 1);
|
||||
|
||||
if (right) {
|
||||
s.sub_offset_plus_1 = str->len + 1;
|
||||
g_string_append_len (str, right, strlen (right) + 1);
|
||||
}
|
||||
|
||||
if (!*p_array)
|
||||
*p_array = g_array_new (FALSE, FALSE, sizeof (OutputSelectionItem));
|
||||
g_array_append_val (*p_array, s);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
NMMetaSelectionResultList *
|
||||
nm_meta_selection_create_all (const NMMetaAbstractInfo *const* fields_array)
|
||||
{
|
||||
gs_unref_array GArray *array = NULL;
|
||||
guint i;
|
||||
|
||||
if (fields_array) {
|
||||
array = g_array_new (FALSE, FALSE, sizeof (OutputSelectionItem));
|
||||
for (i = 0; fields_array[i]; i++) {
|
||||
OutputSelectionItem s = {
|
||||
.idx = i,
|
||||
};
|
||||
|
||||
g_array_append_val (array, s);
|
||||
}
|
||||
}
|
||||
|
||||
return _output_selection_pack (fields_array, array, NULL);
|
||||
}
|
||||
|
||||
NMMetaSelectionResultList *
|
||||
nm_meta_selection_create_parse_one (const NMMetaAbstractInfo *const* fields_array,
|
||||
const char *fields_prefix,
|
||||
const char *fields_str, /* one field selector (contains no commas) and is already stripped of spaces. */
|
||||
gboolean validate_nested,
|
||||
GError **error)
|
||||
{
|
||||
gs_unref_array GArray *array = NULL;
|
||||
nm_auto_free_gstring GString *str = NULL;
|
||||
|
||||
g_return_val_if_fail (!error || !*error, NULL);
|
||||
nm_assert (fields_str && !strchr (fields_str, ','));
|
||||
|
||||
if (!_output_selection_select_one (fields_array,
|
||||
fields_prefix,
|
||||
fields_str,
|
||||
validate_nested,
|
||||
&array,
|
||||
&str,
|
||||
error))
|
||||
return NULL;
|
||||
return _output_selection_pack (fields_array, array, str);
|
||||
|
||||
}
|
||||
|
||||
NMMetaSelectionResultList *
|
||||
nm_meta_selection_create_parse_list (const NMMetaAbstractInfo *const* fields_array,
|
||||
const char *fields_str, /* a comma separated list of selectors */
|
||||
gboolean validate_nested,
|
||||
GError **error)
|
||||
{
|
||||
gs_unref_array GArray *array = NULL;
|
||||
nm_auto_free_gstring GString *str = NULL;
|
||||
gs_free char *fields_str_clone = NULL;
|
||||
char *fields_str_cur;
|
||||
char *fields_str_next;
|
||||
|
||||
g_return_val_if_fail (!error || !*error, NULL);
|
||||
|
||||
if (!fields_str)
|
||||
return nm_meta_selection_create_all (fields_array);
|
||||
|
||||
fields_str_clone = g_strdup (fields_str);
|
||||
for (fields_str_cur = fields_str_clone; fields_str_cur; fields_str_cur = fields_str_next) {
|
||||
fields_str_cur = nm_str_skip_leading_spaces (fields_str_cur);
|
||||
fields_str_next = strchr (fields_str_cur, ',');
|
||||
if (fields_str_next)
|
||||
*fields_str_next++ = '\0';
|
||||
|
||||
g_strchomp (fields_str_cur);
|
||||
if (!fields_str_cur[0])
|
||||
continue;
|
||||
if (!_output_selection_select_one (fields_array,
|
||||
NULL,
|
||||
fields_str_cur,
|
||||
validate_nested,
|
||||
&array,
|
||||
&str,
|
||||
error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _output_selection_pack (fields_array, array, str);
|
||||
}
|
||||
91
clients/common/nm-meta-setting-access.h
Normal file
91
clients/common/nm-meta-setting-access.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2017 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _NM_META_SETTING_ACCESS_H__
|
||||
#define _NM_META_SETTING_ACCESS_H__
|
||||
|
||||
#include "nm-meta-setting.h"
|
||||
#include "nm-meta-setting-desc.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMSetting *nm_meta_setting_info_editor_new_setting (const NMMetaSettingInfoEditor *setting_info,
|
||||
NMMetaAccessorSettingInitType init_type);
|
||||
|
||||
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_name (const char *setting_name, gboolean use_alias);
|
||||
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_gtype (GType gtype);
|
||||
const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_setting (NMSetting *setting);
|
||||
|
||||
const NMMetaPropertyInfo *nm_meta_setting_info_editor_get_property_info (const NMMetaSettingInfoEditor *setting_info,
|
||||
const char *property_name);
|
||||
const NMMetaPropertyInfo *nm_meta_property_info_find_by_name (const char *setting_name,
|
||||
const char *property_name);
|
||||
const NMMetaPropertyInfo *nm_meta_property_info_find_by_setting (NMSetting *setting,
|
||||
const char *property_name);
|
||||
|
||||
gboolean nm_meta_setting_info_editor_has_secrets (const NMMetaSettingInfoEditor *setting_info);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const NMMetaSettingInfoEditor *const*nm_meta_setting_infos_editor_p (void);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *nm_meta_abstract_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header);
|
||||
|
||||
const NMMetaAbstractInfo *const*nm_meta_abstract_info_get_nested (const NMMetaAbstractInfo *abstract_info,
|
||||
guint *out_len,
|
||||
gpointer *nested_to_free);
|
||||
|
||||
gconstpointer nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
gpointer target,
|
||||
gpointer target_data,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free);
|
||||
|
||||
const char *const*nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
const NMMetaOperationContext *operation_context,
|
||||
const char *text,
|
||||
gboolean *out_complete_filename,
|
||||
char ***out_to_free);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
char *nm_meta_abstract_info_get_nested_names_str (const NMMetaAbstractInfo *abstract_info, const char *name_prefix);
|
||||
char *nm_meta_abstract_infos_get_names_str (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
const NMMetaAbstractInfo *info;
|
||||
const char *self_selection;
|
||||
const char *sub_selection;
|
||||
guint idx;
|
||||
} NMMetaSelectionItem;
|
||||
|
||||
typedef struct {
|
||||
const guint num;
|
||||
const NMMetaSelectionItem items[];
|
||||
} NMMetaSelectionResultList;
|
||||
|
||||
NMMetaSelectionResultList *nm_meta_selection_create_all (const NMMetaAbstractInfo *const* fields_array);
|
||||
NMMetaSelectionResultList *nm_meta_selection_create_parse_one (const NMMetaAbstractInfo *const* fields_array,
|
||||
const char *fields_prefix,
|
||||
const char *fields_str,
|
||||
gboolean validate_nested,
|
||||
GError **error);
|
||||
NMMetaSelectionResultList *nm_meta_selection_create_parse_list (const NMMetaAbstractInfo *const* fields_array,
|
||||
const char *fields_str,
|
||||
gboolean validate_nested,
|
||||
GError **error);
|
||||
|
||||
#endif /* _NM_META_SETTING_ACCESS_H__ */
|
||||
8211
clients/common/nm-meta-setting-desc.c
Normal file
8211
clients/common/nm-meta-setting-desc.c
Normal file
File diff suppressed because it is too large
Load diff
523
clients/common/nm-meta-setting-desc.h
Normal file
523
clients/common/nm-meta-setting-desc.h
Normal file
|
|
@ -0,0 +1,523 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2010 - 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_META_SETTING_DESC_H__
|
||||
#define __NM_META_SETTING_DESC_H__
|
||||
|
||||
#include "nm-glib-aux/nm-obj.h"
|
||||
#include "nm-meta-setting.h"
|
||||
#include "nm-libnm-core-intern/nm-ethtool-utils.h"
|
||||
|
||||
struct _NMDevice;
|
||||
|
||||
#define NM_META_TEXT_HIDDEN N_("<hidden>")
|
||||
|
||||
#define NM_META_TEXT_PROMPT_ADSL_PROTO N_("Protocol")
|
||||
#define NM_META_TEXT_PROMPT_ADSL_PROTO_CHOICES "(" NM_SETTING_ADSL_PROTOCOL_PPPOA "/" NM_SETTING_ADSL_PROTOCOL_PPPOE "/" NM_SETTING_ADSL_PROTOCOL_IPOATM ")"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_ADSL_ENCAP N_("ADSL encapsulation")
|
||||
#define NM_META_TEXT_PROMPT_ADSL_ENCAP_CHOICES "(" NM_SETTING_ADSL_ENCAPSULATION_VCMUX "/" NM_SETTING_ADSL_ENCAPSULATION_LLC ") [none]"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_CON_TYPE N_("Connection type")
|
||||
#define NM_META_TEXT_PROMPT_IFNAME N_("Interface name [*]")
|
||||
#define NM_META_TEXT_PROMPT_VPN_TYPE N_("VPN type")
|
||||
#define NM_META_TEXT_PROMPT_MASTER N_("Master")
|
||||
|
||||
#define NM_META_TEXT_PROMPT_IB_MODE N_("Transport mode")
|
||||
#define NM_META_TEXT_WORD_DATAGRAM "datagram"
|
||||
#define NM_META_TEXT_WORD_CONNECTED "connected"
|
||||
#define NM_META_TEXT_PROMPT_IB_MODE_CHOICES "(" NM_META_TEXT_WORD_DATAGRAM "/" NM_META_TEXT_WORD_CONNECTED ") [" NM_META_TEXT_WORD_DATAGRAM "]"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_BT_TYPE N_("Bluetooth type")
|
||||
#define NM_META_TEXT_WORD_PANU "panu"
|
||||
#define NM_META_TEXT_WORD_NAP "nap"
|
||||
#define NM_META_TEXT_WORD_DUN_GSM "dun-gsm"
|
||||
#define NM_META_TEXT_WORD_DUN_CDMA "dun-cdma"
|
||||
#define NM_META_TEXT_PROMPT_BT_TYPE_CHOICES "(" NM_META_TEXT_WORD_PANU "/" NM_META_TEXT_WORD_NAP "/" NM_META_TEXT_WORD_DUN_GSM "/" NM_META_TEXT_WORD_DUN_CDMA ") [" NM_META_TEXT_WORD_PANU "]"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_BOND_MODE N_("Bonding mode")
|
||||
|
||||
#define NM_META_TEXT_PROMPT_BOND_MON_MODE N_("Bonding monitoring mode")
|
||||
#define NM_META_TEXT_WORD_MIIMON "miimon"
|
||||
#define NM_META_TEXT_WORD_ARP "arp"
|
||||
#define NM_META_TEXT_PROMPT_BOND_MON_MODE_CHOICES "(" NM_META_TEXT_WORD_MIIMON "/" NM_META_TEXT_WORD_ARP ") [" NM_META_TEXT_WORD_MIIMON "]"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_WIFI_MODE N_("Wi-Fi mode")
|
||||
#define NM_META_TEXT_WORD_INFRA "infrastructure"
|
||||
#define NM_META_TEXT_WORD_AP "ap"
|
||||
#define NM_META_TEXT_WORD_ADHOC "adhoc"
|
||||
#define NM_META_TEXT_WORD_MESH "mesh"
|
||||
#define NM_META_TEXT_PROMPT_WIFI_MODE_CHOICES "(" NM_META_TEXT_WORD_INFRA "/" NM_META_TEXT_WORD_AP "/" NM_META_TEXT_WORD_ADHOC "/" NM_META_TEXT_WORD_MESH ") [" NM_META_TEXT_WORD_INFRA "]"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_TUN_MODE N_("Tun mode")
|
||||
#define NM_META_TEXT_WORD_TUN "tun"
|
||||
#define NM_META_TEXT_WORD_TAP "tap"
|
||||
#define NM_META_TEXT_PROMPT_TUN_MODE_CHOICES "(" NM_META_TEXT_WORD_TUN "/" NM_META_TEXT_WORD_TAP ") [" NM_META_TEXT_WORD_TUN "]"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_IP_TUNNEL_MODE N_("IP Tunnel mode")
|
||||
|
||||
#define NM_META_TEXT_PROMPT_MACVLAN_MODE N_("MACVLAN mode")
|
||||
|
||||
#define NM_META_TEXT_PROMPT_MACSEC_MODE N_("MACsec mode")
|
||||
#define NM_META_TEXT_WORD_PSK "psk"
|
||||
#define NM_META_TEXT_WORD_EAP "eap"
|
||||
#define NM_META_TEXT_PROMPT_MACSEC_MODE_CHOICES "(" NM_META_TEXT_WORD_PSK "/" NM_META_TEXT_WORD_EAP ")"
|
||||
|
||||
#define NM_META_TEXT_PROMPT_PROXY_METHOD N_("Proxy method")
|
||||
#define NM_META_TEXT_WORD_NONE "none"
|
||||
#define NM_META_TEXT_WORD_AUTO "auto"
|
||||
#define NM_META_TEXT_PROMPT_PROXY_METHOD_CHOICES "(" NM_META_TEXT_WORD_NONE "/" NM_META_TEXT_WORD_AUTO ") [" NM_META_TEXT_WORD_NONE "]"
|
||||
|
||||
typedef enum {
|
||||
NM_META_COLOR_NONE = 0,
|
||||
NM_META_COLOR_CONNECTION_ACTIVATED,
|
||||
NM_META_COLOR_CONNECTION_ACTIVATING,
|
||||
NM_META_COLOR_CONNECTION_DISCONNECTING,
|
||||
NM_META_COLOR_CONNECTION_INVISIBLE,
|
||||
NM_META_COLOR_CONNECTION_UNKNOWN,
|
||||
NM_META_COLOR_CONNECTIVITY_FULL,
|
||||
NM_META_COLOR_CONNECTIVITY_LIMITED,
|
||||
NM_META_COLOR_CONNECTIVITY_NONE,
|
||||
NM_META_COLOR_CONNECTIVITY_PORTAL,
|
||||
NM_META_COLOR_CONNECTIVITY_UNKNOWN,
|
||||
NM_META_COLOR_DEVICE_ACTIVATED,
|
||||
NM_META_COLOR_DEVICE_ACTIVATING,
|
||||
NM_META_COLOR_DEVICE_DISCONNECTED,
|
||||
NM_META_COLOR_DEVICE_FIRMWARE_MISSING,
|
||||
NM_META_COLOR_DEVICE_PLUGIN_MISSING,
|
||||
NM_META_COLOR_DEVICE_UNAVAILABLE,
|
||||
NM_META_COLOR_DEVICE_DISABLED,
|
||||
NM_META_COLOR_DEVICE_UNKNOWN,
|
||||
NM_META_COLOR_MANAGER_RUNNING,
|
||||
NM_META_COLOR_MANAGER_STARTING,
|
||||
NM_META_COLOR_MANAGER_STOPPED,
|
||||
NM_META_COLOR_PERMISSION_AUTH,
|
||||
NM_META_COLOR_PERMISSION_NO,
|
||||
NM_META_COLOR_PERMISSION_UNKNOWN,
|
||||
NM_META_COLOR_PERMISSION_YES,
|
||||
NM_META_COLOR_PROMPT,
|
||||
NM_META_COLOR_STATE_ASLEEP,
|
||||
NM_META_COLOR_STATE_CONNECTED_GLOBAL,
|
||||
NM_META_COLOR_STATE_CONNECTED_LOCAL,
|
||||
NM_META_COLOR_STATE_CONNECTED_SITE,
|
||||
NM_META_COLOR_STATE_CONNECTING,
|
||||
NM_META_COLOR_STATE_DISCONNECTED,
|
||||
NM_META_COLOR_STATE_DISCONNECTING,
|
||||
NM_META_COLOR_STATE_UNKNOWN,
|
||||
NM_META_COLOR_WIFI_SIGNAL_EXCELLENT,
|
||||
NM_META_COLOR_WIFI_SIGNAL_FAIR,
|
||||
NM_META_COLOR_WIFI_SIGNAL_GOOD,
|
||||
NM_META_COLOR_WIFI_SIGNAL_POOR,
|
||||
NM_META_COLOR_WIFI_SIGNAL_UNKNOWN,
|
||||
NM_META_COLOR_DISABLED,
|
||||
NM_META_COLOR_ENABLED,
|
||||
_NM_META_COLOR_NUM
|
||||
} NMMetaColor;
|
||||
|
||||
typedef enum {
|
||||
NM_META_ACCESSOR_MODIFIER_SET,
|
||||
NM_META_ACCESSOR_MODIFIER_ADD,
|
||||
NM_META_ACCESSOR_MODIFIER_DEL,
|
||||
} NMMetaAccessorModifier;
|
||||
|
||||
typedef enum {
|
||||
NM_META_ACCESSOR_GET_TYPE_PRETTY,
|
||||
NM_META_ACCESSOR_GET_TYPE_PARSABLE,
|
||||
NM_META_ACCESSOR_GET_TYPE_COLOR,
|
||||
} NMMetaAccessorGetType;
|
||||
|
||||
typedef enum {
|
||||
NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT,
|
||||
NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI,
|
||||
} NMMetaAccessorSettingInitType;
|
||||
|
||||
typedef enum {
|
||||
NM_META_ACCESSOR_GET_FLAGS_NONE = 0,
|
||||
NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV = (1LL << 0),
|
||||
NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS = (1LL << 1),
|
||||
} NMMetaAccessorGetFlags;
|
||||
|
||||
typedef enum {
|
||||
NM_META_ACCESSOR_GET_OUT_FLAGS_NONE = 0,
|
||||
NM_META_ACCESSOR_GET_OUT_FLAGS_STRV = (1LL << 0),
|
||||
|
||||
/* the property allows to be hidden, if and only if, it's value is set to the
|
||||
* default. This should only be set by new properties, to preserve behavior
|
||||
* of old properties, which were always printed. */
|
||||
NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE = (1LL << 1),
|
||||
} NMMetaAccessorGetOutFlags;
|
||||
|
||||
typedef enum {
|
||||
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC = (1LL << 0),
|
||||
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC_HEX = (1LL << 1),
|
||||
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT = (1LL << 2),
|
||||
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT_L10N = (1LL << 3),
|
||||
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC = (1LL << 4),
|
||||
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC_HEX = (1LL << 5),
|
||||
NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT = (1LL << 6),
|
||||
} NMMetaPropertyTypFlags;
|
||||
|
||||
typedef enum {
|
||||
NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT,
|
||||
NM_META_PROPERTY_TYPE_MAC_MODE_CLONED,
|
||||
NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND,
|
||||
NM_META_PROPERTY_TYPE_MAC_MODE_WPAN,
|
||||
} NMMetaPropertyTypeMacMode;
|
||||
|
||||
typedef struct _NMMetaEnvironment NMMetaEnvironment;
|
||||
typedef struct _NMMetaType NMMetaType;
|
||||
typedef struct _NMMetaAbstractInfo NMMetaAbstractInfo;
|
||||
typedef struct _NMMetaSettingInfoEditor NMMetaSettingInfoEditor;
|
||||
typedef struct _NMMetaPropertyInfo NMMetaPropertyInfo;
|
||||
typedef struct _NMMetaPropertyType NMMetaPropertyType;
|
||||
typedef struct _NMMetaPropertyTypData NMMetaPropertyTypData;
|
||||
typedef struct _NMMetaOperationContext NMMetaOperationContext;
|
||||
typedef struct _NMMetaNestedPropertyInfo NMMetaNestedPropertyInfo;
|
||||
typedef struct _NMMetaPropertyTypDataNested NMMetaPropertyTypDataNested;
|
||||
|
||||
/* this gives some context information for virtual functions.
|
||||
* This command actually violates layering, and should be considered
|
||||
* a hack. In the future, try to replace its use. */
|
||||
struct _NMMetaOperationContext {
|
||||
NMConnection *connection;
|
||||
};
|
||||
|
||||
struct _NMMetaPropertyType {
|
||||
|
||||
/* should return a translated string */
|
||||
const char *(*describe_fcn) (const NMMetaPropertyInfo *property_info,
|
||||
char **out_to_free);
|
||||
|
||||
gconstpointer (*get_fcn) (const NMMetaPropertyInfo *property_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
NMSetting *setting,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free);
|
||||
gboolean (*set_fcn) (const NMMetaPropertyInfo *property_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
NMSetting *setting,
|
||||
NMMetaAccessorModifier modifier,
|
||||
const char *value,
|
||||
GError **error);
|
||||
|
||||
const char *const*(*values_fcn) (const NMMetaPropertyInfo *property_info,
|
||||
char ***out_to_free);
|
||||
|
||||
const char *const*(*complete_fcn) (const NMMetaPropertyInfo *property_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
const NMMetaOperationContext *operation_context,
|
||||
const char *text,
|
||||
gboolean *out_complete_filename,
|
||||
char ***out_to_free);
|
||||
|
||||
/* Whether set_fcn() supports the '-' modifier. That is, whether the property
|
||||
* is a list type. */
|
||||
bool set_supports_remove:1;
|
||||
};
|
||||
|
||||
struct _NMUtilsEnumValueInfo;
|
||||
|
||||
typedef union {
|
||||
gint64 i64;
|
||||
guint64 u64;
|
||||
} NMMetaSignUnsignInt64;
|
||||
|
||||
typedef struct {
|
||||
const char *nick;
|
||||
NMMetaSignUnsignInt64 value;
|
||||
} NMMetaUtilsIntValueInfo;
|
||||
|
||||
struct _NMMetaPropertyTypData {
|
||||
union {
|
||||
struct {
|
||||
GType (*get_gtype) (void);
|
||||
int min;
|
||||
int max;
|
||||
const struct _NMUtilsEnumValueInfo *value_infos_get; /* nicks for get function */
|
||||
const struct _NMUtilsEnumValueInfo *value_infos; /* nicks for set function */
|
||||
void (*pre_set_notify) (const NMMetaPropertyInfo *property_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
NMSetting *setting,
|
||||
int value);
|
||||
} gobject_enum;
|
||||
struct {
|
||||
NMMetaSignUnsignInt64 min;
|
||||
NMMetaSignUnsignInt64 max;
|
||||
guint base;
|
||||
const NMMetaUtilsIntValueInfo *value_infos;
|
||||
} gobject_int;
|
||||
struct {
|
||||
const char *(*validate_fcn) (const char *value, char **out_to_free, GError **error);
|
||||
} gobject_string;
|
||||
struct {
|
||||
bool legacy_format:1;
|
||||
} gobject_bytes;
|
||||
struct {
|
||||
guint32 (*get_num_fcn_u32) (NMSetting *setting);
|
||||
guint (*get_num_fcn_u) (NMSetting *setting);
|
||||
void (*clear_all_fcn) (NMSetting *setting);
|
||||
|
||||
/* some multilist properties distinguish between an empty list and
|
||||
* and unset. If this function pointer is set, certain behaviors come
|
||||
* into action to handle that. */
|
||||
void (*clear_emptyunset_fcn) (NMSetting *setting,
|
||||
gboolean is_set /* or else set default */);
|
||||
|
||||
gboolean (*add_fcn) (NMSetting *setting,
|
||||
const char *item);
|
||||
void (*add2_fcn) (NMSetting *setting,
|
||||
const char *item);
|
||||
const char *(*validate_fcn) (const char *item, GError **error);
|
||||
const char *(*validate2_fcn) (NMSetting *setting, const char *item, GError **error);
|
||||
void (*remove_by_idx_fcn_u32) (NMSetting *setting, guint32 idx);
|
||||
void (*remove_by_idx_fcn_u) (NMSetting *setting, guint idx);
|
||||
void (*remove_by_idx_fcn_s) (NMSetting *setting, int idx);
|
||||
gboolean (*remove_by_value_fcn) (NMSetting *setting, const char *item);
|
||||
bool strsplit_plain:1;
|
||||
bool strsplit_with_spaces:1;
|
||||
} multilist;
|
||||
struct {
|
||||
guint (*get_num_fcn) (NMSetting *setting);
|
||||
void (*obj_to_str_fcn) (NMMetaAccessorGetType get_type,
|
||||
NMSetting *setting,
|
||||
guint idx,
|
||||
GString *str);
|
||||
gboolean (*set_fcn) (NMSetting *setting,
|
||||
gboolean do_add /* or else remove. */,
|
||||
const char *value,
|
||||
GError **error);
|
||||
void (*clear_all_fcn) (NMSetting *setting);
|
||||
void (*remove_by_idx_fcn_u) (NMSetting *setting, guint idx);
|
||||
void (*remove_by_idx_fcn_s) (NMSetting *setting, int idx);
|
||||
bool delimit_pretty_with_semicolon:1;
|
||||
bool strsplit_plain:1;
|
||||
} objlist;
|
||||
struct {
|
||||
gboolean (*set_fcn) (NMSetting *setting,
|
||||
const char *option,
|
||||
const char *value,
|
||||
GError **error);
|
||||
bool no_empty_value:1;
|
||||
} optionlist;
|
||||
struct {
|
||||
guint32 (*get_fcn) (NMSetting *setting);
|
||||
} mtu;
|
||||
struct {
|
||||
NMSetting8021xSchemeType scheme_type;
|
||||
} cert_8021x;
|
||||
struct {
|
||||
NMMetaPropertyTypeMacMode mode;
|
||||
} mac;
|
||||
struct {
|
||||
guint (*get_fcn) (NMSettingDcb *setting,
|
||||
guint user_priority);
|
||||
void (*set_fcn) (NMSettingDcb *setting,
|
||||
guint id,
|
||||
guint value);
|
||||
guint max;
|
||||
guint other;
|
||||
bool is_percent:1;
|
||||
} dcb;
|
||||
struct {
|
||||
gboolean (*get_fcn) (NMSettingDcb *s_dcb,
|
||||
guint priority);
|
||||
void (*set_fcn) (NMSettingDcb *setting,
|
||||
guint user_priority,
|
||||
gboolean enabled);
|
||||
bool with_flow_control_flags:1;
|
||||
} dcb_bool;
|
||||
struct {
|
||||
NMEthtoolID ethtool_id;
|
||||
} ethtool;
|
||||
} subtype;
|
||||
gboolean (*is_default_fcn) (NMSetting *setting);
|
||||
const char *const*values_static;
|
||||
const NMMetaPropertyTypDataNested *nested;
|
||||
NMMetaPropertyTypFlags typ_flags;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
NM_META_PROPERTY_INF_FLAG_NONE = 0x00,
|
||||
NM_META_PROPERTY_INF_FLAG_REQD = 0x01, /* Don't ask to ask. */
|
||||
NM_META_PROPERTY_INF_FLAG_DONT_ASK = 0x02, /* Don't ask interactively by default */
|
||||
NM_META_PROPERTY_INF_FLAG_MULTI = 0x04, /* Ask multiple times, do an append instead of set. */
|
||||
} NMMetaPropertyInfFlags;
|
||||
|
||||
enum {
|
||||
_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE = 0,
|
||||
_NM_META_PROPERTY_TYPE_CONNECTION_TYPE = 3,
|
||||
};
|
||||
|
||||
#define nm_meta_property_info_connection_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION].properties[_NM_META_PROPERTY_TYPE_CONNECTION_TYPE])
|
||||
#define nm_meta_property_info_vpn_service_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_VPN].properties[_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE])
|
||||
|
||||
struct _NMMetaPropertyInfo {
|
||||
union {
|
||||
NMObjBaseInst parent;
|
||||
const NMMetaType *meta_type;
|
||||
};
|
||||
|
||||
const NMMetaSettingInfoEditor *setting_info;
|
||||
|
||||
const char *property_name;
|
||||
|
||||
const char *property_alias;
|
||||
|
||||
NMMetaPropertyInfFlags inf_flags;
|
||||
bool is_secret:1;
|
||||
|
||||
bool is_cli_option:1;
|
||||
|
||||
const char *prompt;
|
||||
|
||||
const char *def_hint;
|
||||
|
||||
const char *describe_doc;
|
||||
|
||||
/* a non-translated but translatable static description (marked with N_()). */
|
||||
const char *describe_message;
|
||||
|
||||
const NMMetaPropertyType *property_type;
|
||||
const NMMetaPropertyTypData *property_typ_data;
|
||||
};
|
||||
|
||||
typedef struct _NMMetaSettingValidPartItem {
|
||||
const NMMetaSettingInfoEditor *setting_info;
|
||||
bool mandatory;
|
||||
} NMMetaSettingValidPartItem;
|
||||
|
||||
struct _NMMetaSettingInfoEditor {
|
||||
union {
|
||||
NMObjBaseInst parent;
|
||||
const NMMetaType *meta_type;
|
||||
};
|
||||
const NMMetaSettingInfo *general;
|
||||
const char *alias;
|
||||
const char *pretty_name;
|
||||
const NMMetaPropertyInfo *const*properties;
|
||||
guint properties_num;
|
||||
|
||||
/* a NMConnection has a main type (connection.type), which is a
|
||||
* main NMSetting instance. Depending on the type, a connection
|
||||
* may have a list of other allowed settings.
|
||||
*
|
||||
* For example, a connection of type "vlan" may have settings
|
||||
* of type "connection", "vlan", and "wired".
|
||||
*
|
||||
* Some setting types a not a main type (NMSettingProxy). They
|
||||
* don't have valid_settings but are usually referenced by other
|
||||
* settings to be valid for them. */
|
||||
const NMMetaSettingValidPartItem *const*valid_parts;
|
||||
|
||||
void (*setting_init_fcn) (const NMMetaSettingInfoEditor *setting_info,
|
||||
NMSetting *setting,
|
||||
NMMetaAccessorSettingInitType init_type);
|
||||
};
|
||||
|
||||
struct _NMMetaType {
|
||||
NMObjBaseClass parent;
|
||||
const char *type_name;
|
||||
const char *(*get_name) (const NMMetaAbstractInfo *abstract_info,
|
||||
gboolean for_header);
|
||||
const NMMetaAbstractInfo *const*(*get_nested) (const NMMetaAbstractInfo *abstract_info,
|
||||
guint *out_len,
|
||||
gpointer *out_to_free);
|
||||
gconstpointer (*get_fcn) (const NMMetaAbstractInfo *info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
gpointer target,
|
||||
gpointer target_data,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free);
|
||||
const char *const*(*complete_fcn) (const NMMetaAbstractInfo *info,
|
||||
const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
const NMMetaOperationContext *operation_context,
|
||||
const char *text,
|
||||
gboolean *out_complete_filename,
|
||||
char ***out_to_free);
|
||||
};
|
||||
|
||||
struct _NMMetaAbstractInfo {
|
||||
union {
|
||||
NMObjBaseInst parent;
|
||||
const NMMetaType *meta_type;
|
||||
};
|
||||
};
|
||||
|
||||
extern const NMMetaType nm_meta_type_setting_info_editor;
|
||||
extern const NMMetaType nm_meta_type_property_info;
|
||||
|
||||
extern const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[_NM_META_SETTING_TYPE_NUM];
|
||||
|
||||
extern const NMMetaSettingValidPartItem *const nm_meta_setting_info_valid_parts_default[];
|
||||
|
||||
const NMMetaSettingValidPartItem *const*nm_meta_setting_info_valid_parts_for_slave_type (const char *slave_type, const char **out_slave_name);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
NM_META_ENV_WARN_LEVEL_INFO,
|
||||
NM_META_ENV_WARN_LEVEL_WARN,
|
||||
} NMMetaEnvWarnLevel;
|
||||
|
||||
/* the settings-meta data is supposed to be independent of an actual client
|
||||
* implementation. Hence, there is a need for hooks to the meta-data.
|
||||
* The meta-data handlers may call back to the environment with certain
|
||||
* actions. */
|
||||
struct _NMMetaEnvironment {
|
||||
|
||||
void (*warn_fcn) (const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
NMMetaEnvWarnLevel warn_level,
|
||||
const char *fmt_l10n, /* the untranslated format string, but it is marked for translation using N_(). */
|
||||
va_list ap);
|
||||
|
||||
struct _NMDevice *const*(*get_nm_devices) (const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
guint *out_len);
|
||||
|
||||
struct _NMRemoteConnection *const*(*get_nm_connections) (const NMMetaEnvironment *environment,
|
||||
gpointer environment_user_data,
|
||||
guint *out_len);
|
||||
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* NMSettingBond is special in that it has nested properties.
|
||||
* We will add API to proper handle such types (Bond, VPN, User),
|
||||
* but for now just expose the type info directly. */
|
||||
|
||||
extern const NMMetaType nm_meta_type_nested_property_info;
|
||||
|
||||
struct _NMMetaNestedPropertyInfo {
|
||||
union {
|
||||
const NMMetaType *meta_type;
|
||||
NMMetaPropertyInfo base;
|
||||
};
|
||||
const NMMetaPropertyInfo *parent_info;
|
||||
};
|
||||
|
||||
struct _NMMetaPropertyTypDataNested {
|
||||
const NMMetaNestedPropertyInfo *nested;
|
||||
guint nested_len;
|
||||
};
|
||||
|
||||
const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* __NM_META_SETTING_DESC_H__ */
|
||||
360
clients/common/nm-polkit-listener.c
Normal file
360
clients/common/nm-polkit-listener.c
Normal file
|
|
@ -0,0 +1,360 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:nm-polkit-listener
|
||||
* @short_description: A polkit agent listener
|
||||
*
|
||||
* #NMPolkitListener is the polkit agent listener used by nmcli and nmtui.
|
||||
* http://www.freedesktop.org/software/polkit/docs/latest/index.html
|
||||
*
|
||||
* For an example polkit agent you can look at polkit source tree:
|
||||
* http://cgit.freedesktop.org/polkit/tree/src/polkitagent/polkitagenttextlistener.c
|
||||
* http://cgit.freedesktop.org/polkit/tree/src/programs/pkttyagent.c
|
||||
* or LXDE polkit agent:
|
||||
* http://git.lxde.org/gitweb/?p=debian/lxpolkit.git;a=blob;f=src/lxpolkit-listener.c
|
||||
* https://github.com/lxde/lxqt-policykit/tree/master/src
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-polkit-listener.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if WITH_POLKIT_AGENT
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
gpointer reg_handle; /* handle of polkit agent registration */
|
||||
|
||||
GSimpleAsyncResult *simple;
|
||||
PolkitAgentSession *active_session;
|
||||
gulong cancel_id;
|
||||
GCancellable *cancellable;
|
||||
|
||||
char *action_id;
|
||||
char *message;
|
||||
char *icon_name;
|
||||
char *identity;
|
||||
|
||||
const NMPolkitListenVtable *vtable;
|
||||
gpointer vtable_user_data;
|
||||
} NMPolkitListenerPrivate;
|
||||
|
||||
G_DEFINE_TYPE (NMPolkitListener, nm_polkit_listener, POLKIT_AGENT_TYPE_LISTENER)
|
||||
|
||||
#define NM_POLKIT_LISTENER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_POLKIT_LISTENER, NMPolkitListenerPrivate))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
nm_polkit_listener_set_vtable (NMPolkitListener *self,
|
||||
const NMPolkitListenVtable *vtable,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (self);
|
||||
|
||||
priv->vtable = vtable;
|
||||
priv->vtable_user_data = user_data;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
on_request (PolkitAgentSession *session,
|
||||
const char *request,
|
||||
gboolean echo_on,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMPolkitListener *self = NM_POLKIT_LISTENER (user_data);
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (self);
|
||||
gs_free char *response = NULL;
|
||||
|
||||
if (priv->vtable && priv->vtable->on_request) {
|
||||
response = priv->vtable->on_request (self,
|
||||
request, priv->action_id,
|
||||
priv->message, priv->icon_name,
|
||||
priv->identity, echo_on,
|
||||
priv->vtable_user_data);
|
||||
}
|
||||
|
||||
if (response)
|
||||
polkit_agent_session_response (session, response);
|
||||
else {
|
||||
//FIXME: polkit_agent_session_cancel() should emit "completed", but it doesn't work for me ???
|
||||
//polkit_agent_session_cancel (session);
|
||||
polkit_agent_session_response (session, "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_show_info (PolkitAgentSession *session,
|
||||
const char *text,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMPolkitListener *self = NM_POLKIT_LISTENER (user_data);
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (self);
|
||||
|
||||
if (priv->vtable && priv->vtable->on_show_info) {
|
||||
priv->vtable->on_show_info (self, text,
|
||||
priv->vtable_user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_show_error (PolkitAgentSession *session,
|
||||
const char *text,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMPolkitListener *self = NM_POLKIT_LISTENER (user_data);
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (self);
|
||||
|
||||
if (priv->vtable && priv->vtable->on_show_error) {
|
||||
priv->vtable->on_show_error (self, text,
|
||||
priv->vtable_user_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_completed (PolkitAgentSession *session,
|
||||
gboolean gained_authorization,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMPolkitListener *self = NM_POLKIT_LISTENER (user_data);
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (self);
|
||||
|
||||
if (priv->vtable->on_completed) {
|
||||
priv->vtable->on_completed (self, gained_authorization,
|
||||
priv->vtable_user_data);
|
||||
}
|
||||
|
||||
g_simple_async_result_complete_in_idle (priv->simple);
|
||||
|
||||
g_object_unref (priv->simple);
|
||||
g_object_unref (priv->active_session);
|
||||
if (priv->cancellable) {
|
||||
g_cancellable_disconnect (priv->cancellable, priv->cancel_id);
|
||||
g_object_unref (priv->cancellable);
|
||||
}
|
||||
|
||||
priv->simple = NULL;
|
||||
priv->active_session = NULL;
|
||||
priv->cancel_id = 0;
|
||||
|
||||
g_clear_pointer (&priv->action_id, g_free);
|
||||
g_clear_pointer (&priv->message, g_free);
|
||||
g_clear_pointer (&priv->icon_name, g_free);
|
||||
g_clear_pointer (&priv->identity, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
on_cancelled (GCancellable *cancellable, gpointer user_data)
|
||||
{
|
||||
NMPolkitListener *self = NM_POLKIT_LISTENER (user_data);
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (self);
|
||||
|
||||
polkit_agent_session_cancel (priv->active_session);
|
||||
}
|
||||
|
||||
static int
|
||||
compare_users (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
char *user;
|
||||
int ret;
|
||||
|
||||
if (POLKIT_IS_UNIX_USER (a))
|
||||
user = g_strdup (polkit_unix_user_get_name (POLKIT_UNIX_USER (a)));
|
||||
else
|
||||
user = polkit_identity_to_string (POLKIT_IDENTITY (a));
|
||||
|
||||
ret = g_strcmp0 ((const char *) user, (const char *) b);
|
||||
g_free (user);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PolkitIdentity *
|
||||
choose_identity (GList *identities)
|
||||
{
|
||||
const char *user;
|
||||
GList *elem;
|
||||
|
||||
/* Choose identity. First try current user, then root, and else
|
||||
* take the first one */
|
||||
user = getenv("USER");
|
||||
elem = g_list_find_custom (identities, user, (GCompareFunc) compare_users);
|
||||
if (!elem) {
|
||||
elem = g_list_find_custom (identities, "root", (GCompareFunc) compare_users);
|
||||
if (!elem)
|
||||
elem = identities;
|
||||
}
|
||||
|
||||
return elem->data;
|
||||
}
|
||||
|
||||
static void
|
||||
initiate_authentication (PolkitAgentListener *listener,
|
||||
const char *action_id,
|
||||
const char *message,
|
||||
const char *icon_name,
|
||||
PolkitDetails *details,
|
||||
const char *cookie,
|
||||
GList *identities,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (listener);
|
||||
GSimpleAsyncResult *simple;
|
||||
PolkitIdentity *identity;
|
||||
|
||||
simple = g_simple_async_result_new (G_OBJECT (listener),
|
||||
callback,
|
||||
user_data,
|
||||
initiate_authentication);
|
||||
if (cancellable)
|
||||
g_simple_async_result_set_check_cancellable (simple, cancellable);
|
||||
if (priv->active_session != NULL) {
|
||||
g_simple_async_result_set_error (simple,
|
||||
POLKIT_ERROR,
|
||||
POLKIT_ERROR_FAILED,
|
||||
_("An authentication session is already underway."));
|
||||
g_simple_async_result_complete_in_idle (simple);
|
||||
g_object_unref (simple);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose identity */
|
||||
identity = choose_identity (identities);
|
||||
|
||||
priv->active_session = polkit_agent_session_new (identity, cookie);
|
||||
g_signal_connect (priv->active_session,
|
||||
"completed",
|
||||
G_CALLBACK (on_completed),
|
||||
listener);
|
||||
g_signal_connect (priv->active_session,
|
||||
"request",
|
||||
G_CALLBACK (on_request),
|
||||
listener);
|
||||
g_signal_connect (priv->active_session,
|
||||
"show-info",
|
||||
G_CALLBACK (on_show_info),
|
||||
listener);
|
||||
g_signal_connect (priv->active_session,
|
||||
"show-error",
|
||||
G_CALLBACK (on_show_error),
|
||||
listener);
|
||||
|
||||
priv->action_id = g_strdup (action_id);
|
||||
priv->message = g_strdup (message);
|
||||
priv->icon_name = g_strdup (icon_name);
|
||||
if (POLKIT_IS_UNIX_USER (identity))
|
||||
priv->identity = g_strdup (polkit_unix_user_get_name (POLKIT_UNIX_USER (identity)));
|
||||
else
|
||||
priv->identity = polkit_identity_to_string (identity);
|
||||
|
||||
priv->simple = simple;
|
||||
priv->cancellable = g_object_ref (cancellable);
|
||||
priv->cancel_id = g_cancellable_connect (cancellable,
|
||||
G_CALLBACK (on_cancelled),
|
||||
listener,
|
||||
NULL);
|
||||
|
||||
polkit_agent_session_initiate (priv->active_session);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
initiate_authentication_finish (PolkitAgentListener *listener,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
nm_polkit_listener_init (NMPolkitListener *agent)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_polkit_listener_new:
|
||||
* @for_session: %TRUE for registering the polkit agent for the user session,
|
||||
* %FALSE for registering it for the running process
|
||||
* @vtable: mandatory callbacks
|
||||
* @user_data: user-data pointer for callbacks
|
||||
* @error: location to store error, or %NULL
|
||||
*
|
||||
* Creates a new #NMPolkitListener and registers it as a polkit agent.
|
||||
*
|
||||
* Returns: a new #NMPolkitListener
|
||||
*/
|
||||
NMPolkitListener *
|
||||
nm_polkit_listener_new (gboolean for_session,
|
||||
GError **error)
|
||||
{
|
||||
NMPolkitListener *listener;
|
||||
PolkitSubject* session;
|
||||
NMPolkitListenerPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (!error || !*error, NULL);
|
||||
|
||||
listener = g_object_new (NM_TYPE_POLKIT_LISTENER, NULL);
|
||||
|
||||
priv = NM_POLKIT_LISTENER_GET_PRIVATE (listener);
|
||||
|
||||
if (for_session) {
|
||||
session = polkit_unix_session_new_for_process_sync (getpid (), NULL, error);
|
||||
if (!session)
|
||||
return NULL;
|
||||
} else
|
||||
session = polkit_unix_process_new_for_owner (getpid (), 0, getuid ());
|
||||
|
||||
priv->reg_handle = polkit_agent_listener_register (POLKIT_AGENT_LISTENER (listener),
|
||||
POLKIT_AGENT_REGISTER_FLAGS_NONE,
|
||||
session, NULL, NULL, error);
|
||||
if (!priv->reg_handle) {
|
||||
g_object_unref (listener);
|
||||
g_object_unref (session);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return listener;
|
||||
}
|
||||
|
||||
static void
|
||||
nm_polkit_listener_finalize (GObject *object)
|
||||
{
|
||||
NMPolkitListenerPrivate *priv = NM_POLKIT_LISTENER_GET_PRIVATE (object);
|
||||
|
||||
if (priv->reg_handle)
|
||||
polkit_agent_listener_unregister (priv->reg_handle);
|
||||
|
||||
g_free (priv->action_id);
|
||||
g_free (priv->message);
|
||||
g_free (priv->icon_name);
|
||||
g_free (priv->identity);
|
||||
|
||||
G_OBJECT_CLASS (nm_polkit_listener_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_polkit_listener_class_init (NMPolkitListenerClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
PolkitAgentListenerClass *pkal_class = POLKIT_AGENT_LISTENER_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (NMPolkitListenerPrivate));
|
||||
|
||||
gobject_class->finalize = nm_polkit_listener_finalize;
|
||||
|
||||
pkal_class->initiate_authentication = initiate_authentication;
|
||||
pkal_class->initiate_authentication_finish = initiate_authentication_finish;
|
||||
}
|
||||
|
||||
#endif /* WITH_POLKIT_AGENT */
|
||||
138
clients/common/nm-polkit-listener.h
Normal file
138
clients/common/nm-polkit-listener.h
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_POLKIT_LISTENER_H__
|
||||
#define __NM_POLKIT_LISTENER_H__
|
||||
|
||||
#if WITH_POLKIT_AGENT
|
||||
|
||||
typedef struct _NMPolkitListener NMPolkitListener;
|
||||
typedef struct _NMPolkitListenerClass NMPolkitListenerClass;
|
||||
|
||||
typedef struct {
|
||||
|
||||
/*
|
||||
* @request: the request asked by polkit agent
|
||||
* @action_id: the action_id of the polkit request
|
||||
* @message: the message of the polkit request
|
||||
* @icon_name: the icon name of the polkit request
|
||||
* @user: user name
|
||||
* @echo_on: whether the response to the request should be echoed to the screen
|
||||
* @user_data: user data for the callback
|
||||
*
|
||||
* Called as a result of a request by polkit. The function should obtain response
|
||||
* to the request from user, i.e. get the password required.
|
||||
*/
|
||||
char *(*on_request) (NMPolkitListener *self,
|
||||
const char *request,
|
||||
const char *action_id,
|
||||
const char *message,
|
||||
const char *icon_name,
|
||||
const char *user,
|
||||
gboolean echo_on,
|
||||
gpointer user_data);
|
||||
|
||||
/*
|
||||
* @text: the info text from polkit
|
||||
*
|
||||
* Called as a result of show-info signal by polkit.
|
||||
*/
|
||||
void (*on_show_info) (NMPolkitListener *self,
|
||||
const char *text,
|
||||
gpointer user_data);
|
||||
|
||||
/*
|
||||
* @text: the error text from polkit
|
||||
*
|
||||
* Called as a result of show-error signal by polkit.
|
||||
*/
|
||||
void (*on_show_error) (NMPolkitListener *self,
|
||||
const char *text,
|
||||
gpointer user_data);
|
||||
|
||||
/*
|
||||
* @gained_authorization: whether the authorization was successful
|
||||
*
|
||||
* Called as a result of completed signal by polkit.
|
||||
*/
|
||||
void (*on_completed) (NMPolkitListener *self,
|
||||
gboolean gained_authorization,
|
||||
gpointer user_data);
|
||||
} NMPolkitListenVtable;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
|
||||
#include <polkitagent/polkitagent.h>
|
||||
|
||||
#define NM_TYPE_POLKIT_LISTENER (nm_polkit_listener_get_type ())
|
||||
#define NM_POLKIT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_POLKIT_LISTENER, NMPolkitListener))
|
||||
#define NM_POLKIT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_POLKIT_LISTENER, NMPolkitListenerClass))
|
||||
#define NM_IS_POLKIT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_POLKIT_LISTENER))
|
||||
#define NM_IS_POLKIT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_POLKIT_LISTENER))
|
||||
#define NM_POLKIT_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_POLKIT_LISTENER, NMPolkitListenerClass))
|
||||
|
||||
/**
|
||||
* NMPolkitListenerOnRequestFunc:
|
||||
* @request: the request asked by polkit agent
|
||||
* @action_id: the action_id of the polkit request
|
||||
* @message: the message of the polkit request
|
||||
* @icon_name: the icon name of the polkit request
|
||||
* @user: user name
|
||||
* @echo_on: whether the response to the request should be echoed to the screen
|
||||
* @user_data: user data for the callback
|
||||
*
|
||||
* Called as a result of a request by polkit. The function should obtain response
|
||||
* to the request from user, i.e. get the password required.
|
||||
*/
|
||||
typedef char * (*NMPolkitListenerOnRequestFunc) (const char *request,
|
||||
const char *action_id,
|
||||
const char *message,
|
||||
const char *icon_name,
|
||||
const char *user,
|
||||
gboolean echo_on,
|
||||
gpointer user_data);
|
||||
/**
|
||||
* NMPolkitListenerOnShowInfoFunc:
|
||||
* @text: the info text from polkit
|
||||
*
|
||||
* Called as a result of show-info signal by polkit.
|
||||
*/
|
||||
typedef void (*NMPolkitListenerOnShowInfoFunc) (const char *text);
|
||||
/**
|
||||
* NMPolkitListenerOnShowErrorFunc:
|
||||
* @text: the error text from polkit
|
||||
*
|
||||
* Called as a result of show-error signal by polkit.
|
||||
*/
|
||||
typedef void (*NMPolkitListenerOnShowErrorFunc) (const char *text);
|
||||
/**
|
||||
* NMPolkitListenerCompletedFunc:
|
||||
* @gained_authorization: whether the authorization was successful
|
||||
*
|
||||
* Called as a result of completed signal by polkit.
|
||||
*/
|
||||
typedef void (*NMPolkitListenerOnCompletedFunc) (gboolean gained_authorization);
|
||||
|
||||
struct _NMPolkitListener {
|
||||
PolkitAgentListener parent;
|
||||
};
|
||||
|
||||
struct _NMPolkitListenerClass {
|
||||
PolkitAgentListenerClass parent;
|
||||
};
|
||||
|
||||
GType nm_polkit_listener_get_type (void);
|
||||
|
||||
NMPolkitListener *nm_polkit_listener_new (gboolean for_session,
|
||||
GError **error);
|
||||
|
||||
void nm_polkit_listener_set_vtable (NMPolkitListener *self,
|
||||
const NMPolkitListenVtable *vtable,
|
||||
gpointer user_data);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __NM_POLKIT_LISTENER_H__ */
|
||||
1362
clients/common/nm-secret-agent-simple.c
Normal file
1362
clients/common/nm-secret-agent-simple.c
Normal file
File diff suppressed because it is too large
Load diff
57
clients/common/nm-secret-agent-simple.h
Normal file
57
clients/common/nm-secret-agent-simple.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2013 - 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_SECRET_AGENT_SIMPLE_H__
|
||||
#define __NM_SECRET_AGENT_SIMPLE_H__
|
||||
|
||||
#include "nm-secret-agent-old.h"
|
||||
|
||||
typedef enum {
|
||||
NM_SECRET_AGENT_SECRET_TYPE_PROPERTY,
|
||||
NM_SECRET_AGENT_SECRET_TYPE_SECRET,
|
||||
NM_SECRET_AGENT_SECRET_TYPE_VPN_SECRET,
|
||||
NM_SECRET_AGENT_SECRET_TYPE_WIREGUARD_PEER_PSK,
|
||||
} NMSecretAgentSecretType;
|
||||
|
||||
typedef struct {
|
||||
NMSecretAgentSecretType secret_type;
|
||||
const char *pretty_name;
|
||||
const char *entry_id;
|
||||
char *value;
|
||||
const char *vpn_type;
|
||||
bool is_secret:1;
|
||||
bool no_prompt_entry_id:1;
|
||||
} NMSecretAgentSimpleSecret;
|
||||
|
||||
#define NM_SECRET_AGENT_ENTRY_ID_PREFX_VPN_SECRETS "vpn.secrets."
|
||||
|
||||
#define NM_SECRET_AGENT_VPN_TYPE_OPENCONNECT NM_DBUS_INTERFACE".openconnect"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_TYPE_SECRET_AGENT_SIMPLE (nm_secret_agent_simple_get_type ())
|
||||
#define NM_SECRET_AGENT_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimple))
|
||||
#define NM_SECRET_AGENT_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimpleClass))
|
||||
#define NM_IS_SECRET_AGENT_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SECRET_AGENT_SIMPLE))
|
||||
#define NM_IS_SECRET_AGENT_SIMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SECRET_AGENT_SIMPLE))
|
||||
#define NM_SECRET_AGENT_SIMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT_SIMPLE, NMSecretAgentSimpleClass))
|
||||
|
||||
#define NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS "request-secrets"
|
||||
|
||||
typedef struct _NMSecretAgentSimple NMSecretAgentSimple;
|
||||
typedef struct _NMSecretAgentSimpleClass NMSecretAgentSimpleClass;
|
||||
|
||||
GType nm_secret_agent_simple_get_type (void);
|
||||
|
||||
NMSecretAgentSimple *nm_secret_agent_simple_new (const char *name);
|
||||
|
||||
void nm_secret_agent_simple_response (NMSecretAgentSimple *self,
|
||||
const char *request_id,
|
||||
GPtrArray *secrets);
|
||||
|
||||
void nm_secret_agent_simple_enable (NMSecretAgentSimple *self,
|
||||
const char *path);
|
||||
|
||||
#endif /* __NM_SECRET_AGENT_SIMPLE_H__ */
|
||||
795
clients/common/nm-vpn-helpers.c
Normal file
795
clients/common/nm-vpn-helpers.c
Normal file
|
|
@ -0,0 +1,795 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2013 - 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:nm-vpn-helpers
|
||||
* @short_description: VPN-related utilities
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-vpn-helpers.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include "nm-client-utils.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-glib-aux/nm-io-utils.h"
|
||||
#include "nm-glib-aux/nm-secret-utils.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMVpnEditorPlugin *
|
||||
nm_vpn_get_editor_plugin (const char *service_type, GError **error)
|
||||
{
|
||||
NMVpnEditorPlugin *plugin = NULL;
|
||||
NMVpnPluginInfo *plugin_info;
|
||||
gs_free_error GError *local = NULL;
|
||||
|
||||
g_return_val_if_fail (service_type, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
plugin_info = nm_vpn_plugin_info_list_find_by_service (nm_vpn_get_plugin_infos (), service_type);
|
||||
|
||||
if (!plugin_info) {
|
||||
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
|
||||
_("unknown VPN plugin \"%s\""), service_type);
|
||||
return NULL;
|
||||
}
|
||||
plugin = nm_vpn_plugin_info_get_editor_plugin (plugin_info);
|
||||
if (!plugin)
|
||||
plugin = nm_vpn_plugin_info_load_editor_plugin (plugin_info, &local);
|
||||
|
||||
if (!plugin) {
|
||||
if ( !nm_vpn_plugin_info_get_plugin (plugin_info)
|
||||
&& nm_vpn_plugin_info_lookup_property (plugin_info, NM_VPN_PLUGIN_INFO_KF_GROUP_GNOME, "properties")) {
|
||||
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
|
||||
_("cannot load legacy-only VPN plugin \"%s\" for \"%s\""),
|
||||
nm_vpn_plugin_info_get_name (plugin_info),
|
||||
nm_vpn_plugin_info_get_filename (plugin_info));
|
||||
} else if (g_error_matches (local, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
|
||||
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
|
||||
_("cannot load VPN plugin \"%s\" due to missing \"%s\". Missing client plugin?"),
|
||||
nm_vpn_plugin_info_get_name (plugin_info),
|
||||
nm_vpn_plugin_info_get_plugin (plugin_info));
|
||||
} else {
|
||||
g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
|
||||
_("failed to load VPN plugin \"%s\": %s"),
|
||||
nm_vpn_plugin_info_get_name (plugin_info),
|
||||
local->message);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return plugin;
|
||||
}
|
||||
|
||||
GSList *
|
||||
nm_vpn_get_plugin_infos (void)
|
||||
{
|
||||
static bool plugins_loaded;
|
||||
static GSList *plugins = NULL;
|
||||
|
||||
if (G_LIKELY (plugins_loaded))
|
||||
return plugins;
|
||||
plugins_loaded = TRUE;
|
||||
plugins = nm_vpn_plugin_info_list_load ();
|
||||
return plugins;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_vpn_supports_ipv6 (NMConnection *connection)
|
||||
{
|
||||
NMSettingVpn *s_vpn;
|
||||
const char *service_type;
|
||||
NMVpnEditorPlugin *plugin;
|
||||
guint32 capabilities;
|
||||
|
||||
s_vpn = nm_connection_get_setting_vpn (connection);
|
||||
g_return_val_if_fail (s_vpn != NULL, FALSE);
|
||||
|
||||
service_type = nm_setting_vpn_get_service_type (s_vpn);
|
||||
if (!service_type)
|
||||
return FALSE;
|
||||
|
||||
plugin = nm_vpn_get_editor_plugin (service_type, NULL);
|
||||
if (!plugin)
|
||||
return FALSE;
|
||||
|
||||
capabilities = nm_vpn_editor_plugin_get_capabilities (plugin);
|
||||
return NM_FLAGS_HAS (capabilities, NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6);
|
||||
}
|
||||
|
||||
const VpnPasswordName *
|
||||
nm_vpn_get_secret_names (const char *service_type)
|
||||
{
|
||||
static const VpnPasswordName generic_vpn_secrets[] = {
|
||||
{ "password", N_("Password") },
|
||||
{ 0 }
|
||||
};
|
||||
static const VpnPasswordName openvpn_secrets[] = {
|
||||
{ "password", N_("Password") },
|
||||
{ "cert-pass", N_("Certificate password") },
|
||||
{ "http-proxy-password", N_("HTTP proxy password") },
|
||||
{ 0 }
|
||||
};
|
||||
static const VpnPasswordName vpnc_secrets[] = {
|
||||
{ "Xauth password", N_("Password") },
|
||||
{ "IPSec secret", N_("Group password") },
|
||||
{ 0 }
|
||||
};
|
||||
static const VpnPasswordName swan_secrets[] = {
|
||||
{ "xauthpassword", N_("Password") },
|
||||
{ "pskvalue", N_("Group password") },
|
||||
{ 0 }
|
||||
};
|
||||
static const VpnPasswordName openconnect_secrets[] = {
|
||||
{ "gateway", N_("Gateway") },
|
||||
{ "cookie", N_("Cookie") },
|
||||
{ "gwcert", N_("Gateway certificate hash") },
|
||||
{ 0 }
|
||||
};
|
||||
const char *type;
|
||||
|
||||
if (!service_type)
|
||||
return NULL;
|
||||
|
||||
if ( !g_str_has_prefix (service_type, NM_DBUS_INTERFACE)
|
||||
|| service_type[NM_STRLEN (NM_DBUS_INTERFACE)] != '.') {
|
||||
/* all our well-known, hard-coded vpn-types start with NM_DBUS_INTERFACE. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
type = service_type + (NM_STRLEN (NM_DBUS_INTERFACE) + 1);
|
||||
if ( !g_strcmp0 (type, "pptp")
|
||||
|| !g_strcmp0 (type, "iodine")
|
||||
|| !g_strcmp0 (type, "ssh")
|
||||
|| !g_strcmp0 (type, "l2tp")
|
||||
|| !g_strcmp0 (type, "fortisslvpn"))
|
||||
return generic_vpn_secrets;
|
||||
else if (!g_strcmp0 (type, "openvpn"))
|
||||
return openvpn_secrets;
|
||||
else if (!g_strcmp0 (type, "vpnc"))
|
||||
return vpnc_secrets;
|
||||
else if ( !g_strcmp0 (type, "openswan")
|
||||
|| !g_strcmp0 (type, "libreswan")
|
||||
|| !g_strcmp0 (type, "strongswan"))
|
||||
return swan_secrets;
|
||||
else if (!g_strcmp0 (type, "openconnect"))
|
||||
return openconnect_secrets;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_extract_variable_value (char *line, const char *tag, char **value)
|
||||
{
|
||||
char *p1, *p2;
|
||||
|
||||
if (!g_str_has_prefix (line, tag))
|
||||
return FALSE;
|
||||
|
||||
p1 = line + strlen (tag);
|
||||
p2 = line + strlen (line) - 1;
|
||||
if ((*p1 == '\'' || *p1 == '"') && (*p1 == *p2)) {
|
||||
p1++;
|
||||
*p2 = '\0';
|
||||
}
|
||||
NM_SET_OUT (value, g_strdup (p1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_vpn_openconnect_authenticate_helper (const char *host,
|
||||
char **cookie,
|
||||
char **gateway,
|
||||
char **gwcert,
|
||||
int *status,
|
||||
GError **error)
|
||||
{
|
||||
gs_free char *output = NULL;
|
||||
gs_free const char **output_v = NULL;
|
||||
const char *const*iter;
|
||||
const char *path;
|
||||
const char *const DEFAULT_PATHS[] = {
|
||||
"/sbin/",
|
||||
"/usr/sbin/",
|
||||
"/usr/local/sbin/",
|
||||
"/bin/",
|
||||
"/usr/bin/",
|
||||
"/usr/local/bin/",
|
||||
NULL,
|
||||
};
|
||||
|
||||
path = nm_utils_file_search_in_paths ("openconnect", "/usr/sbin/openconnect", DEFAULT_PATHS,
|
||||
G_FILE_TEST_IS_EXECUTABLE, NULL, NULL, error);
|
||||
if (!path)
|
||||
return FALSE;
|
||||
|
||||
if (!g_spawn_sync (NULL,
|
||||
(char **) NM_MAKE_STRV (path, "--authenticate", host),
|
||||
NULL,
|
||||
G_SPAWN_SEARCH_PATH
|
||||
| G_SPAWN_CHILD_INHERITS_STDIN,
|
||||
NULL,
|
||||
NULL,
|
||||
&output,
|
||||
NULL,
|
||||
status,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
/* Parse output and set cookie, gateway and gwcert
|
||||
* output example:
|
||||
* COOKIE='loremipsum'
|
||||
* HOST='1.2.3.4'
|
||||
* FINGERPRINT='sha1:32bac90cf09a722e10ecc1942c67fe2ac8c21e2e'
|
||||
*/
|
||||
output_v = nm_utils_strsplit_set_with_empty (output, "\r\n");
|
||||
for (iter = output_v; iter && *iter; iter++) {
|
||||
char *s_mutable = (char *) *iter;
|
||||
|
||||
_extract_variable_value (s_mutable, "COOKIE=", cookie);
|
||||
_extract_variable_value (s_mutable, "HOST=", gateway);
|
||||
_extract_variable_value (s_mutable, "FINGERPRINT=", gwcert);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_wg_complete_peer (GPtrArray **p_peers,
|
||||
NMWireGuardPeer *peer_take,
|
||||
gsize peer_start_line_nr,
|
||||
const char *filename,
|
||||
GError **error)
|
||||
{
|
||||
nm_auto_unref_wgpeer NMWireGuardPeer *peer = peer_take;
|
||||
gs_free_error GError *local = NULL;
|
||||
|
||||
if (!peer)
|
||||
return TRUE;
|
||||
|
||||
if (!nm_wireguard_peer_is_valid (peer, TRUE, TRUE, &local)) {
|
||||
nm_utils_error_set (error, NM_UTILS_ERROR_UNKNOWN,
|
||||
_("Invalid peer starting at %s:%zu: %s"),
|
||||
filename,
|
||||
peer_start_line_nr,
|
||||
local->message);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!*p_peers)
|
||||
*p_peers = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_wireguard_peer_unref);
|
||||
g_ptr_array_add (*p_peers, g_steal_pointer (&peer));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_line_match (char *line, const char *key, gsize key_len, const char **out_key, char **out_value)
|
||||
{
|
||||
nm_assert (line);
|
||||
nm_assert (key);
|
||||
nm_assert (strlen (key) == key_len);
|
||||
nm_assert (!strchr (key, '='));
|
||||
nm_assert (out_key && !*out_key);
|
||||
nm_assert (out_value && !*out_value);
|
||||
|
||||
/* Note that `wg-quick` (linux.bash) does case-insensitive comparison (shopt -s nocasematch).
|
||||
* `wg setconf` does case-insensitive comparison too (with strncasecmp, which is locale dependent).
|
||||
*
|
||||
* We do a case-insensitive comparison of the key, however in a locale-independent manner. */
|
||||
|
||||
if (g_ascii_strncasecmp (line, key, key_len) != 0)
|
||||
return FALSE;
|
||||
|
||||
if (line[key_len] != '=')
|
||||
return FALSE;
|
||||
|
||||
*out_key = key;
|
||||
*out_value = &line[key_len + 1];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define line_match(line, key, out_key, out_value) \
|
||||
_line_match ((line), ""key"", NM_STRLEN (key), (out_key), (out_value))
|
||||
|
||||
static gboolean
|
||||
value_split_word (char **line_remainder, char **out_word)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if ((*line_remainder)[0] == '\0')
|
||||
return FALSE;
|
||||
|
||||
*out_word = *line_remainder;
|
||||
|
||||
str = strchrnul (*line_remainder, ',');
|
||||
if (str[0] == ',') {
|
||||
str[0] = '\0';
|
||||
*line_remainder = &str[1];
|
||||
} else
|
||||
*line_remainder = str;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
NMConnection *
|
||||
nm_vpn_wireguard_import (const char *filename,
|
||||
GError **error)
|
||||
{
|
||||
nm_auto_clear_secret_ptr NMSecretPtr file_content = NM_SECRET_PTR_INIT ();
|
||||
char ifname[IFNAMSIZ];
|
||||
gs_free char *uuid = NULL;
|
||||
gboolean ifname_valid = FALSE;
|
||||
const char *cstr;
|
||||
char *line_remainder;
|
||||
gs_unref_object NMConnection *connection = NULL;
|
||||
NMSettingConnection *s_con;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
NMSettingWireGuard *s_wg;
|
||||
gs_free_error GError *local = NULL;
|
||||
enum {
|
||||
LINE_CONTEXT_INIT,
|
||||
LINE_CONTEXT_INTERFACE,
|
||||
LINE_CONTEXT_PEER,
|
||||
} line_context;
|
||||
gsize line_nr;
|
||||
gsize current_peer_start_line_nr = 0;
|
||||
nm_auto_unref_wgpeer NMWireGuardPeer *current_peer = NULL;
|
||||
gs_unref_ptrarray GPtrArray *data_dns_v4 = NULL;
|
||||
gs_unref_ptrarray GPtrArray *data_dns_v6 = NULL;
|
||||
gs_unref_ptrarray GPtrArray *data_addr_v4 = NULL;
|
||||
gs_unref_ptrarray GPtrArray *data_addr_v6 = NULL;
|
||||
gs_unref_ptrarray GPtrArray *data_peers = NULL;
|
||||
const char *data_private_key = NULL;
|
||||
gint64 data_table;
|
||||
guint data_listen_port = 0;
|
||||
guint data_fwmark = 0;
|
||||
guint data_mtu = 0;
|
||||
int is_v4;
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (filename, NULL);
|
||||
g_return_val_if_fail (!error || !*error, NULL);
|
||||
|
||||
/* contrary to "wg-quick", we never interpret the filename as "/etc/wireguard/$INTERFACE.conf".
|
||||
* If the filename has no '/', it is interpreted as relative to the current working directory.
|
||||
* However, we do require a suitable filename suffix and that the name corresponds to the interface
|
||||
* name. */
|
||||
cstr = strrchr (filename, '/');
|
||||
cstr = cstr ? &cstr[1] : filename;
|
||||
if (NM_STR_HAS_SUFFIX (cstr, ".conf")) {
|
||||
gsize len = strlen (cstr) - NM_STRLEN (".conf");
|
||||
|
||||
if (len > 0 && len < sizeof (ifname)) {
|
||||
memcpy (ifname, cstr, len);
|
||||
ifname[len] = '\0';
|
||||
|
||||
if (nm_utils_is_valid_iface_name (ifname, NULL))
|
||||
ifname_valid = TRUE;
|
||||
}
|
||||
}
|
||||
if (!ifname_valid) {
|
||||
nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN,
|
||||
_("The WireGuard config file must be a valid interface name followed by \".conf\""));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!nm_utils_file_get_contents (-1,
|
||||
filename,
|
||||
10*1024*1024,
|
||||
NM_UTILS_FILE_GET_CONTENTS_FLAG_SECRET,
|
||||
&file_content.str,
|
||||
&file_content.len,
|
||||
NULL,
|
||||
error))
|
||||
return NULL;
|
||||
|
||||
/* We interpret the file like `wg-quick up` and `wg setconf` do.
|
||||
*
|
||||
* Of course the WireGuard scripts do something fundamentlly different. They
|
||||
* perform actions to configure the WireGuard link in kernel, add routes and
|
||||
* addresses, and call resolvconf. It all happens at the time when the script
|
||||
* run.
|
||||
*
|
||||
* This code here instead generates a NetworkManager connection profile so that
|
||||
* NetworkManager will apply a similar configuration when later activating the profile. */
|
||||
|
||||
#define _TABLE_AUTO ((gint64) -1)
|
||||
#define _TABLE_OFF ((gint64) -2)
|
||||
|
||||
data_table = _TABLE_AUTO;
|
||||
|
||||
line_remainder = file_content.str;
|
||||
line_context = LINE_CONTEXT_INIT;
|
||||
line_nr = 0;
|
||||
while (line_remainder[0] != '\0') {
|
||||
const char *matched_key = NULL;
|
||||
char *value = NULL;
|
||||
char *line;
|
||||
char ch;
|
||||
gint64 i64;
|
||||
|
||||
line_nr++;
|
||||
|
||||
line = line_remainder;
|
||||
line_remainder = strchrnul (line, '\n');
|
||||
if (line_remainder[0] != '\0')
|
||||
(line_remainder++)[0] = '\0';
|
||||
|
||||
/* Drop all spaces and truncate at first '#'.
|
||||
* See wg's config_read_line().
|
||||
*
|
||||
* Note that wg-quick doesn't do that.
|
||||
*
|
||||
* Neither `wg setconf` nor `wg-quick` does a strict parsing.
|
||||
* We don't either. Just try to interpret the file (mostly) the same as
|
||||
* they would.
|
||||
*/
|
||||
{
|
||||
gsize l, n;
|
||||
|
||||
n = 0;
|
||||
for (l = 0; (ch = line[l]); l++) {
|
||||
if (g_ascii_isspace (ch)) {
|
||||
/* wg-setconf strips all whitespace before parsing the content. That means,
|
||||
* *[I nterface]" will be accepted. We do that too. */
|
||||
continue;
|
||||
}
|
||||
if (ch == '#')
|
||||
break;
|
||||
line[n++] = line[l];
|
||||
}
|
||||
if (n == 0)
|
||||
continue;
|
||||
line[n] = '\0';
|
||||
}
|
||||
|
||||
if (g_ascii_strcasecmp (line, "[Interface]") == 0) {
|
||||
if (!_wg_complete_peer (&data_peers,
|
||||
g_steal_pointer (¤t_peer),
|
||||
current_peer_start_line_nr,
|
||||
filename,
|
||||
error))
|
||||
return FALSE;
|
||||
line_context = LINE_CONTEXT_INTERFACE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (g_ascii_strcasecmp (line, "[Peer]") == 0) {
|
||||
if (!_wg_complete_peer (&data_peers,
|
||||
g_steal_pointer (¤t_peer),
|
||||
current_peer_start_line_nr,
|
||||
filename,
|
||||
error))
|
||||
return FALSE;
|
||||
current_peer_start_line_nr = line_nr;
|
||||
current_peer = nm_wireguard_peer_new ();
|
||||
line_context = LINE_CONTEXT_PEER;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_context == LINE_CONTEXT_INTERFACE) {
|
||||
|
||||
if (line_match (line, "Address", &matched_key, &value)) {
|
||||
char *value_word;
|
||||
|
||||
while (value_split_word (&value, &value_word)) {
|
||||
GPtrArray **p_data_addr;
|
||||
NMIPAddr addr_bin;
|
||||
int addr_family;
|
||||
int prefix_len;
|
||||
|
||||
if (!nm_utils_parse_inaddr_prefix_bin (AF_UNSPEC,
|
||||
value_word,
|
||||
&addr_family,
|
||||
&addr_bin,
|
||||
&prefix_len))
|
||||
goto fail_invalid_value;
|
||||
|
||||
p_data_addr = (addr_family == AF_INET)
|
||||
? &data_addr_v4
|
||||
: &data_addr_v6;
|
||||
|
||||
if (!*p_data_addr)
|
||||
*p_data_addr = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref);
|
||||
|
||||
g_ptr_array_add (*p_data_addr,
|
||||
nm_ip_address_new_binary (addr_family,
|
||||
&addr_bin,
|
||||
prefix_len == -1
|
||||
? ((addr_family == AF_INET) ? 32 : 128)
|
||||
: prefix_len,
|
||||
NULL));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "MTU", &matched_key, &value)) {
|
||||
i64 = _nm_utils_ascii_str_to_int64 (value, 0, 0, G_MAXUINT32, -1);
|
||||
if (i64 == -1)
|
||||
goto fail_invalid_value;
|
||||
|
||||
/* wg-quick accepts the "MTU" value, but it also fetches routes to
|
||||
* autodetect it. NetworkManager won't do that, we can only configure
|
||||
* an explicit MTU or no autodetection will be performed. */
|
||||
data_mtu = i64;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "DNS", &matched_key, &value)) {
|
||||
char *value_word;
|
||||
|
||||
while (value_split_word (&value, &value_word)) {
|
||||
char addr_s[NM_CONST_MAX (INET_ADDRSTRLEN, INET6_ADDRSTRLEN)];
|
||||
GPtrArray **p_data_dns;
|
||||
NMIPAddr addr_bin;
|
||||
int addr_family;
|
||||
|
||||
if (!nm_utils_parse_inaddr_bin (AF_UNSPEC,
|
||||
value_word,
|
||||
&addr_family,
|
||||
&addr_bin))
|
||||
goto fail_invalid_value;
|
||||
|
||||
p_data_dns = (addr_family == AF_INET)
|
||||
? &data_dns_v4
|
||||
: &data_dns_v6;
|
||||
if (!*p_data_dns)
|
||||
*p_data_dns = g_ptr_array_new_with_free_func (g_free);
|
||||
|
||||
inet_ntop (addr_family, &addr_bin, addr_s, sizeof (addr_s));
|
||||
g_ptr_array_add (*p_data_dns, g_strdup (addr_s));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "Table", &matched_key, &value)) {
|
||||
|
||||
if (nm_streq (value, "auto"))
|
||||
data_table = _TABLE_AUTO;
|
||||
else if (nm_streq (value, "off"))
|
||||
data_table = _TABLE_OFF;
|
||||
else {
|
||||
/* we don't support table names from /etc/iproute2/rt_tables
|
||||
* But we accept hex like `ip route add` would. */
|
||||
i64 = _nm_utils_ascii_str_to_int64 (value, 0, 0, G_MAXINT32, -1);
|
||||
if (i64 == -1)
|
||||
goto fail_invalid_value;
|
||||
data_table = i64;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( line_match (line, "PreUp", &matched_key, &value)
|
||||
|| line_match (line, "PreDown", &matched_key, &value)
|
||||
|| line_match (line, "PostUp", &matched_key, &value)
|
||||
|| line_match (line, "PostDown", &matched_key, &value)) {
|
||||
/* we don't run any scripts. Silently ignore these parameters. */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "SaveConfig", &matched_key, &value)) {
|
||||
/* we ignore the setting, but enforce that it's either true or false (like
|
||||
* wg-quick. */
|
||||
if (!NM_IN_STRSET (value, "true", "false"))
|
||||
goto fail_invalid_value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "ListenPort", &matched_key, &value)) {
|
||||
/* we don't use getaddrinfo(), unlike `wg setconf`. Just interpret
|
||||
* the port as plain decimal number. */
|
||||
i64 = _nm_utils_ascii_str_to_int64 (value, 10, 0, 0xFFFF, -1);
|
||||
if (i64 == -1)
|
||||
goto fail_invalid_value;
|
||||
data_listen_port = i64;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "FwMark", &matched_key, &value)) {
|
||||
if (nm_streq (value, "off"))
|
||||
data_fwmark = 0;
|
||||
else {
|
||||
i64 = _nm_utils_ascii_str_to_int64 (value, 0, 0, G_MAXINT32, -1);
|
||||
if (i64 == -1)
|
||||
goto fail_invalid_value;
|
||||
data_fwmark = i64;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "PrivateKey", &matched_key, &value)) {
|
||||
if (!nm_utils_base64secret_decode (value, NM_WIREGUARD_PUBLIC_KEY_LEN, NULL))
|
||||
goto fail_invalid_secret;
|
||||
data_private_key = value;
|
||||
continue;
|
||||
}
|
||||
|
||||
goto fail_invalid_line;
|
||||
}
|
||||
|
||||
|
||||
if (line_context == LINE_CONTEXT_PEER) {
|
||||
|
||||
if (line_match (line, "Endpoint", &matched_key, &value)) {
|
||||
if (!nm_wireguard_peer_set_endpoint (current_peer, value, FALSE))
|
||||
goto fail_invalid_value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "PublicKey", &matched_key, &value)) {
|
||||
if (!nm_wireguard_peer_set_public_key (current_peer, value, FALSE))
|
||||
goto fail_invalid_value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "AllowedIPs", &matched_key, &value)) {
|
||||
char *value_word;
|
||||
|
||||
while (value_split_word (&value, &value_word)) {
|
||||
if (!nm_wireguard_peer_append_allowed_ip (current_peer,
|
||||
value_word,
|
||||
FALSE))
|
||||
goto fail_invalid_value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "PersistentKeepalive", &matched_key, &value)) {
|
||||
if (nm_streq (value, "off"))
|
||||
i64 = 0;
|
||||
else {
|
||||
i64 = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT16, -1);
|
||||
if (i64 == -1)
|
||||
goto fail_invalid_value;
|
||||
}
|
||||
nm_wireguard_peer_set_persistent_keepalive (current_peer, i64);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line_match (line, "PresharedKey", &matched_key, &value)) {
|
||||
if (!nm_wireguard_peer_set_preshared_key (current_peer, value, FALSE))
|
||||
goto fail_invalid_secret;
|
||||
nm_wireguard_peer_set_preshared_key_flags (current_peer, NM_SETTING_SECRET_FLAG_NONE);
|
||||
continue;
|
||||
}
|
||||
|
||||
goto fail_invalid_line;
|
||||
}
|
||||
|
||||
fail_invalid_line:
|
||||
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
|
||||
_("unrecognized line at %s:%zu"),
|
||||
filename, line_nr);
|
||||
return FALSE;
|
||||
fail_invalid_value:
|
||||
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
|
||||
_("invalid value for '%s' at %s:%zu"),
|
||||
matched_key, filename, line_nr);
|
||||
return FALSE;
|
||||
fail_invalid_secret:
|
||||
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
|
||||
_("invalid secret '%s' at %s:%zu"),
|
||||
matched_key, filename, line_nr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!_wg_complete_peer (&data_peers,
|
||||
g_steal_pointer (¤t_peer),
|
||||
current_peer_start_line_nr,
|
||||
filename,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
connection = nm_simple_connection_new ();
|
||||
s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_con));
|
||||
s_ip4 = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
|
||||
s_ip6 = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
|
||||
s_wg = NM_SETTING_WIREGUARD (nm_setting_wireguard_new ());
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_wg));
|
||||
|
||||
uuid = nm_utils_uuid_generate ();
|
||||
|
||||
g_object_set (s_con,
|
||||
NM_SETTING_CONNECTION_ID,
|
||||
ifname,
|
||||
NM_SETTING_CONNECTION_UUID,
|
||||
uuid,
|
||||
NM_SETTING_CONNECTION_TYPE,
|
||||
NM_SETTING_WIREGUARD_SETTING_NAME,
|
||||
NM_SETTING_CONNECTION_INTERFACE_NAME,
|
||||
ifname,
|
||||
NULL);
|
||||
|
||||
g_object_set (s_wg,
|
||||
NM_SETTING_WIREGUARD_PRIVATE_KEY,
|
||||
data_private_key,
|
||||
NM_SETTING_WIREGUARD_LISTEN_PORT,
|
||||
data_listen_port,
|
||||
NM_SETTING_WIREGUARD_FWMARK,
|
||||
data_fwmark,
|
||||
NM_SETTING_WIREGUARD_MTU,
|
||||
data_mtu,
|
||||
NULL);
|
||||
|
||||
if (data_peers) {
|
||||
for (i = 0; i < data_peers->len; i++)
|
||||
nm_setting_wireguard_append_peer (s_wg, data_peers->pdata[i]);
|
||||
}
|
||||
|
||||
for (is_v4 = 0; is_v4 < 2; is_v4++) {
|
||||
const char *method_disabled = is_v4 ? NM_SETTING_IP4_CONFIG_METHOD_DISABLED : NM_SETTING_IP6_CONFIG_METHOD_DISABLED;
|
||||
const char *method_manual = is_v4 ? NM_SETTING_IP4_CONFIG_METHOD_MANUAL : NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
|
||||
NMSettingIPConfig *s_ip = is_v4 ? s_ip4 : s_ip6;
|
||||
GPtrArray *data_dns = is_v4 ? data_dns_v4 : data_dns_v6;
|
||||
GPtrArray *data_addr = is_v4 ? data_addr_v4 : data_addr_v6;
|
||||
|
||||
if (data_dns && !data_addr) {
|
||||
/* When specifying "DNS", we also require an "Address" for the same address
|
||||
* family. That is because a NMSettingIPConfig cannot have @method_disabled
|
||||
* and DNS settings at the same time.
|
||||
*
|
||||
* We don't have addresses. Silently ignore the DNS setting. */
|
||||
data_dns = NULL;
|
||||
}
|
||||
|
||||
g_object_set (s_ip,
|
||||
NM_SETTING_IP_CONFIG_METHOD,
|
||||
data_addr ? method_manual : method_disabled,
|
||||
NULL);
|
||||
|
||||
if (data_addr) {
|
||||
for (i = 0; i < data_addr->len; i++)
|
||||
nm_setting_ip_config_add_address (s_ip, data_addr->pdata[i]);
|
||||
}
|
||||
if (data_dns) {
|
||||
for (i = 0; i < data_dns->len; i++)
|
||||
nm_setting_ip_config_add_dns (s_ip, data_dns->pdata[i]);
|
||||
}
|
||||
|
||||
if (data_table == _TABLE_AUTO) {
|
||||
/* in the "auto" setting, wg-quick adds peer-routes automatically to the main
|
||||
* table. NetworkManager will do that too, but there are differences:
|
||||
*
|
||||
* - NetworkManager (contrary to wg-quick) does not check whether the peer-route is necessary.
|
||||
* It will always add a route for each allowed-ips range, even if there is already another
|
||||
* route that would ensure packets to the endpoint are routed via the WireGuard interface.
|
||||
* If you don't want that, disable "wireguard.peer-routes", and add the necessary routes
|
||||
* yourself to "ipv4.routes" and "ipv6.routes".
|
||||
*
|
||||
* - With "auto", wg-quick also configures policy routing to handle default-routes (/0) to
|
||||
* avoid routing loops. That is not yet solved by NetworkManager, you need to configure
|
||||
* that explicitly (for example, by adding a direct route to the gateway on the interface
|
||||
* that has the default-route, or by using a script (possibly dispatcher script).
|
||||
*/
|
||||
} else if (data_table == _TABLE_OFF) {
|
||||
if (is_v4) {
|
||||
g_object_set (s_wg,
|
||||
NM_SETTING_WIREGUARD_PEER_ROUTES,
|
||||
FALSE,
|
||||
NULL);
|
||||
}
|
||||
} else {
|
||||
g_object_set (s_ip,
|
||||
NM_SETTING_IP_CONFIG_ROUTE_TABLE,
|
||||
(guint) data_table,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!nm_connection_normalize (connection, NULL, NULL, &local)) {
|
||||
nm_utils_error_set (error, NM_UTILS_ERROR_INVALID_ARGUMENT,
|
||||
_("Failed to create WireGuard connection: %s"),
|
||||
local->message);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return g_steal_pointer (&connection);
|
||||
}
|
||||
32
clients/common/nm-vpn-helpers.h
Normal file
32
clients/common/nm-vpn-helpers.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2013 - 2015 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_VPN_HELPERS_H__
|
||||
#define __NM_VPN_HELPERS_H__
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *ui_name;
|
||||
} VpnPasswordName;
|
||||
|
||||
GSList *nm_vpn_get_plugin_infos (void);
|
||||
|
||||
NMVpnEditorPlugin *nm_vpn_get_editor_plugin (const char *service_type, GError **error);
|
||||
|
||||
gboolean nm_vpn_supports_ipv6 (NMConnection *connection);
|
||||
|
||||
const VpnPasswordName * nm_vpn_get_secret_names (const char *service_type);
|
||||
|
||||
gboolean nm_vpn_openconnect_authenticate_helper (const char *host,
|
||||
char **cookie,
|
||||
char **gateway,
|
||||
char **gwcert,
|
||||
int *status,
|
||||
GError **error);
|
||||
|
||||
NMConnection *nm_vpn_wireguard_import (const char *filename,
|
||||
GError **error);
|
||||
|
||||
#endif /* __NM_VPN_HELPERS_H__ */
|
||||
1009
clients/common/qrcodegen.c
Normal file
1009
clients/common/qrcodegen.c
Normal file
File diff suppressed because it is too large
Load diff
311
clients/common/qrcodegen.h
Normal file
311
clients/common/qrcodegen.h
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
/*
|
||||
* QR Code generator library (C)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This library creates QR Code symbols, which is a type of two-dimension barcode.
|
||||
* Invented by Denso Wave and described in the ISO/IEC 18004 standard.
|
||||
* A QR Code structure is an immutable square grid of black and white cells.
|
||||
* The library provides functions to create a QR Code from text or binary data.
|
||||
* The library covers the QR Code Model 2 specification, supporting all versions (sizes)
|
||||
* from 1 to 40, all 4 error correction levels, and 4 character encoding modes.
|
||||
*
|
||||
* Ways to create a QR Code object:
|
||||
* - High level: Take the payload data and call qrcodegen_encodeText() or qrcodegen_encodeBinary().
|
||||
* - Low level: Custom-make the list of segments and call
|
||||
* qrcodegen_encodeSegments() or qrcodegen_encodeSegmentsAdvanced().
|
||||
* (Note that all ways require supplying the desired error correction level and various byte buffers.)
|
||||
*/
|
||||
|
||||
|
||||
/*---- Enum and struct types----*/
|
||||
|
||||
/*
|
||||
* The error correction level in a QR Code symbol.
|
||||
*/
|
||||
enum qrcodegen_Ecc {
|
||||
// Must be declared in ascending order of error protection
|
||||
// so that an internal qrcodegen function works properly
|
||||
qrcodegen_Ecc_LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords
|
||||
qrcodegen_Ecc_MEDIUM , // The QR Code can tolerate about 15% erroneous codewords
|
||||
qrcodegen_Ecc_QUARTILE, // The QR Code can tolerate about 25% erroneous codewords
|
||||
qrcodegen_Ecc_HIGH , // The QR Code can tolerate about 30% erroneous codewords
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* The mask pattern used in a QR Code symbol.
|
||||
*/
|
||||
enum qrcodegen_Mask {
|
||||
// A special value to tell the QR Code encoder to
|
||||
// automatically select an appropriate mask pattern
|
||||
qrcodegen_Mask_AUTO = -1,
|
||||
// The eight actual mask patterns
|
||||
qrcodegen_Mask_0 = 0,
|
||||
qrcodegen_Mask_1,
|
||||
qrcodegen_Mask_2,
|
||||
qrcodegen_Mask_3,
|
||||
qrcodegen_Mask_4,
|
||||
qrcodegen_Mask_5,
|
||||
qrcodegen_Mask_6,
|
||||
qrcodegen_Mask_7,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Describes how a segment's data bits are interpreted.
|
||||
*/
|
||||
enum qrcodegen_Mode {
|
||||
qrcodegen_Mode_NUMERIC = 0x1,
|
||||
qrcodegen_Mode_ALPHANUMERIC = 0x2,
|
||||
qrcodegen_Mode_BYTE = 0x4,
|
||||
qrcodegen_Mode_KANJI = 0x8,
|
||||
qrcodegen_Mode_ECI = 0x7,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* A segment of character/binary/control data in a QR Code symbol.
|
||||
* The mid-level way to create a segment is to take the payload data
|
||||
* and call a factory function such as qrcodegen_makeNumeric().
|
||||
* The low-level way to create a segment is to custom-make the bit buffer
|
||||
* and initialize a qrcodegen_Segment struct with appropriate values.
|
||||
* Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
|
||||
* Any segment longer than this is meaningless for the purpose of generating QR Codes.
|
||||
* Moreover, the maximum allowed bit length is 32767 because
|
||||
* the largest QR Code (version 40) has 31329 modules.
|
||||
*/
|
||||
struct qrcodegen_Segment {
|
||||
// The mode indicator of this segment.
|
||||
enum qrcodegen_Mode mode;
|
||||
|
||||
// The length of this segment's unencoded data. Measured in characters for
|
||||
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
|
||||
// Always zero or positive. Not the same as the data's bit length.
|
||||
int numChars;
|
||||
|
||||
// The data bits of this segment, packed in bitwise big endian.
|
||||
// Can be null if the bit length is zero.
|
||||
uint8_t *data;
|
||||
|
||||
// The number of valid data bits used in the buffer. Requires
|
||||
// 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
|
||||
// The character count (numChars) must agree with the mode and the bit buffer length.
|
||||
int bitLength;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---- Macro constants and functions ----*/
|
||||
|
||||
#define qrcodegen_VERSION_MIN 1 // The minimum version number supported in the QR Code Model 2 standard
|
||||
#define qrcodegen_VERSION_MAX 40 // The maximum version number supported in the QR Code Model 2 standard
|
||||
|
||||
// Calculates the number of bytes needed to store any QR Code up to and including the given version number,
|
||||
// as a compile-time constant. For example, 'uint8_t buffer[qrcodegen_BUFFER_LEN_FOR_VERSION(25)];'
|
||||
// can store any single QR Code from version 1 to 25 (inclusive). The result fits in an int (or int16).
|
||||
// Requires qrcodegen_VERSION_MIN <= n <= qrcodegen_VERSION_MAX.
|
||||
#define qrcodegen_BUFFER_LEN_FOR_VERSION(n) ((((n) * 4 + 17) * ((n) * 4 + 17) + 7) / 8 + 1)
|
||||
|
||||
// The worst-case number of bytes needed to store one QR Code, up to and including
|
||||
// version 40. This value equals 3918, which is just under 4 kilobytes.
|
||||
// Use this more convenient value to avoid calculating tighter memory bounds for buffers.
|
||||
#define qrcodegen_BUFFER_LEN_MAX qrcodegen_BUFFER_LEN_FOR_VERSION(qrcodegen_VERSION_MAX)
|
||||
|
||||
|
||||
|
||||
/*---- Functions (high level) to generate QR Codes ----*/
|
||||
|
||||
/*
|
||||
* Encodes the given text string to a QR Code, returning true if encoding succeeded.
|
||||
* If the data is too long to fit in any version in the given range
|
||||
* at the given ECC level, then false is returned.
|
||||
* - The input text must be encoded in UTF-8 and contain no NULs.
|
||||
* - The variables ecl and mask must correspond to enum constant values.
|
||||
* - Requires 1 <= minVersion <= maxVersion <= 40.
|
||||
* - The arrays tempBuffer and qrcode must each have a length
|
||||
* of at least qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion).
|
||||
* - After the function returns, tempBuffer contains no useful data.
|
||||
* - If successful, the resulting QR Code may use numeric,
|
||||
* alphanumeric, or byte mode to encode the text.
|
||||
* - In the most optimistic case, a QR Code at version 40 with low ECC
|
||||
* can hold any UTF-8 string up to 2953 bytes, or any alphanumeric string
|
||||
* up to 4296 characters, or any digit string up to 7089 characters.
|
||||
* These numbers represent the hard upper limit of the QR Code standard.
|
||||
* - Please consult the QR Code specification for information on
|
||||
* data capacities per version, ECC level, and text encoding mode.
|
||||
*/
|
||||
bool qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode[],
|
||||
enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl);
|
||||
|
||||
|
||||
/*
|
||||
* Encodes the given binary data to a QR Code, returning true if encoding succeeded.
|
||||
* If the data is too long to fit in any version in the given range
|
||||
* at the given ECC level, then false is returned.
|
||||
* - The input array range dataAndTemp[0 : dataLen] should normally be
|
||||
* valid UTF-8 text, but is not required by the QR Code standard.
|
||||
* - The variables ecl and mask must correspond to enum constant values.
|
||||
* - Requires 1 <= minVersion <= maxVersion <= 40.
|
||||
* - The arrays dataAndTemp and qrcode must each have a length
|
||||
* of at least qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion).
|
||||
* - After the function returns, the contents of dataAndTemp may have changed,
|
||||
* and does not represent useful data anymore.
|
||||
* - If successful, the resulting QR Code will use byte mode to encode the data.
|
||||
* - In the most optimistic case, a QR Code at version 40 with low ECC can hold any byte
|
||||
* sequence up to length 2953. This is the hard upper limit of the QR Code standard.
|
||||
* - Please consult the QR Code specification for information on
|
||||
* data capacities per version, ECC level, and text encoding mode.
|
||||
*/
|
||||
bool qrcodegen_encodeBinary(uint8_t dataAndTemp[], size_t dataLen, uint8_t qrcode[],
|
||||
enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl);
|
||||
|
||||
|
||||
/*---- Functions (low level) to generate QR Codes ----*/
|
||||
|
||||
/*
|
||||
* Renders a QR Code representing the given segments at the given error correction level.
|
||||
* The smallest possible QR Code version is automatically chosen for the output. Returns true if
|
||||
* QR Code creation succeeded, or false if the data is too long to fit in any version. The ECC level
|
||||
* of the result may be higher than the ecl argument if it can be done without increasing the version.
|
||||
* This function allows the user to create a custom sequence of segments that switches
|
||||
* between modes (such as alphanumeric and byte) to encode text in less space.
|
||||
* This is a low-level API; the high-level API is qrcodegen_encodeText() and qrcodegen_encodeBinary().
|
||||
* To save memory, the segments' data buffers can alias/overlap tempBuffer, and will
|
||||
* result in them being clobbered, but the QR Code output will still be correct.
|
||||
* But the qrcode array must not overlap tempBuffer or any segment's data buffer.
|
||||
*/
|
||||
bool qrcodegen_encodeSegments(const struct qrcodegen_Segment segs[], size_t len,
|
||||
enum qrcodegen_Ecc ecl, uint8_t tempBuffer[], uint8_t qrcode[]);
|
||||
|
||||
|
||||
/*
|
||||
* Renders a QR Code representing the given segments with the given encoding parameters.
|
||||
* Returns true if QR Code creation succeeded, or false if the data is too long to fit in the range of versions.
|
||||
* The smallest possible QR Code version within the given range is automatically
|
||||
* chosen for the output. Iff boostEcl is true, then the ECC level of the result
|
||||
* may be higher than the ecl argument if it can be done without increasing the
|
||||
* version. The mask number is either between 0 to 7 (inclusive) to force that
|
||||
* mask, or -1 to automatically choose an appropriate mask (which may be slow).
|
||||
* This function allows the user to create a custom sequence of segments that switches
|
||||
* between modes (such as alphanumeric and byte) to encode text in less space.
|
||||
* This is a low-level API; the high-level API is qrcodegen_encodeText() and qrcodegen_encodeBinary().
|
||||
* To save memory, the segments' data buffers can alias/overlap tempBuffer, and will
|
||||
* result in them being clobbered, but the QR Code output will still be correct.
|
||||
* But the qrcode array must not overlap tempBuffer or any segment's data buffer.
|
||||
*/
|
||||
bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], size_t len, enum qrcodegen_Ecc ecl,
|
||||
int minVersion, int maxVersion, int mask, bool boostEcl, uint8_t tempBuffer[], uint8_t qrcode[]);
|
||||
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
||||
* A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
||||
* (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
||||
*/
|
||||
bool qrcodegen_isAlphanumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in numeric mode.
|
||||
* A string is encodable iff each character is in the range 0 to 9.
|
||||
*/
|
||||
bool qrcodegen_isNumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Returns the number of bytes (uint8_t) needed for the data buffer of a segment
|
||||
* containing the given number of characters using the given mode. Notes:
|
||||
* - Returns SIZE_MAX on failure, i.e. numChars > INT16_MAX or
|
||||
* the number of needed bits exceeds INT16_MAX (i.e. 32767).
|
||||
* - Otherwise, all valid results are in the range [0, ceil(INT16_MAX / 8)], i.e. at most 4096.
|
||||
* - It is okay for the user to allocate more bytes for the buffer than needed.
|
||||
* - For byte mode, numChars measures the number of bytes, not Unicode code points.
|
||||
* - For ECI mode, numChars must be 0, and the worst-case number of bytes is returned.
|
||||
* An actual ECI segment can have shorter data. For non-ECI modes, the result is exact.
|
||||
*/
|
||||
size_t qrcodegen_calcSegmentBufferSize(enum qrcodegen_Mode mode, size_t numChars);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given binary data encoded in
|
||||
* byte mode. All input byte arrays are acceptable. Any text string
|
||||
* can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeBytes(const uint8_t data[], size_t len, uint8_t buf[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given text string encoded in alphanumeric mode.
|
||||
* The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
||||
* dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeAlphanumeric(const char *text, uint8_t buf[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing an Extended Channel Interpretation
|
||||
* (ECI) designator with the given assignment value.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeEci(long assignVal, uint8_t buf[]);
|
||||
|
||||
|
||||
/*---- Functions to extract raw data from QR Codes ----*/
|
||||
|
||||
/*
|
||||
* Returns the side length of the given QR Code, assuming that encoding succeeded.
|
||||
* The result is in the range [21, 177]. Note that the length of the array buffer
|
||||
* is related to the side length - every 'uint8_t qrcode[]' must have length at least
|
||||
* qrcodegen_BUFFER_LEN_FOR_VERSION(version), which equals ceil(size^2 / 8 + 1).
|
||||
*/
|
||||
int qrcodegen_getSize(const uint8_t qrcode[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns the color of the module (pixel) at the given coordinates, which is false
|
||||
* for white or true for black. The top left corner has the coordinates (x=0, y=0).
|
||||
* If the given coordinates are out of bounds, then false (white) is returned.
|
||||
*/
|
||||
bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
388
clients/common/settings-docs.h.in
Normal file
388
clients/common/settings-docs.h.in
Normal file
|
|
@ -0,0 +1,388 @@
|
|||
/* Generated file. Do not edit. */
|
||||
|
||||
#define DESCRIBE_DOC_NM_SETTING_6LOWPAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this 6LowPAN interface should be created.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_CHANNEL N_("Channel on which the mesh network to join is located.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS N_("Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_SSID N_("SSID of the mesh network to join.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BAND N_("802.11 frequency band of the network. One of \"a\" for 5GHz 802.11a or \"bg\" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network to the specific band, i.e. if \"a\" is specified, the device will not associate with the same network in the 2.4GHz band even if the network's settings are compatible. This setting depends on specific driver capability and may not work with all drivers.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BSSID N_("If specified, directs the device to only associate with the given access point. This capability is highly driver dependent and not supported by all devices. Note: this property does not control the BSSID used when creating an Ad-Hoc network and is unlikely to in the future.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CHANNEL N_("Wireless channel to use for the Wi-Fi connection. The device will only join (or create for Ad-Hoc networks) a Wi-Fi network on the specified channel. Because channel numbers overlap between bands, this property also requires the \"band\" property to be set.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address of the device. \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_HIDDEN N_("If TRUE, indicates that the network is a non-broadcasting network that hides its SSID. This works both in infrastructure and AP mode. In infrastructure mode, various workarounds are used for a more reliable discovery of hidden networks, such as probe-scanning the SSID. However, these workarounds expose inherent insecurities with hidden SSID networks, and thus hidden SSID networks should be used with caution. In AP mode, the created network does not broadcast its SSID. Note that marking the network as hidden may be a privacy issue for you (in infrastructure mode) or client stations (in AP mode), as the explicit probe-scans are distinctly recognizable on the air.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS N_("If specified, this connection will only apply to the Wi-Fi device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST N_("A list of permanent MAC addresses of Wi-Fi devices to which this connection should never apply. Each MAC address should be given in the standard hex-digits-and-colons notation (eg \"00:11:22:33:44:55\").")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION N_("One of NM_SETTING_MAC_RANDOMIZATION_DEFAULT (0) (never randomize unless the user has set a global default to randomize and the supplicant supports randomization), NM_SETTING_MAC_RANDOMIZATION_NEVER (1) (never randomize the MAC address), or NM_SETTING_MAC_RANDOMIZATION_ALWAYS (2) (always randomize the MAC address). This property is deprecated for 'cloned-mac-address'. Deprecated: 1")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MODE N_("Wi-Fi network mode; one of \"infrastructure\", \"mesh\", \"adhoc\" or \"ap\". If blank, infrastructure is assumed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_POWERSAVE N_("One of NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2) (disable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_ENABLE (3) (enable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1) (don't touch currently configure setting) or NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0) (use the globally configured value). All other values are reserved.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_RATE N_("If non-zero, directs the device to only use the specified bitrate for communication with the access point. Units are in Kb/s, ie 5500 = 5.5 Mbit/s. This property is highly driver dependent and not all devices support setting a static bitrate.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SEEN_BSSIDS N_("A list of BSSIDs (each BSSID formatted as a MAC address like \"00:11:22:33:44:55\") that have been detected as part of the Wi-Fi network. NetworkManager internally tracks previously seen BSSIDs. The property is only meant for reading and reflects the BSSID list of NetworkManager. The changes you make to this property will not be preserved.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SSID N_("SSID of the Wi-Fi network. Must be specified.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_TX_POWER N_("If non-zero, directs the device to use the specified transmit power. Units are dBm. This property is highly driver dependent and not all devices support setting a static transmit power.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_WAKE_ON_WLAN N_("The NMSettingWirelessWakeOnWLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY (0x2), NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT (0x4), NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC (0x8), NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE (0x10), NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST (0x20), NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE (0x40), NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE (0x80), NM_SETTING_WIRELESS_WAKE_ON_WLAN_TCP (0x100) or the special values NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT (0x1) (to use global settings) and NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE (0x8000) (to disable management of Wake-on-LAN in NetworkManager).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_AUTH_ALG N_("When WEP is used (ie, key-mgmt = \"none\" or \"ieee8021x\") indicate the 802.11 authentication algorithm required by the AP here. One of \"open\" for Open System, \"shared\" for Shared Key, or \"leap\" for Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\") the \"leap-username\" and \"leap-password\" properties must be specified.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_FILS N_("Indicates whether Fast Initial Link Setup (802.11ai) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_FILS_DISABLE (1) (disable FILS), NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL (2) (enable FILS if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED (3) (enable FILS and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) and no global default is set, FILS will be optionally enabled.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_GROUP N_("A list of group/broadcast encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"wep40\", \"wep104\", \"tkip\", or \"ccmp\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-psk\" (infrastructure WPA-PSK), \"sae\" (SAE) or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD N_("The login password for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS N_("Flags indicating how to handle the \"leap-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME N_("The login username for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PAIRWISE N_("A list of pairwise encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"tkip\" or \"ccmp\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PMF N_("Indicates whether Protected Management Frames (802.11w) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE (1) (disable PMF), NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL (2) (enable PMF if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED (3) (enable PMF and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) and no global default is set, PMF will be optionally enabled.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PROTO N_("List of strings specifying the allowed WPA protocol versions to use. Each element may be one \"wpa\" (allow WPA) or \"rsn\" (allow WPA2/RSN). If not specified, both WPA and RSN connections are allowed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK N_("Pre-Shared-Key for WPA networks. For WPA-PSK, it's either an ASCII passphrase of 8 to 63 characters that is (as specified in the 802.11i standard) hashed to derive the actual key, or the key in form of 64 hexadecimal character. The WPA3-Personal networks use a passphrase of any length for SAE authentication.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS N_("Flags indicating how to handle the \"psk\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS N_("Flags indicating how to handle the \"wep-key0\", \"wep-key1\", \"wep-key2\", and \"wep-key3\" properties.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE N_("Controls the interpretation of WEP keys. Allowed values are NM_WEP_KEY_TYPE_KEY (1), in which case the key is either a 10- or 26-character hexadecimal string, or a 5- or 13-character ASCII password; or NM_WEP_KEY_TYPE_PASSPHRASE (2), in which case the passphrase is provided as a string and will be hashed using the de-facto MD5 method to derive the actual WEP key.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY0 N_("Index 0 WEP key. This is the WEP key used in most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY1 N_("Index 1 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY2 N_("Index 2 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY3 N_("Index 3 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX N_("When static WEP is used (ie, key-mgmt = \"none\") and a non-default WEP key index is used by the AP, put that WEP key index here. Valid values are 0 (default key) through 3. Note that some consumer access points (like the Linksys WRT54G) number the keys 1 - 4.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WPS_METHOD N_("Flags indicating which mode of WPS is to be used if any. There's little point in changing the default setting as NetworkManager will automatically determine whether it's feasible to start WPS enrollment from the Access Point capabilities. WPS can be disabled by setting this property to a value of 1.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server. If the list is empty, no verification of the server certificate's altSubjectName is performed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_ANONYMOUS_IDENTITY N_("Anonymous identity string for EAP authentication methods. Used as the unencrypted identity with EAP types that support different tunneled identity like EAP-TTLS.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_AUTH_TIMEOUT N_("A timeout for the authentication. Zero means the global default; if the global default is not set, the authentication timeout is 25 seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT N_("Contains the CA certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD N_("The password used to access the CA certificate stored in \"ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"ca-cert-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"ca-cert\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT N_("Contains the client certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD N_("The password used to access the client certificate stored in \"client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"client-cert-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_EAP N_("The allowed EAP method to be used when authenticating to the network with 802.1x. Valid methods are: \"leap\", \"md5\", \"tls\", \"peap\", \"ttls\", \"pwd\", and \"fast\". Each method requires different configuration using the properties of this setting; refer to wpa_supplicant documentation for the allowed combinations.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_IDENTITY N_("Identity string for EAP authentication methods. Often the user's user or login name.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_OPTIONAL N_("Whether the 802.1X authentication is optional. If TRUE, the activation will continue even after a timeout or an authentication failure. Setting the property to TRUE is currently allowed only for Ethernet connections. If set to FALSE, the activation can continue only after a successful authentication.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PAC_FILE N_("UTF-8 encoded file path containing PAC for EAP-FAST.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD N_("UTF-8 encoded password used for EAP authentication methods. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW N_("Password used for EAP authentication methods, given as a byte array to allow passwords in other encodings than UTF-8 to be used. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW_FLAGS N_("Flags indicating how to handle the \"password-raw\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_AUTH_FLAGS N_("Specifies authentication flags to use in \"phase 1\" outer authentication using NMSetting8021xAuthFlags options. The individual TLS versions can be explicitly disabled. If a certain TLS disable flag is not set, it is up to the supplicant to allow or forbid it. The TLS options map to tls_disable_tlsv1_x settings. See the wpa_supplicant documentation for more details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING N_("Enables or disables in-line provisioning of EAP-FAST credentials when FAST is specified as the EAP method in the \"eap\" property. Recognized values are \"0\" (disabled), \"1\" (allow unauthenticated provisioning), \"2\" (allow authenticated provisioning), and \"3\" (allow both authenticated and unauthenticated provisioning). See the wpa_supplicant documentation for more details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPLABEL N_("Forces use of the new PEAP label during key derivation. Some RADIUS servers may require forcing the new PEAP label to interoperate with PEAPv1. Set to \"1\" to force use of the new PEAP label. See the wpa_supplicant documentation for more details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPVER N_("Forces which PEAP version is used when PEAP is set as the EAP method in the \"eap\" property. When unset, the version reported by the server will be used. Sometimes when using older RADIUS servers, it is necessary to force the client to use a particular PEAP version. To do so, this property may be set to \"0\" or \"1\" to force that specific PEAP version.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If the list is empty, no verification of the server certificate's altSubjectName is performed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTH N_("Specifies the allowed \"phase 2\" inner non-EAP authentication method when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized non-EAP \"phase 2\" methods are \"pap\", \"chap\", \"mschap\", \"mschapv2\", \"gtc\", \"otp\", \"md5\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTHEAP N_("Specifies the allowed \"phase 2\" inner EAP-based authentication method when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized EAP-based \"phase 2\" methods are \"md5\", \"mschapv2\", \"otp\", \"gtc\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT N_("Contains the \"phase 2\" CA certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD N_("The password used to access the \"phase2\" CA certificate stored in \"phase2-ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-ca-cert-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"phase2-ca-cert\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT N_("Contains the \"phase 2\" client certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD N_("The password used to access the \"phase2\" client certificate stored in \"phase2-client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-client-cert-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY N_("Contains the \"phase 2\" inner private key when the \"phase2-auth\" or \"phase2-autheap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"phase2-private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"phase2-private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the \"phase 2\" private key specified in the \"phase2-private-key\" property when the private key either uses the path scheme, or is a PKCS#12 format key.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-private-key-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server during the inner \"phase 2\" authentication. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:phase2-domain-suffix-match.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN N_("PIN used for EAP authentication methods.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY N_("Contains the private key when the \"eap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate. WARNING: \"private-key\" is not a \"secret\" property, and thus unencrypted private key data using the BLOB scheme may be readable by unprivileged users. Private keys should always be encrypted with a private key password to prevent unauthorized access to unencrypted private key data.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the private key specified in the \"private-key\" property when the private key either uses the path scheme, or if the private key is a PKCS#12 format key.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"private-key-password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:domain-suffix-match.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_802_1X_SYSTEM_CA_CERTS N_("When TRUE, overrides the \"ca-path\" and \"phase2-ca-path\" properties using the system CA directory specified at configure time with the --system-ca-path switch. The certificates in this directory are added to the verification chain in addition to any certificates specified by the \"ca-cert\" and \"phase2-ca-cert\" properties. If the path provided with --system-ca-path is rather a file name (bundle of trusted CA certificates), it overrides \"ca-cert\" and \"phase2-ca-cert\" properties instead (sets ca_cert/ca_cert2 options for wpa_supplicant).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_AUTO_NEGOTIATE N_("When TRUE, enforce auto-negotiation of speed and duplex mode. If \"speed\" and \"duplex\" properties are both specified, only that single mode will be advertised and accepted during the link auto-negotiation process: this works only for BASE-T 802.3 specifications and is useful for enforcing gigabits modes, as in these cases link negotiation is mandatory. When FALSE, \"speed\" and \"duplex\" properties should be both set or link configuration will be skipped.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address if the device has one (otherwise this is treated as \"preserve\"). \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_DUPLEX N_("When a value is set, either \"half\" or \"full\", configures the device to use the specified duplex mode. If \"auto-negotiate\" is \"yes\" the specified duplex mode will be the only one advertised during link negotiation: this works only for BASE-T 802.3 specifications and is useful for enforcing gigabits modes, as in these cases link negotiation is mandatory. If the value is unset (the default), the link configuration will be either skipped (if \"auto-negotiate\" is \"no\", the default) or will be auto-negotiated (if \"auto-negotiate\" is \"yes\") and the local device will advertise all the supported duplex modes. Must be set together with the \"speed\" property if specified. Before specifying a duplex mode be sure your device supports it.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS N_("If specified, this connection will only apply to the Ethernet device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST N_("If specified, this connection will never apply to the Ethernet device whose permanent MAC address matches an address in the list. Each MAC address is in the standard hex-digits-and-colons notation (00:11:22:33:44:55).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_PORT N_("Specific port type to use if the device supports multiple attachment methods. One of \"tp\" (Twisted Pair), \"aui\" (Attachment Unit Interface), \"bnc\" (Thin Ethernet) or \"mii\" (Media Independent Interface). If the device supports only one port type, this setting is ignored.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_NETTYPE N_("s390 network device type; one of \"qeth\", \"lcs\", or \"ctc\", representing the different types of virtual network devices available on s390 systems.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_OPTIONS N_("Dictionary of key/value pairs of s390-specific device options. Both keys and values must be strings. Allowed keys include \"portno\", \"layer2\", \"portname\", \"protocol\", among others. Key names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_SUBCHANNELS N_("Identifies specific subchannels that this network device uses for communication with z/VM or s390 host. Like the \"mac-address\" property for non-z/VM devices, this property can be used to ensure this connection only applies to the network device that uses these subchannels. The list should contain exactly 3 strings, and each string may only be composed of hexadecimal characters and the period (.) character.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_SPEED N_("When a value greater than 0 is set, configures the device to use the specified speed. If \"auto-negotiate\" is \"yes\" the specified speed will be the only one advertised during link negotiation: this works only for BASE-T 802.3 specifications and is useful for enforcing gigabit speeds, as in this case link negotiation is mandatory. If the value is unset (0, the default), the link configuration will be either skipped (if \"auto-negotiate\" is \"no\", the default) or will be auto-negotiated (if \"auto-negotiate\" is \"yes\") and the local device will advertise all the supported speeds. In Mbit/s, ie 100 == 100Mbit/s. Must be set together with the \"duplex\" property when non-zero. Before specifying a speed value be sure your device supports it.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN N_("The NMSettingWiredWakeOnLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRED_WAKE_ON_LAN_PHY (0x2), NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST (0x4), NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST (0x8), NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST (0x10), NM_SETTING_WIRED_WAKE_ON_LAN_ARP (0x20), NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC (0x40) or the special values NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (0x1) (to use global settings) and NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (0x8000) (to disable management of Wake-on-LAN in NetworkManager).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD N_("If specified, the password used with magic-packet-based Wake-on-LAN, represented as an Ethernet MAC address. If NULL, no password will be required.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_ADSL_ENCAPSULATION N_("Encapsulation of ADSL connection. Can be \"vcmux\" or \"llc\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD N_("Password used to authenticate with the ADSL service.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_ADSL_PROTOCOL N_("ADSL connection protocol. Can be \"pppoa\", \"pppoe\" or \"ipoatm\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_ADSL_USERNAME N_("Username used to authenticate with the ADSL service.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_ADSL_VCI N_("VCI of ADSL connection")
|
||||
#define DESCRIBE_DOC_NM_SETTING_ADSL_VPI N_("VPI of ADSL connection")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_BDADDR N_("The Bluetooth address of the device.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_TYPE N_("Either \"dun\" for Dial-Up Networking connections or \"panu\" for Personal Area Networking connections to devices supporting the NAP profile.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BOND_OPTIONS N_("Dictionary of key/value pairs of bonding options. Both keys and values must be strings. Option names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_AGEING_TIME N_("The Ethernet MAC address aging time, in seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_FORWARD_DELAY N_("The Spanning Tree Protocol (STP) forwarding delay, in seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_GROUP_FORWARD_MASK N_("A mask of group addresses to forward. Usually, group addresses in the range from 01:80:C2:00:00:00 to 01:80:C2:00:00:0F are not forwarded according to standards. This property is a mask of 16 bits, each corresponding to a group address in that range that must be forwarded. The mask can't have bits 0, 1 or 2 set because they are used for STP, MAC pause frames and LACP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_HELLO_TIME N_("The Spanning Tree Protocol (STP) hello time, in seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAC_ADDRESS N_("If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. If this field is left unspecified, the \"ethernet.cloned-mac-address\" is referred instead to generate the initial MAC address. Note that setting \"ethernet.cloned-mac-address\" anyway overwrites the MAC address of the bridge later while activating the bridge. Hence, this property is deprecated. Deprecated: 1")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAX_AGE N_("The Spanning Tree Protocol (STP) maximum message age, in seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_SNOOPING N_("Controls whether IGMP snooping is enabled for this bridge. Note that if snooping was automatically disabled due to hash collisions, the system may refuse to enable the feature until the collisions are resolved.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PRIORITY N_("Sets the Spanning Tree Protocol (STP) priority for this bridge. Lower values are \"better\"; the lowest priority bridge will be elected the root bridge.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_STP N_("Controls whether Spanning Tree Protocol (STP) is enabled for this bridge.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_VLAN_DEFAULT_PVID N_("The default PVID for the ports of the bridge, that is the VLAN id assigned to incoming untagged frames.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_VLAN_FILTERING N_("Control whether VLAN filtering is enabled on the bridge.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_VLANS N_("Array of bridge VLAN objects. In addition to the VLANs specified here, the bridge will also have the default-pvid VLAN configured by the bridge.vlan-default-pvid property. In nmcli the VLAN list can be specified with the following syntax: $vid [pvid] [untagged] [, $vid [pvid] [untagged]]... where $vid is either a single id between 1 and 4094 or a range, represented as a couple of ids separated by a dash.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE N_("Enables or disables \"hairpin mode\" for the port, which allows frames to be sent back out through the port the frame was received on.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PATH_COST N_("The Spanning Tree Protocol (STP) port cost for destinations via this port.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PRIORITY N_("The Spanning Tree Protocol (STP) priority of this bridge port.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_VLANS N_("Array of bridge VLAN objects. In addition to the VLANs specified here, the port will also have the default-pvid VLAN configured on the bridge by the bridge.vlan-default-pvid property. In nmcli the VLAN list can be specified with the following syntax: $vid [pvid] [untagged] [, $vid [pvid] [untagged]]... where $vid is either a single id between 1 and 4094 or a range, represented as a couple of ids separated by a dash.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CDMA_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CDMA_NUMBER N_("The number to dial to establish the connection to the CDMA-based mobile broadband network, if any. If not specified, the default number (#777) is used when required.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CDMA_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTH_RETRIES N_("The number of retries for the authentication. Zero means to try indefinitely; -1 means to use a global default. If the global default is not set, the authentication retries for 3 times before failing the connection. Currently this only applies to 802-1x authentication.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT N_("Whether or not the connection should be automatically connected by NetworkManager when the resources for the connection are available. TRUE to automatically activate the connection, FALSE to require manual intervention to activate the connection. Note that autoconnect is not implemented for VPN profiles. See \"secondaries\" as an alternative to automatically connect VPN profiles.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY N_("The autoconnect priority. If the connection is set to autoconnect, connections with higher priority will be preferred. Defaults to 0. The higher number means higher priority.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES N_("The number of times a connection should be tried when autoactivating before giving up. Zero means forever, -1 means the global default (4 times if not overridden). Setting this to 1 means to try activation only once before blocking autoconnect. Note that after a timeout, NetworkManager will try to autoconnect again.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES N_("Whether or not slaves of this connection should be automatically brought up when NetworkManager activates this connection. This only has a real effect for master connections. The properties \"autoconnect\", \"autoconnect-priority\" and \"autoconnect-retries\" are unrelated to this setting. The permitted values are: 0: leave slave connections untouched, 1: activate all the slave connections with this connection, -1: default. If -1 (default) is set, global connection.autoconnect-slaves is read to determine the real value. If it is default as well, this fallbacks to 0.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT N_("If greater than zero, delay success of IP addressing until either the timeout is reached, or an IP gateway replies to a ping.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ID N_("A human readable unique identifier for the connection, like \"Work Wi-Fi\" or \"T-Mobile 3G\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_INTERFACE_NAME N_("The name of the network interface this connection is bound to. If not set, then the connection can be attached to any interface of the appropriate type (subject to restrictions imposed by other settings). For software devices this specifies the name of the created device. For connection types where interface names cannot easily be made persistent (e.g. mobile broadband or USB Ethernet), this property should not be used. Setting this property restricts the interfaces a connection can be used with, and if interface names change or are reordered the connection may be applied to the wrong interface.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_LLDP N_("Whether LLDP is enabled for the connection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_LLMNR N_("Whether Link-Local Multicast Name Resolution (LLMNR) is enabled for the connection. LLMNR is a protocol based on the Domain Name System (DNS) packet format that allows both IPv4 and IPv6 hosts to perform name resolution for hosts on the same local link. The permitted values are: yes: register hostname and resolving for the connection, no: disable LLMNR for the interface, resolve: do not register hostname but allow resolving of LLMNR host names. This feature requires a plugin which supports LLMNR. One such plugin is dns-systemd-resolved.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MASTER N_("Interface name of the master device or UUID of the master connection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MDNS N_("Whether mDNS is enabled for the connection. The permitted values are: yes: register hostname and resolving for the connection, no: disable mDNS for the interface, resolve: do not register hostname but allow resolving of mDNS host names. This feature requires a plugin which supports mDNS. One such plugin is dns-systemd-resolved.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_METERED N_("Whether the connection is metered. When updating this property on a currently activated connection, the change takes effect immediately.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MULTI_CONNECT N_("Specifies whether the profile can be active multiple times at a particular moment. The value is of type NMConnectionMultiConnect.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_PERMISSIONS N_("An array of strings defining what access a given user has to this connection. If this is NULL or empty, all users are allowed to access this connection; otherwise users are allowed if and only if they are in this list. When this is not empty, the connection can be active only when one of the specified users is logged into an active session. Each entry is of the form \"[type]:[id]:[reserved]\"; for example, \"user:dcbw:blah\". At this time only the \"user\" [type] is allowed. Any other values are ignored and reserved for future use. [id] is the username that this permission refers to, which may not contain the \":\" character. Any [reserved] information present must be ignored and is reserved for future use. All of [type], [id], and [reserved] must be valid UTF-8.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_READ_ONLY N_("FALSE if the connection can be modified using the provided settings service's D-Bus interface with the right privileges, or TRUE if the connection is read-only and cannot be modified.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SECONDARIES N_("List of connection UUIDs that should be activated when the base connection itself is activated. Currently only VPN connections are supported.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SLAVE_TYPE N_("Setting name of the device type of this slave's master connection (eg, \"bond\"), or NULL if this connection is not a slave.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_STABLE_ID N_("This represents the identity of the connection used for various purposes. It allows to configure multiple profiles to share the identity. Also, the stable-id can contain placeholders that are substituted dynamically and deterministically depending on the context. The stable-id is used for generating IPv6 stable private addresses with ipv6.addr-gen-mode=stable-privacy. It is also used to seed the generated cloned MAC address for ethernet.cloned-mac-address=stable and wifi.cloned-mac-address=stable. It is also used as DHCP client identifier with ipv4.dhcp-client-id=stable and to derive the DHCP DUID with ipv6.dhcp-duid=stable-[llt,ll,uuid]. Note that depending on the context where it is used, other parameters are also seeded into the generation algorithm. For example, a per-host key is commonly also included, so that different systems end up generating different IDs. Or with ipv6.addr-gen-mode=stable-privacy, also the device's name is included, so that different interfaces yield different addresses. The '$' character is treated special to perform dynamic substitutions at runtime. Currently supported are \"${CONNECTION}\", \"${DEVICE}\", \"${MAC}\", \"${BOOT}\", \"${RANDOM}\". These effectively create unique IDs per-connection, per-device, per-boot, or every time. Note that \"${DEVICE}\" corresponds to the interface name of the device and \"${MAC}\" is the permanent MAC address of the device. Any unrecognized patterns following '$' are treated verbatim, however are reserved for future use. You are thus advised to avoid '$' or escape it as \"$$\". For example, set it to \"${CONNECTION}-${BOOT}-${DEVICE}\" to create a unique id for this connection that changes with every reboot and differs depending on the interface where the profile activates. If the value is unset, a global connection default is consulted. If the value is still unset, the default is similar to \"${CONNECTION}\" and uses a unique, fixed ID for the connection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TIMESTAMP N_("The time, in seconds since the Unix Epoch, that the connection was last _successfully_ fully activated. NetworkManager updates the connection timestamp periodically when the connection is active to ensure that an active connection has the latest timestamp. The property is only meant for reading (changes to this property will not be preserved).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TYPE N_("Base type of the connection. For hardware-dependent connections, should contain the setting name of the hardware-type specific setting (ie, \"802-3-ethernet\" or \"802-11-wireless\" or \"bluetooth\", etc), and for non-hardware dependent connections like VPN or otherwise, should contain the setting name of that setting type (ie, \"vpn\" or \"bridge\", etc).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_UUID N_("A universally unique identifier for the connection, for example generated with libuuid. It should be assigned when the connection is created, and never changed as long as the connection still applies to the same network. For example, it should not be changed when the \"id\" property or NMSettingIP4Config changes, but might need to be re-created when the Wi-Fi SSID, mobile broadband network provider, or \"type\" property changes. The UUID must be in the format \"2815492f-7e56-435e-b2e9-246bd7cdc664\" (ie, contains only hexadecimal characters and \"-\").")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_WAIT_DEVICE_TIMEOUT N_("Timeout in milliseconds to wait for device at startup. During boot, devices may take a while to be detected by the driver. This property will cause to delay NetworkManager-wait-online.service and nm-online to give the device a chance to appear. Note that this property only works together with NMSettingConnection:interface-name to identify the device that will be waited for. The value 0 means no wait time. The default value is -1, which currently has the same meaning as no wait time.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ZONE N_("The trust level of a the connection. Free form case-insensitive string (for example \"Home\", \"Work\", \"Public\"). NULL or unspecified zone means the connection will be placed in the default zone as defined by the firewall. When updating this property on a currently activated connection, the change takes effect immediately.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FCoE application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_MODE N_("The FCoE controller mode; either \"fabric\" (default) or \"vn2vn\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_PRIORITY N_("The highest User Priority (0 - 7) which FCoE frames should use, or -1 for default priority. Only used when the \"app-fcoe-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FIP application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_PRIORITY N_("The highest User Priority (0 - 7) which FIP frames should use, or -1 for default priority. Only used when the \"app-fip-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB iSCSI application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_PRIORITY N_("The highest User Priority (0 - 7) which iSCSI frames should use, or -1 for default priority. Only used when the \"app-iscsi-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the percentage of bandwidth of the priority's assigned group that the priority may use. The sum of all percentages for priorities which belong to the same group must total 100 percents.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the corresponding priority should transmit priority pause.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Flow Control (PFC). Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the Priority Group ID (0 - 7) and the value indicates the percentage of link bandwidth allocated to that group. Allowed values are 0 - 100, and the sum of all values must total 100 percents.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Groups. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_ID N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the Priority Group ID. Allowed Priority Group ID values are 0 - 7 or 15 for the unrestricted group.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the priority may use all of the bandwidth allocated to its assigned group.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the traffic class (0 - 7) to which the priority is mapped.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_APN N_("The GPRS Access Point Name specifying the APN used when establishing a data session with the GSM-based network. The APN often determines how the user will be billed for their network usage and whether the user has access to the Internet or just a provider-specific walled-garden, so it is important to use the correct APN for the user's mobile broadband plan. The APN may only be composed of the characters a-z, 0-9, ., and - per GSM 03.60 Section 14.9.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_AUTO_CONFIG N_("When TRUE, the settings such as APN, username, or password will default to values that match the network the modem will register to in the Mobile Broadband Provider database.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_DEVICE_ID N_("The device unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will only apply to the specified device.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_HOME_ONLY N_("When TRUE, only connections to the home network will be allowed. Connections to roaming networks will not be made.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_NETWORK_ID N_("The Network ID (GSM LAI format, ie MCC-MNC) to force specific network registration. If the Network ID is specified, NetworkManager will attempt to force the device to register only on the specified network. This can be used to ensure that the device does not roam when direct roaming control of the device is not otherwise possible.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_NUMBER N_("Legacy setting that used to help establishing PPP data sessions for GSM-based modems. Deprecated: 1")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_PIN N_("If the SIM is locked with a PIN it must be unlocked before any other operations are requested. Specify the PIN here to allow operation of the device.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_ID N_("The SIM card unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" which contains a SIM card matching the given identifier.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_OPERATOR_ID N_("A MCC/MNC string like \"310260\" or \"21601\" identifying the specific mobile network operator which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" and \"sim-id\" which contains a SIM card provisioned by the given operator.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_GSM_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MAC_ADDRESS N_("If specified, this connection will only apply to the IPoIB device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_P_KEY N_("The InfiniBand P_Key to use for this device. A value of -1 means to use the default P_Key (aka \"the P_Key at index 0\"). Otherwise it is a 16-bit unsigned integer, whose high bit is set if it is a \"full membership\" P_Key.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_PARENT N_("The interface name of the parent device of this device. Normally NULL, but if the \"p_key\" property is set, then you must specify the base device by setting either this property or \"mac-address\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_TRANSPORT_MODE N_("The IP-over-InfiniBand transport mode. Either \"datagram\" or \"connected\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT N_("How many additional levels of encapsulation are permitted to be prepended to packets. This property applies only to IPv6 tunnels.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_FLAGS N_("Tunnel flags. Currently the following values are supported: NM_IP_TUNNEL_FLAG_IP6_IGN_ENCAP_LIMIT (0x1), NM_IP_TUNNEL_FLAG_IP6_USE_ORIG_TCLASS (0x2), NM_IP_TUNNEL_FLAG_IP6_USE_ORIG_FLOWLABEL (0x4), NM_IP_TUNNEL_FLAG_IP6_MIP6_DEV (0x8), NM_IP_TUNNEL_FLAG_IP6_RCV_DSCP_COPY (0x10), NM_IP_TUNNEL_FLAG_IP6_USE_ORIG_FWMARK (0x20). They are valid only for IPv6 tunnels.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_FLOW_LABEL N_("The flow label to assign to tunnel packets. This property applies only to IPv6 tunnels.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_INPUT_KEY N_("The key used for tunnel input packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_LOCAL N_("The local endpoint of the tunnel; the value can be empty, otherwise it must contain an IPv4 or IPv6 address.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MODE N_("The tunneling mode, for example NM_IP_TUNNEL_MODE_IPIP (1) or NM_IP_TUNNEL_MODE_GRE (2).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_OUTPUT_KEY N_("The key used for tunnel output packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PARENT N_("If given, specifies the parent interface name or parent connection UUID the new device will be bound to so that tunneled packets will only be routed via that interface.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY N_("Whether to enable Path MTU Discovery on this tunnel.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_REMOTE N_("The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6 address.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TOS N_("The type of service (IPv4) or traffic class (IPv6) field to be set on tunneled packets.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TTL N_("The TTL to assign to tunneled packets. 0 is a special value meaning that packets inherit the TTL value.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ADDRESSES N_("Array of IP addresses.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or zero). A value greater than zero is a timeout in milliseconds. The property is currently implemented only for IPv4.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID N_("A string sent to the DHCP server to identify the local machine which the DHCP server may use to customize the DHCP lease and options. When the property is a hex string ('aa:bb:cc') it is interpreted as a binary client ID, in which case the first byte is assumed to be the 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet ARP type and the rest is a MAC address). If the property is not a hex string it is considered as a non-hardware-address client ID and the 'type' field is set to 0. The special values \"mac\" and \"perm-mac\" are supported, which use the current or permanent MAC address of the device to generate a client identifier with type ethernet (01). Currently, these options only work for ethernet type of links. The special value \"duid\" generates a RFC4361-compliant client identifier based on a hash of the interface name as IAID and /etc/machine-id. The special value \"stable\" is supported to generate a type 0 client identifier based on the stable-id (see connection.stable-id) and a per-host key. If you set the stable-id, you may want to include the \"${DEVICE}\" or \"${MAC}\" specifier to get a per-device key. If unset, a globally configured default is used. If still unset, the default depends on the DHCP plugin.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_FQDN N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified FQDN will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-hostname\" are mutually exclusive and cannot be set at the same time.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_IAID N_("A string containing the \"Identity Association Identifier\" (IAID) used by the DHCP client. The property is a 32-bit decimal value or a special value among \"mac\", \"perm-mac\", \"ifname\" and \"stable\". When set to \"mac\" (or \"perm-mac\"), the last 4 bytes of the current (or permanent) MAC address are used as IAID. When set to \"ifname\", the IAID is computed by hashing the interface name. The special value \"stable\" can be used to generate an IAID based on the stable-id (see connection.stable-id), a per-host key and the interface name. When the property is unset, the value from global configuration is used; if no global default is set then the IAID is assumed to be \"ifname\". Note that at the moment this property is ignored for IPv6 by dhclient, which always derives the IAID from the MAC address.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS N_("Array of IP addresses of DNS servers.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_PRIORITY N_("DNS servers priority. The relative priority for DNS servers specified by this setting. A lower value is better (higher priority). Zero selects a globally configured default value. If the latter is missing or zero too, it defaults to 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. When using dns=default, servers with higher priority will be on top of resolv.conf. To prioritize a given server over another one within the same connection, just specify them in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used. When using a DNS resolver that supports Conditional Forwarding as dns=dnsmasq or dns=systemd-resolved, each connection is used to query domains in its search list. Queries for domains not present in any search list are routed through connections having the '~.' special wildcard domain, which is added automatically to connections with the default route (or can be added manually). When multiple connections specify the same domain, the one with the highest priority (lowest numerical value) wins. If a connection specifies a domain which is subdomain of another domain with a negative DNS priority value, the subdomain is ignored.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_SEARCH N_("Array of DNS search domains. Domains starting with a tilde ('~') are considered 'routing' domains and are used only to decide the interface over which a query must be forwarded; they are not used to complete unqualified host names.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"disabled\", \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the shared method must be configured on the interface which shares the internet to a subnet, not on the uplink which is shared.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE N_("Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTES N_("Array of IP routes.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE N_("Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host's presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection's stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host's presence, and makes the address stable when the network interface hardware is replaced. On D-Bus, the absence of an addr-gen-mode setting equals enabling stable-privacy. For keyfile plugin, the absence of the setting on disk means EUI64 so that the property doesn't change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by \"ip6-privacy\" property and it does not affect the temporary addresses configured with this option.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDRESSES N_("Array of IP addresses.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or zero). A value greater than zero is a timeout in milliseconds. The property is currently implemented only for IPv4.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_DUID N_("A string containing the DHCPv6 Unique Identifier (DUID) used by the dhcp client to identify itself to DHCPv6 servers (RFC 3315). The DUID is carried in the Client Identifier option. If the property is a hex string ('aa:bb:cc') it is interpreted as a binary DUID and filled as an opaque value in the Client Identifier option. The special value \"lease\" will retrieve the DUID previously used from the lease file belonging to the connection. If no DUID is found and \"dhclient\" is the configured dhcp client, the DUID is searched in the system-wide dhclient lease file. If still no DUID is found, or another dhcp client is used, a global and permanent DUID-UUID (RFC 6355) will be generated based on the machine-id. The special values \"llt\" and \"ll\" will generate a DUID of type LLT or LL (see RFC 3315) based on the current MAC address of the device. In order to try providing a stable DUID-LLT, the time field will contain a constant timestamp that is used globally (for all profiles) and persisted to disk. The special values \"stable-llt\", \"stable-ll\" and \"stable-uuid\" will generate a DUID of the corresponding type, derived from the connection's stable-id and a per-host unique key. You may want to include the \"${DEVICE}\" or \"${MAC}\" specifier in the stable-id, in case this profile gets activated on multiple devices. So, the link-layer address of \"stable-ll\" and \"stable-llt\" will be a generated address derived from the stable id. The DUID-LLT time value in the \"stable-llt\" option will be picked among a static timespan of three years (the upper bound of the interval is the same constant timestamp used in \"llt\"). When the property is unset, the global value provided for \"ipv6.dhcp-duid\" is used. If no global value is provided, the default \"lease\" value is assumed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_IAID N_("A string containing the \"Identity Association Identifier\" (IAID) used by the DHCP client. The property is a 32-bit decimal value or a special value among \"mac\", \"perm-mac\", \"ifname\" and \"stable\". When set to \"mac\" (or \"perm-mac\"), the last 4 bytes of the current (or permanent) MAC address are used as IAID. When set to \"ifname\", the IAID is computed by hashing the interface name. The special value \"stable\" can be used to generate an IAID based on the stable-id (see connection.stable-id), a per-host key and the interface name. When the property is unset, the value from global configuration is used; if no global default is set then the IAID is assumed to be \"ifname\". Note that at the moment this property is ignored for IPv6 by dhclient, which always derives the IAID from the MAC address.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS N_("Array of IP addresses of DNS servers.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_PRIORITY N_("DNS servers priority. The relative priority for DNS servers specified by this setting. A lower value is better (higher priority). Zero selects a globally configured default value. If the latter is missing or zero too, it defaults to 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. When using dns=default, servers with higher priority will be on top of resolv.conf. To prioritize a given server over another one within the same connection, just specify them in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used. When using a DNS resolver that supports Conditional Forwarding as dns=dnsmasq or dns=systemd-resolved, each connection is used to query domains in its search list. Queries for domains not present in any search list are routed through connections having the '~.' special wildcard domain, which is added automatically to connections with the default route (or can be added manually). When multiple connections specify the same domain, the one with the highest priority (lowest numerical value) wins. If a connection specifies a domain which is subdomain of another domain with a negative DNS priority value, the subdomain is ignored.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_SEARCH N_("Array of DNS search domains. Domains starting with a tilde ('~') are considered 'routing' domains and are used only to decide the interface over which a query must be forwarded; they are not used to complete unqualified host names.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IP6_PRIVACY N_("Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If enabled, it makes the kernel generate a temporary IPv6 address in addition to the public one generated from MAC address via modified EUI-64. This enhances privacy, but could cause problems in some applications, on the other hand. The permitted values are: -1: unknown, 0: disabled, 1: enabled (prefer public address), 2: enabled (prefer temporary addresses). Having a per-connection setting set to \"-1\" (unknown) means fallback to global configuration \"ipv6.ip6-privacy\". If also global configuration is unspecified or set to \"-1\", fallback to read \"/proc/sys/net/ipv6/conf/default/use_tempaddr\". Note that this setting is distinct from the Stable Privacy addresses that can be enabled with the \"addr-gen-mode\" property's \"stable-privacy\" setting as another way of avoiding host tracking with IPv6 addresses.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"disabled\", \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the shared method must be configured on the interface which shares the internet to a subnet, not on the uplink which is shared.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_TABLE N_("Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTES N_("Array of IP routes.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_TOKEN N_("Configure the token for draft-chown-6man-tokenised-ipv6-identifiers-02 IPv6 tokenized interface identifiers. Useful with eui64 addr-gen-mode.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_ENCRYPT N_("Whether the transmitted traffic must be encrypted.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK N_("The pre-shared CAK (Connectivity Association Key) for MACsec Key Agreement.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK_FLAGS N_("Flags indicating how to handle the \"mka-cak\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CKN N_("The pre-shared CKN (Connectivity-association Key Name) for MACsec Key Agreement.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_MODE N_("Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key Agreement) is obtained.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MACSEC interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_PORT N_("The port component of the SCI (Secure Channel Identifier), between 1 and 65534.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_SEND_SCI N_("Specifies whether the SCI (Secure Channel Identifier) is included in every packet.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACSEC_VALIDATION N_("Specifies the validation mode for incoming frames.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_MODE N_("The macvlan mode, which specifies the communication mechanism between multiple macvlans on the same lower device.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MAC-VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PROMISCUOUS N_("Whether the interface should be put in promiscuous mode.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_MATCH_INTERFACE_NAME N_("A list of interface names to match. Each element is a shell wildcard pattern. When an element is prefixed with exclamation mark (!) the condition is inverted. A candidate interface name is considered matching when both these conditions are satisfied: (a) any of the elements not prefixed with '!' matches or there aren't such elements; (b) none of the elements prefixed with '!' match.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_DATAPATH_TYPE N_("The data path type. One of \"system\", \"netdev\" or empty.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_FAIL_MODE N_("The bridge failure mode. One of \"secure\", \"standalone\" or empty.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE N_("Enable or disable multicast snooping.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_RSTP_ENABLE N_("Enable or disable RSTP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_STP_ENABLE N_("Enable or disable STP.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_DPDK_DEVARGS N_("Open vSwitch DPDK device arguments.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", \"system\", \"patch\", \"dpdk\", or empty.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_PEER N_("Specifies the unicast destination IP address of a remote Open vSwitch bridge port to connect to.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_DOWNDELAY N_("The time port must be inactive in order to be considered down.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_MODE N_("Bonding mode. One of \"active-backup\", \"balance-slb\", or \"balance-tcp\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_UPDELAY N_("The time port must be active before it starts forwarding traffic.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_LACP N_("LACP mode. One of \"active\", \"off\", or \"passive\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_TAG N_("The VLAN tag in the range 0-4095.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_VLAN_MODE N_("The VLAN mode. One of \"access\", \"native-tagged\", \"native-untagged\", \"trunk\" or unset.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_BAUD N_("If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_CRTSCTS N_("If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_FAILURE N_("If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The \"lcp-echo-interval\" property must also be set to a non-zero value if this property is used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_INTERVAL N_("If non-zero, instruct pppd to send an LCP echo-request frame to the peer every n seconds (where n is the specified value). Note that some PPP peers will respond to echo requests and some will not, and it is not possible to autodetect this.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_MPPE_STATEFUL N_("If TRUE, stateful MPPE is used. See pppd documentation for more information on stateful MPPE.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_MRU N_("If non-zero, instruct pppd to request that the peer send packets no larger than the specified size. If non-zero, the MRU should be between 128 and 16384.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_MTU N_("If non-zero, instruct pppd to send packets no larger than the specified size.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_NO_VJ_COMP N_("If TRUE, Van Jacobsen TCP header compression will not be requested.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_NOAUTH N_("If TRUE, do not require the other side (usually the PPP server) to authenticate itself to the client. If FALSE, require authentication from the remote side. In almost all cases, this should be TRUE.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_NOBSDCOMP N_("If TRUE, BSD compression will not be requested.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_NODEFLATE N_("If TRUE, \"deflate\" compression will not be requested.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_CHAP N_("If TRUE, the CHAP authentication method will not be used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_EAP N_("If TRUE, the EAP authentication method will not be used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAP N_("If TRUE, the MSCHAP authentication method will not be used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAPV2 N_("If TRUE, the MSCHAPv2 authentication method will not be used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_PAP N_("If TRUE, the PAP authentication method will not be used.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE N_("If TRUE, MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session. If either 64-bit or 128-bit MPPE is not available the session will fail. Note that MPPE is not used on mobile broadband connections.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE_128 N_("If TRUE, 128-bit MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session, and the \"require-mppe\" property must also be set to TRUE. If 128-bit MPPE is not available the session will fail.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PARENT N_("If given, specifies the parent interface name on which this PPPoE connection should be created. If this property is not specified, the connection is activated on the interface specified in \"interface-name\" of NMSettingConnection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD N_("Password used to authenticate with the PPPoE service.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_SERVICE N_("If specified, instruct PPPoE to only initiate sessions with access concentrators that provide the specified service. For most providers, this should be left blank. It is only required if there are multiple access concentrators or a specific service is known to be required.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_USERNAME N_("Username used to authenticate with the PPPoE service.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PROXY_BROWSER_ONLY N_("Whether the proxy configuration is for browser only.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PROXY_METHOD N_("Method for proxy configuration, Default is NM_SETTING_PROXY_METHOD_NONE (0)")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_SCRIPT N_("PAC script for the connection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_URL N_("PAC URL for obtaining PAC file.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SERIAL_BAUD N_("Speed to use for communication over the serial port. Note that this value usually has no effect for mobile broadband modems as they generally ignore speed settings and use the highest available speed.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SERIAL_BITS N_("Byte-width of the serial communication. The 8 in \"8n1\" for example.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SERIAL_PARITY N_("Parity setting of the serial port.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SERIAL_SEND_DELAY N_("Time to delay between each byte sent to the modem, in microseconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SERIAL_STOPBITS N_("Number of stop bits for communication on the serial port. Either 1 or 2. The 1 in \"8n1\" for example.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SRIOV_AUTOPROBE_DRIVERS N_("Whether to autoprobe virtual functions by a compatible driver. If set to NM_TERNARY_TRUE (1), the kernel will try to bind VFs to a compatible driver and if this succeeds a new network interface will be instantiated for each VF. If set to NM_TERNARY_FALSE (0), VFs will not be claimed and no network interfaces will be created for them. When set to NM_TERNARY_DEFAULT (-1), the global default is used; in case the global default is unspecified it is assumed to be NM_TERNARY_TRUE (1).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SRIOV_TOTAL_VFS N_("The total number of virtual functions to create. Note that when the sriov setting is present NetworkManager enforces the number of virtual functions on the interface also when it is zero. To prevent any changes to SR-IOV parameters don't add a sriov setting to the connection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_SRIOV_VFS N_("Array of virtual function descriptors. Each VF descriptor is a dictionary mapping attribute names to GVariant values. The 'index' entry is mandatory for each VF. When represented as string a VF is in the form: \"INDEX [ATTR=VALUE[ ATTR=VALUE]...]\". for example: \"2 mac=00:11:22:33:44:55 spoof-check=true\". Multiple VFs can be specified using a comma as separator. Currently the following attributes are supported: mac, spoof-check, trust, min-tx-rate, max-tx-rate, vlans. The \"vlans\" attribute is represented as a semicolon-separated list of VLAN descriptors, where each descriptor has the form \"ID[.PRIORITY[.PROTO]]\". PROTO can be either 'q' for 802.1Q (the default) or 'ad' for 802.1ad.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_QDISCS N_("Array of TC queueing disciplines.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TC_CONFIG_TFILTERS N_("Array of TC traffic filters.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_CONFIG N_("The JSON configuration for the team network interface. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_LINK_WATCHERS N_("Link watchers configuration for the connection: each link watcher is defined by a dictionary, whose keys depend upon the selected link watcher. Available link watchers are 'ethtool', 'nsna_ping' and 'arp_ping' and it is specified in the dictionary with the key 'name'. Available keys are: ethtool: 'delay-up', 'delay-down', 'init-wait'; nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host'; arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active', 'validate-inactive', 'send-always'. See teamd.conf man for more details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_MCAST_REJOIN_COUNT N_("Corresponds to the teamd mcast_rejoin.count.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_MCAST_REJOIN_INTERVAL N_("Corresponds to the teamd mcast_rejoin.interval.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_NOTIFY_PEERS_COUNT N_("Corresponds to the teamd notify_peers.count.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_NOTIFY_PEERS_INTERVAL N_("Corresponds to the teamd notify_peers.interval.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER N_("Corresponds to the teamd runner.name. Permitted values are: \"roundrobin\", \"broadcast\", \"activebackup\", \"loadbalance\", \"lacp\", \"random\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_ACTIVE N_("Corresponds to the teamd runner.active.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY N_("Corresponds to the teamd runner.agg_select_policy.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_FAST_RATE N_("Corresponds to the teamd runner.fast_rate.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_HWADDR_POLICY N_("Corresponds to the teamd runner.hwaddr_policy.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_MIN_PORTS N_("Corresponds to the teamd runner.min_ports.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_SYS_PRIO N_("Corresponds to the teamd runner.sys_prio.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_TX_BALANCER N_("Corresponds to the teamd runner.tx_balancer.name.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL N_("Corresponds to the teamd runner.tx_balancer.interval.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_RUNNER_TX_HASH N_("Corresponds to the teamd runner.tx_hash.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_CONFIG N_("The JSON configuration for the team port. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_LACP_KEY N_("Corresponds to the teamd ports.PORTIFNAME.lacp_key.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_LACP_PRIO N_("Corresponds to the teamd ports.PORTIFNAME.lacp_prio.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_LINK_WATCHERS N_("Link watchers configuration for the connection: each link watcher is defined by a dictionary, whose keys depend upon the selected link watcher. Available link watchers are 'ethtool', 'nsna_ping' and 'arp_ping' and it is specified in the dictionary with the key 'name'. Available keys are: ethtool: 'delay-up', 'delay-down', 'init-wait'; nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host'; arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active', 'validate-inactive', 'send-always'. See teamd.conf man for more details.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_PRIO N_("Corresponds to the teamd ports.PORTIFNAME.prio.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_QUEUE_ID N_("Corresponds to the teamd ports.PORTIFNAME.queue_id. When set to -1 means the parameter is skipped from the json config.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_STICKY N_("Corresponds to the teamd ports.PORTIFNAME.sticky.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TUN_GROUP N_("The group ID which will own the device. If set to NULL everyone will be able to use the device.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TUN_MODE N_("The operating mode of the virtual device. Allowed values are NM_SETTING_TUN_MODE_TUN (1) to create a layer 3 device and NM_SETTING_TUN_MODE_TAP (2) to create an Ethernet-like layer 2 one.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TUN_MULTI_QUEUE N_("If the property is set to TRUE, the interface will support multiple file descriptors (queues) to parallelize packet sending or receiving. Otherwise, the interface will only support a single queue.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TUN_OWNER N_("The user ID which will own the device. If set to NULL everyone will be able to use the device.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TUN_PI N_("If TRUE the interface will prepend a 4 byte header describing the physical interface to the packets.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_TUN_VNET_HDR N_("If TRUE the IFF_VNET_HDR the tunnel packets will include a virtio network header.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_USER_DATA N_("A dictionary of key/value pairs with user data. This data is ignored by NetworkManager and can be used at the users discretion. The keys only support a strict ascii format, but the values can be arbitrary UTF8 strings up to a certain length.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VLAN_EGRESS_PRIORITY_MAP N_("For outgoing packets, a list of mappings from Linux SKB priorities to 802.1p priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VLAN_FLAGS N_("One or more flags which control the behavior and features of the VLAN interface. Flags include NM_VLAN_FLAG_REORDER_HEADERS (0x1) (reordering of output packet headers), NM_VLAN_FLAG_GVRP (0x2) (use of the GVRP protocol), and NM_VLAN_FLAG_LOOSE_BINDING (0x4) (loose binding of the interface to its master device's operating state). NM_VLAN_FLAG_MVRP (0x8) (use of the MVRP protocol). The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS, but it used to be 0. To preserve backward compatibility, the default-value in the D-Bus API continues to be 0 and a missing property on D-Bus is still considered as 0.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VLAN_ID N_("The VLAN identifier that the interface created by this connection should be assigned. The valid range is from 0 to 4094, without the reserved id 4095.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VLAN_INGRESS_PRIORITY_MAP N_("For incoming packets, a list of mappings from 802.1p priorities to Linux SKB priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VPN_DATA N_("Dictionary of key/value pairs of VPN plugin specific data. Both keys and values must be strings.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VPN_PERSISTENT N_("If the VPN service supports persistence, and this property is TRUE, the VPN will attempt to stay connected across link changes and outages, until explicitly disconnected.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VPN_SECRETS N_("Dictionary of key/value pairs of VPN plugin specific secrets like passwords or private keys. Both keys and values must be strings.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VPN_SERVICE_TYPE N_("D-Bus service name of the VPN plugin that this setting uses to connect to its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc plugin.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VPN_TIMEOUT N_("Timeout for the VPN service to establish the connection. Some services may take quite a long time to connect. Value of 0 means a default timeout, which is 60 seconds (unless overridden by vpn.timeout in configuration file). Values greater than zero mean timeout in seconds.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VPN_USER_NAME N_("If the VPN connection requires a user name for authentication, that name should be provided here. If the connection is available to more than one user, and the VPN requires each user to supply a different name, then leave this property empty. If this property is empty, NetworkManager will automatically supply the username of the user which requested the VPN connection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_AGEING N_("Specifies the lifetime in seconds of FDB entries learnt by the kernel.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_DESTINATION_PORT N_("Specifies the UDP destination port to communicate to the remote VXLAN tunnel endpoint.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_ID N_("Specifies the VXLAN Network Identifier (or VXLAN Segment Identifier) to use.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_L2_MISS N_("Specifies whether netlink LL ADDR miss notifications are generated.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_L3_MISS N_("Specifies whether netlink IP ADDR miss notifications are generated.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_LEARNING N_("Specifies whether unknown source link layer addresses and IP addresses are entered into the VXLAN device forwarding database.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_LIMIT N_("Specifies the maximum number of FDB entries. A value of zero means that the kernel will store unlimited entries.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_LOCAL N_("If given, specifies the source IP address to use in outgoing packets.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_PROXY N_("Specifies whether ARP proxy is turned on.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_REMOTE N_("Specifies the unicast destination IP address to use in outgoing packets when the destination link layer address is not known in the VXLAN device forwarding database, or the multicast IP address to join.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_RSC N_("Specifies whether route short circuit is turned on.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MAX N_("Specifies the maximum UDP source port to communicate to the remote VXLAN tunnel endpoint.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MIN N_("Specifies the minimum UDP source port to communicate to the remote VXLAN tunnel endpoint.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_TOS N_("Specifies the TOS value to use in outgoing packets.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_VXLAN_TTL N_("Specifies the time-to-live value to use in outgoing packets.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIFI_P2P_PEER N_("The P2P device that should be connected to. Currently this is the only way to create or join a group.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIFI_P2P_WFD_IES N_("The Wi-Fi Display (WFD) Information Elements (IEs) to set. Wi-Fi Display requires a protocol specific information element to be set in certain Wi-Fi frames. These can be specified here for the purpose of establishing a connection. This setting is only useful when implementing a Wi-Fi Display client.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIFI_P2P_WPS_METHOD N_("Flags indicating which mode of WPS is to be used. There's little point in changing the default setting as NetworkManager will automatically determine the best method to use.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIMAX_MAC_ADDRESS N_("If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing). Deprecated: 1")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIMAX_NETWORK_NAME N_("Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_FWMARK N_("The use of fwmark is optional and is by default off. Setting it to 0 disables it. Otherwise it is a 32-bit fwmark for outgoing packets. Note that \"ip4-auto-default-route\" or \"ip6-auto-default-route\" enabled, implies to automatically choose a fwmark.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_IP4_AUTO_DEFAULT_ROUTE N_("Whether to enable special handling of the IPv4 default route. If enabled, the IPv4 default route will be placed to a dedicated routing-table and two policy routing rules will be added. The fwmark number is also used as routing-table for the default-route, and if fwmark is zero, a unused fwmark/table is chosen automatically. This corresponds to what wg-quick does with Table=auto. Leaving this at the default will enable this option automatically if ipv4.never-default is not set and there are any peers that use a default-route as allowed-ips.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_IP6_AUTO_DEFAULT_ROUTE N_("Like ip4-auto-default-route, but for the IPv6 default route.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_LISTEN_PORT N_("The listen-port. If listen-port is not specified, the port will be chosen randomly when the interface comes up.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments. If zero a default MTU is used. Note that contrary to wg-quick's MTU setting, this does not take into account the current routes at the time of activation.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_PEER_ROUTES N_("Whether to automatically add routes for the AllowedIPs ranges of the peers. If TRUE (the default), NetworkManager will automatically add routes in the routing tables according to ipv4.route-table and ipv6.route-table. If FALSE, no such routes are added automatically. In this case, the user may want to configure static routes in ipv4.routes and ipv6.routes, respectively.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_PRIVATE_KEY N_("The 256 bit private-key in base64 encoding.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS N_("Flags indicating how to handle the \"private-key\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_CHANNEL N_("IEEE 802.15.4 channel. A positive integer or -1, meaning \"do not set, use whatever the device is already set to\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_MAC_ADDRESS N_("If specified, this connection will only apply to the IEEE 802.15.4 (WPAN) MAC layer device whose permanent MAC address matches.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_PAGE N_("IEEE 802.15.4 channel page. A positive integer or -1, meaning \"do not set, use whatever the device is already set to\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_PAN_ID N_("IEEE 802.15.4 Personal Area Network (PAN) identifier.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_WPAN_SHORT_ADDRESS N_("Short IEEE 802.15.4 address to be used within a restricted environment.")
|
||||
49
clients/common/settings-docs.xsl
Normal file
49
clients/common/settings-docs.xsl
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output
|
||||
method="text"
|
||||
doctype-public="-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
||||
/>
|
||||
|
||||
<xsl:template match="nm-setting-docs">/* Generated file. Do not edit. */
|
||||
|
||||
<xsl:apply-templates select="setting" mode="properties"><xsl:sort select="@name"/></xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="setting" mode="properties">
|
||||
<xsl:apply-templates select="property">
|
||||
<xsl:sort select="@name"/>
|
||||
<xsl:with-param name="setting_name_upper" select="@name_upper"/>
|
||||
</xsl:apply-templates>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="property">
|
||||
<xsl:param name="setting_name_upper" />
|
||||
<xsl:variable name="docs">
|
||||
<xsl:call-template name="escape_quotes">
|
||||
<xsl:with-param name="string" select="@description"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>#define DESCRIBE_DOC_NM_SETTING_<xsl:value-of select="$setting_name_upper"/>_<xsl:value-of select="@name_upper"/> N_("<xsl:value-of select="$docs"/>")
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="setting" mode="settings">
|
||||
{ "<xsl:value-of select="@name"/>", setting_<xsl:value-of select="translate(@name,'-','_')"/>, <xsl:value-of select="count(./property)"/> },</xsl:template>
|
||||
|
||||
<xsl:template name="escape_quotes">
|
||||
<xsl:param name="string" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($string, '"')">
|
||||
<xsl:value-of select="substring-before($string, '"')" />\"<xsl:call-template name="escape_quotes"><xsl:with-param name="string" select="substring-after($string, '"')" /></xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$string" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
43
clients/common/tests/meson.build
Normal file
43
clients/common/tests/meson.build
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
common_c_flags = clients_c_flags + ['-DNETWORKMANAGER_COMPILATION_TEST']
|
||||
|
||||
test_name = 'test-clients-common'
|
||||
|
||||
deps = [
|
||||
libnmc_base_dep,
|
||||
libnmc_dep,
|
||||
]
|
||||
|
||||
exe = executable(
|
||||
test_name,
|
||||
test_name + '.c',
|
||||
dependencies: deps,
|
||||
c_args: common_c_flags,
|
||||
)
|
||||
|
||||
test(
|
||||
'clients/common/tests/' + test_name,
|
||||
test_script,
|
||||
args: test_args + [exe.full_path()],
|
||||
)
|
||||
|
||||
test_name = 'test-libnm-core-aux'
|
||||
|
||||
deps = [
|
||||
libnm_dep,
|
||||
libnm_libnm_core_aux_dep,
|
||||
libnm_nm_default_dep,
|
||||
]
|
||||
|
||||
exe = executable(
|
||||
test_name,
|
||||
test_name + '.c',
|
||||
dependencies: deps,
|
||||
c_args: common_c_flags,
|
||||
link_with: libnm_systemd_logging_stub,
|
||||
)
|
||||
|
||||
test(
|
||||
'clients/common/tests/' + test_name,
|
||||
test_script,
|
||||
args: test_args + [exe.full_path()]
|
||||
)
|
||||
240
clients/common/tests/test-clients-common.c
Normal file
240
clients/common/tests/test-clients-common.c
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright (C) 2017 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-meta-setting-access.h"
|
||||
#include "nm-vpn-helpers.h"
|
||||
|
||||
#include "nm-utils/nm-test-utils.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
test_client_meta_check (void)
|
||||
{
|
||||
const NMMetaSettingInfoEditor *const*infos_p;
|
||||
NMMetaSettingType m;
|
||||
guint p;
|
||||
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaSettingInfoEditor, meta_type));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaPropertyInfo, meta_type));
|
||||
|
||||
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
|
||||
const NMMetaSettingInfo *info = &nm_meta_setting_infos[m];
|
||||
GType gtype;
|
||||
|
||||
g_assert (info);
|
||||
g_assert (info->meta_type == m);
|
||||
g_assert (info->setting_name);
|
||||
g_assert (info->get_setting_gtype);
|
||||
|
||||
gtype = info->get_setting_gtype ();
|
||||
g_assert (gtype != NM_TYPE_SETTING);
|
||||
|
||||
{
|
||||
nm_auto_unref_gtypeclass GTypeClass *gclass = g_type_class_ref (gtype);
|
||||
|
||||
g_assert (G_TYPE_CHECK_CLASS_TYPE (gclass, gtype));
|
||||
}
|
||||
{
|
||||
gs_unref_object NMSetting *setting = g_object_new (gtype, NULL);
|
||||
|
||||
g_assert (NM_IS_SETTING (setting));
|
||||
g_assert (G_TYPE_CHECK_INSTANCE_TYPE (setting, gtype));
|
||||
g_assert_cmpstr (nm_setting_get_name (setting), ==, info->setting_name);
|
||||
}
|
||||
}
|
||||
|
||||
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
|
||||
const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
|
||||
|
||||
g_assert (info);
|
||||
g_assert (info->meta_type == &nm_meta_type_setting_info_editor);
|
||||
g_assert (info->general);
|
||||
g_assert (info->general == &nm_meta_setting_infos[m]);
|
||||
|
||||
g_assert_cmpstr (info->general->setting_name, ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, FALSE));
|
||||
g_assert_cmpstr ("name", ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, TRUE));
|
||||
|
||||
g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties));
|
||||
|
||||
if (info->properties_num) {
|
||||
gs_unref_hashtable GHashTable *property_names = g_hash_table_new (nm_str_hash, g_str_equal);
|
||||
|
||||
g_assert (info->properties);
|
||||
for (p = 0; p < info->properties_num; p++) {
|
||||
const NMMetaPropertyInfo *pi = info->properties[p];
|
||||
|
||||
g_assert (pi);
|
||||
g_assert (pi->meta_type == &nm_meta_type_property_info);
|
||||
g_assert (pi->setting_info == info);
|
||||
g_assert (pi->property_name);
|
||||
|
||||
g_assert (g_hash_table_add (property_names, (gpointer) pi->property_name));
|
||||
|
||||
g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, FALSE));
|
||||
g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, TRUE));
|
||||
|
||||
g_assert (pi->property_type);
|
||||
g_assert (pi->property_type->get_fcn);
|
||||
}
|
||||
g_assert (!info->properties[info->properties_num]);
|
||||
} else
|
||||
g_assert (!info->properties);
|
||||
|
||||
if (info->valid_parts) {
|
||||
gsize i, l;
|
||||
gs_unref_hashtable GHashTable *dup = g_hash_table_new (nm_direct_hash, NULL);
|
||||
|
||||
l = NM_PTRARRAY_LEN (info->valid_parts);
|
||||
g_assert (l >= 2);
|
||||
|
||||
for (i = 0; info->valid_parts[i]; i++) {
|
||||
g_assert (info->valid_parts[i]->setting_info);
|
||||
g_assert (g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info));
|
||||
|
||||
if (i == 0) {
|
||||
g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]);
|
||||
g_assert (info->valid_parts[i]->mandatory);
|
||||
}
|
||||
if (i == 1) {
|
||||
g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[m]);
|
||||
g_assert (info->valid_parts[i]->mandatory);
|
||||
}
|
||||
}
|
||||
g_assert (i == l);
|
||||
}
|
||||
}
|
||||
|
||||
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
|
||||
const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
|
||||
|
||||
g_assert (nm_meta_setting_info_editor_find_by_name (info->general->setting_name, FALSE) == info);
|
||||
g_assert (nm_meta_setting_info_editor_find_by_gtype (info->general->get_setting_gtype ()) == info);
|
||||
|
||||
for (p = 0; p < info->properties_num; p++) {
|
||||
const NMMetaPropertyInfo *pi = info->properties[p];
|
||||
|
||||
g_assert (nm_meta_setting_info_editor_get_property_info (info, pi->property_name) == pi);
|
||||
g_assert (nm_meta_property_info_find_by_name (info->general->setting_name, pi->property_name) == pi);
|
||||
}
|
||||
}
|
||||
|
||||
infos_p = nm_meta_setting_infos_editor_p ();
|
||||
g_assert (infos_p);
|
||||
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++)
|
||||
g_assert (infos_p[m] == &nm_meta_setting_infos_editor[m]);
|
||||
g_assert (!infos_p[m]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
test_client_import_wireguard_test0 (void)
|
||||
{
|
||||
gs_unref_object NMConnection *connection;
|
||||
NMSettingWireGuard *s_wg;
|
||||
NMWireGuardPeer *peer;
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
connection = nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test0.conf",
|
||||
&error);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpstr (nm_connection_get_id (connection), ==, "wg-test0");
|
||||
g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "wg-test0");
|
||||
g_assert_cmpstr (nm_connection_get_connection_type (connection), ==, NM_SETTING_WIREGUARD_SETTING_NAME);
|
||||
|
||||
s_wg = NM_SETTING_WIREGUARD (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIREGUARD));
|
||||
|
||||
g_assert_cmpint (nm_setting_wireguard_get_listen_port (s_wg), ==, 51820);
|
||||
g_assert_cmpstr (nm_setting_wireguard_get_private_key (s_wg), ==, "yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=");
|
||||
|
||||
g_assert_cmpint (nm_setting_wireguard_get_peers_len (s_wg), ==, 3);
|
||||
|
||||
peer = nm_setting_wireguard_get_peer (s_wg, 0);
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_public_key (peer), ==, "xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=");
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_endpoint (peer), ==, "192.95.5.67:1234");
|
||||
g_assert_cmpint (nm_wireguard_peer_get_allowed_ips_len (peer), ==, 2);
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 0, NULL), ==, "10.192.122.3/32");
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 1, NULL), ==, "10.192.124.1/24");
|
||||
|
||||
peer = nm_setting_wireguard_get_peer (s_wg, 1);
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_public_key (peer), ==, "TrMvSoP4jYQlY6RIzBgbssQqY3vxI2Pi+y71lOWWXX0=");
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_endpoint (peer), ==, "[2607:5300:60:6b0::c05f:543]:2468");
|
||||
g_assert_cmpint (nm_wireguard_peer_get_allowed_ips_len (peer), ==, 2);
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 0, NULL), ==, "10.192.122.4/32");
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 1, NULL), ==, "192.168.0.0/16");
|
||||
|
||||
peer = nm_setting_wireguard_get_peer (s_wg, 2);
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_public_key (peer), ==, "gN65BkIKy1eCE9pP1wdc8ROUtkHLF2PfAqYdyYBz6EA=");
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_endpoint (peer), ==, "test.wireguard.com:18981");
|
||||
g_assert_cmpint (nm_wireguard_peer_get_allowed_ips_len (peer), ==, 1);
|
||||
g_assert_cmpstr (nm_wireguard_peer_get_allowed_ip (peer, 0, NULL), ==, "10.10.10.230/32");
|
||||
}
|
||||
|
||||
static void
|
||||
test_client_import_wireguard_test1 (void)
|
||||
{
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test1.conf", &error);
|
||||
g_assert_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
|
||||
g_assert (g_str_has_prefix (error->message, "invalid secret 'PrivateKey'"));
|
||||
g_assert (g_str_has_suffix (error->message, "wg-test1.conf:2"));
|
||||
}
|
||||
|
||||
static void
|
||||
test_client_import_wireguard_test2 (void)
|
||||
{
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test2.conf", &error);
|
||||
|
||||
g_assert_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
|
||||
g_assert (g_str_has_prefix (error->message, "unrecognized line at"));
|
||||
g_assert (g_str_has_suffix (error->message, "wg-test2.conf:5"));
|
||||
}
|
||||
|
||||
static void
|
||||
test_client_import_wireguard_test3 (void)
|
||||
{
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-test3.conf", &error);
|
||||
g_assert_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT);
|
||||
g_assert (g_str_has_prefix (error->message, "invalid value for 'ListenPort'"));
|
||||
g_assert (g_str_has_suffix (error->message, "wg-test3.conf:3"));
|
||||
}
|
||||
|
||||
static void
|
||||
test_client_import_wireguard_missing (void)
|
||||
{
|
||||
gs_free_error GError *error = NULL;
|
||||
|
||||
nm_vpn_wireguard_import (NM_BUILD_SRCDIR"/clients/common/tests/wg-missing.conf", &error);
|
||||
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMTST_DEFINE ();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
nmtst_init (&argc, &argv, TRUE);
|
||||
|
||||
g_test_add_func ("/client/meta/check", test_client_meta_check);
|
||||
g_test_add_func ("/client/import/wireguard/test0", test_client_import_wireguard_test0);
|
||||
g_test_add_func ("/client/import/wireguard/test1", test_client_import_wireguard_test1);
|
||||
g_test_add_func ("/client/import/wireguard/test2", test_client_import_wireguard_test2);
|
||||
g_test_add_func ("/client/import/wireguard/test3", test_client_import_wireguard_test3);
|
||||
g_test_add_func ("/client/import/wireguard/missing", test_client_import_wireguard_missing);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
236
clients/common/tests/test-libnm-core-aux.c
Normal file
236
clients/common/tests/test-libnm-core-aux.c
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
// SPDX-License-Identifier: LGPL-2.1+
|
||||
/*
|
||||
* Copyright (C) 2019 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-libnm-core-aux/nm-libnm-core-aux.h"
|
||||
#include "nm-libnm-core-intern/nm-libnm-core-utils.h"
|
||||
|
||||
#include "nm-utils/nm-test-utils.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMTeamLinkWatcher *
|
||||
_team_link_watcher_from_string_impl (const char *str, gsize nextra, const char *const*vextra)
|
||||
{
|
||||
NMTeamLinkWatcher *watcher;
|
||||
gs_free char *str1_free = NULL;
|
||||
gs_free_error GError *error = NULL;
|
||||
gsize i;
|
||||
|
||||
g_assert (str);
|
||||
|
||||
watcher = nm_utils_team_link_watcher_from_string (str, &error);
|
||||
nmtst_assert_success (watcher, error);
|
||||
|
||||
for (i = 0; i < 1 + nextra; i++) {
|
||||
nm_auto_unref_team_link_watcher NMTeamLinkWatcher *watcher1 = NULL;
|
||||
const char *str1;
|
||||
|
||||
if (i == 0) {
|
||||
str1_free = nm_utils_team_link_watcher_to_string (watcher);
|
||||
g_assert (str1_free);
|
||||
str1 = str1_free;
|
||||
g_assert_cmpstr (str, ==, str1);
|
||||
} else
|
||||
str1 = vextra[i - 1];
|
||||
|
||||
watcher1 = nm_utils_team_link_watcher_from_string (str1, &error);
|
||||
nmtst_assert_success (watcher1, error);
|
||||
if (!nm_team_link_watcher_equal (watcher, watcher1)) {
|
||||
gs_free char *ss1 = NULL;
|
||||
gs_free char *ss2 = NULL;
|
||||
|
||||
g_print (">>> watcher differs: \"%s\" vs. \"%s\"",
|
||||
(ss1 = nm_utils_team_link_watcher_to_string (watcher)),
|
||||
(ss2 = nm_utils_team_link_watcher_to_string (watcher1)));
|
||||
g_print (">>> ORIG: \"%s\" vs. \"%s\"", str, str1);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
g_assert (nm_team_link_watcher_equal (watcher1, watcher));
|
||||
}
|
||||
|
||||
return watcher;
|
||||
}
|
||||
#define _team_link_watcher_from_string(str, ...) \
|
||||
_team_link_watcher_from_string_impl ((str), NM_NARG (__VA_ARGS__), NM_MAKE_STRV (__VA_ARGS__))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
test_team_link_watcher_tofro_string (void)
|
||||
{
|
||||
nm_auto_unref_team_link_watcher NMTeamLinkWatcher *w = NULL;
|
||||
|
||||
#define _team_link_watcher_cmp(watcher, \
|
||||
name, \
|
||||
delay_down, \
|
||||
delay_up, \
|
||||
init_wait, \
|
||||
interval, \
|
||||
missed_max, \
|
||||
target_host, \
|
||||
source_host, \
|
||||
vlanid, \
|
||||
arping_flags) \
|
||||
G_STMT_START { \
|
||||
nm_auto_unref_team_link_watcher NMTeamLinkWatcher *_w = g_steal_pointer (watcher); \
|
||||
\
|
||||
g_assert_cmpstr ((name), ==, nm_team_link_watcher_get_name (_w)); \
|
||||
g_assert_cmpint ((delay_down), ==, nm_team_link_watcher_get_delay_down (_w)); \
|
||||
g_assert_cmpint ((delay_up), ==, nm_team_link_watcher_get_delay_up (_w)); \
|
||||
g_assert_cmpint ((init_wait), ==, nm_team_link_watcher_get_init_wait (_w)); \
|
||||
g_assert_cmpint ((interval), ==, nm_team_link_watcher_get_interval (_w)); \
|
||||
g_assert_cmpint ((missed_max), ==, nm_team_link_watcher_get_missed_max (_w)); \
|
||||
g_assert_cmpstr ((target_host), ==, nm_team_link_watcher_get_target_host (_w)); \
|
||||
g_assert_cmpstr ((source_host), ==, nm_team_link_watcher_get_source_host (_w)); \
|
||||
g_assert_cmpint ((vlanid), ==, nm_team_link_watcher_get_vlanid (_w)); \
|
||||
g_assert_cmpint ((arping_flags), ==, nm_team_link_watcher_get_flags (_w)); \
|
||||
} G_STMT_END
|
||||
|
||||
w = _team_link_watcher_from_string ("name=ethtool",
|
||||
"delay-up=0 name=ethtool",
|
||||
" delay-down=0 name=ethtool ");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"ethtool",
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
NULL,
|
||||
-1,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=ethtool delay-up=10",
|
||||
" delay-down=0 delay-up=10 name=ethtool");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"ethtool",
|
||||
0,
|
||||
10,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
NULL,
|
||||
-1,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=ethtool delay-up=10 delay-down=11",
|
||||
" delay-down=11 delay-up=10 name=ethtool");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"ethtool",
|
||||
11,
|
||||
10,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
NULL,
|
||||
NULL,
|
||||
-1,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=nsna_ping target-host=xxx",
|
||||
"name=nsna_ping target-host=xxx",
|
||||
" missed-max=3 target-host=xxx name=nsna_ping ");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"nsna_ping",
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
"xxx",
|
||||
NULL,
|
||||
-1,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=arp_ping target-host=xxx source-host=yzd",
|
||||
" source-host=yzd target-host=xxx name=arp_ping ");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"arp_ping",
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
"xxx",
|
||||
"yzd",
|
||||
-1,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=arp_ping missed-max=0 target-host=xxx vlanid=0 source-host=yzd");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"arp_ping",
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"xxx",
|
||||
"yzd",
|
||||
0,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=arp_ping target-host=xxx source-host=yzd validate-active=true",
|
||||
"source-host=yzd send-always=false name=arp_ping validate-active=true validate-inactive=false target-host=xxx",
|
||||
" source-host=yzd target-host=xxx validate-active=true name=arp_ping ");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"arp_ping",
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
"xxx",
|
||||
"yzd",
|
||||
-1,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=arp_ping target-host=xxx source-host=yzd validate-active=true validate-inactive=true send-always=true",
|
||||
"source-host=yzd send-always=true name=arp_ping validate-active=true validate-inactive=true target-host=xxx",
|
||||
"source-host=yzd send-always=true name=arp_ping validate-active=1 validate-inactive=yes target-host=xxx",
|
||||
" source-host=yzd target-host=xxx validate-inactive=true send-always=true validate-active=true name=arp_ping ");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"arp_ping",
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
"xxx",
|
||||
"yzd",
|
||||
-1,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_ACTIVE
|
||||
| NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_VALIDATE_INACTIVE
|
||||
| NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_SEND_ALWAYS);
|
||||
|
||||
w = _team_link_watcher_from_string ("name=arp_ping missed-max=0 target-host=xxx vlanid=0 source-host=yzd");
|
||||
_team_link_watcher_cmp (&w,
|
||||
"arp_ping",
|
||||
-1,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"xxx",
|
||||
"yzd",
|
||||
0,
|
||||
NM_TEAM_LINK_WATCHER_ARP_PING_FLAG_NONE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMTST_DEFINE ();
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
nmtst_init (&argc, &argv, TRUE);
|
||||
|
||||
g_test_add_func ("/libnm-core-aux/test_team_link_watcher_tofro_string", test_team_link_watcher_tofro_string);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
18
clients/common/tests/wg-test0.conf
Normal file
18
clients/common/tests/wg-test0.conf
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[Interface]
|
||||
PrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=
|
||||
ListenPort = 51820
|
||||
|
||||
[Peer]
|
||||
PublicKey = xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=
|
||||
Endpoint = 192.95.5.67:1234
|
||||
AllowedIPs = 10.192.122.3/32, 10.192.124.1/24
|
||||
|
||||
[Peer]
|
||||
PublicKey = TrMvSoP4jYQlY6RIzBgbssQqY3vxI2Pi+y71lOWWXX0=
|
||||
Endpoint = [2607:5300:60:6b0::c05f:543]:2468
|
||||
AllowedIPs = 10.192.122.4/32, 192.168.0.0/16
|
||||
|
||||
[Peer]
|
||||
PublicKey = gN65BkIKy1eCE9pP1wdc8ROUtkHLF2PfAqYdyYBz6EA=
|
||||
Endpoint = test.wireguard.com:18981
|
||||
AllowedIPs = 10.10.10.230/32
|
||||
3
clients/common/tests/wg-test1.conf
Normal file
3
clients/common/tests/wg-test1.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[Interface]
|
||||
PrivateKey = bad
|
||||
ListenPort = 51820
|
||||
8
clients/common/tests/wg-test2.conf
Normal file
8
clients/common/tests/wg-test2.conf
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[Interface]
|
||||
PrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=
|
||||
ListenPort = 51820
|
||||
|
||||
[Beer]
|
||||
PublicKey = xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=
|
||||
Endpoint = 192.95.5.67:1234
|
||||
AllowedIPs = 10.192.122.3/32, 10.192.124.1/24
|
||||
3
clients/common/tests/wg-test3.conf
Normal file
3
clients/common/tests/wg-test3.conf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[Interface]
|
||||
PrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=
|
||||
ListenPort = 666666666
|
||||
28
clients/meson.build
Normal file
28
clients/meson.build
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
clients_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT']
|
||||
|
||||
name = 'nm-online'
|
||||
|
||||
deps = [
|
||||
libnm_dep,
|
||||
libnm_nm_default_dep,
|
||||
]
|
||||
|
||||
executable(
|
||||
name,
|
||||
name + '.c',
|
||||
dependencies: deps,
|
||||
c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)],
|
||||
link_args: ldflags_linker_script_binary,
|
||||
link_depends: linker_script_binary,
|
||||
install: true,
|
||||
)
|
||||
|
||||
subdir('common')
|
||||
|
||||
if enable_nmcli
|
||||
subdir('cli')
|
||||
endif
|
||||
|
||||
if enable_nmtui
|
||||
subdir('tui')
|
||||
endif
|
||||
|
|
@ -1,22 +1,7 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||
* Copyright (C) 2008 - 2014 Red Hat, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -24,138 +9,238 @@
|
|||
*
|
||||
* Return values:
|
||||
*
|
||||
* 0 : already online or connection established within given timeout
|
||||
* 1 : offline or not online within given timeout
|
||||
* 2 : unspecified error
|
||||
* 0: already online or connection established within given timeout
|
||||
* 1: offline or not online within given timeout
|
||||
* 2: unspecified error
|
||||
*
|
||||
* Robert Love <rml@novell.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "nm-default.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include <NetworkManager.h>
|
||||
|
||||
#define PROGRESS_STEPS 15
|
||||
#define WAIT_STARTUP_TAG "wait-startup"
|
||||
|
||||
#define EXIT_NONE -1
|
||||
#define EXIT_FAILURE_OFFLINE 1
|
||||
#define EXIT_FAILURE_ERROR 2
|
||||
#define EXIT_FAILURE_LIBNM_BUG 42
|
||||
#define EXIT_FAILURE_UNSPECIFIED 43
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GMainLoop *loop;
|
||||
NMClient *client;
|
||||
GCancellable *client_new_cancellable;
|
||||
guint client_new_timeout_id;
|
||||
guint handle_timeout_id;
|
||||
gulong client_notify_id;
|
||||
gboolean exit_no_nm;
|
||||
gboolean wait_startup;
|
||||
gboolean quiet;
|
||||
gint64 start_timestamp_ms;
|
||||
gint64 end_timestamp_ms;
|
||||
gint64 progress_step_duration;
|
||||
gboolean quiet;
|
||||
} Timeout;
|
||||
int retval;
|
||||
} OnlineData;
|
||||
|
||||
static gint64
|
||||
_now_ms (void)
|
||||
{
|
||||
return g_get_monotonic_time () / (G_USEC_PER_SEC / 1000);
|
||||
}
|
||||
|
||||
static void
|
||||
_return (OnlineData *data, int retval)
|
||||
{
|
||||
nm_assert (data);
|
||||
nm_assert (data->retval == EXIT_FAILURE_UNSPECIFIED);
|
||||
|
||||
data->retval = retval;
|
||||
nm_clear_g_signal_handler (data->client, &data->client_notify_id);
|
||||
g_main_loop_quit (data->loop);
|
||||
}
|
||||
|
||||
static void
|
||||
_print_progress (gboolean wait_startup, int progress_next_step_i, gint64 remaining_ms, int retval)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
j = progress_next_step_i < 0 ? PROGRESS_STEPS : progress_next_step_i;
|
||||
|
||||
g_print ("\r%s", _("Connecting"));
|
||||
for (i = 0; i < PROGRESS_STEPS; i++)
|
||||
putchar (i < j ? '.' : ' ');
|
||||
g_print (" %4lds", (long) (MAX (0, remaining_ms + 999) / 1000));
|
||||
if (retval != EXIT_NONE) {
|
||||
const char *result;
|
||||
|
||||
if (wait_startup) {
|
||||
if (retval == EXIT_SUCCESS)
|
||||
result = "started";
|
||||
else if (retval == EXIT_FAILURE_OFFLINE)
|
||||
result = "startup-pending";
|
||||
else
|
||||
result = "failure";
|
||||
}
|
||||
else {
|
||||
if (retval == EXIT_SUCCESS)
|
||||
result = "online";
|
||||
else
|
||||
result = "offline";
|
||||
}
|
||||
|
||||
g_print (" [%s]\n", result);
|
||||
}
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
quit_if_connected (OnlineData *data)
|
||||
{
|
||||
NMState state;
|
||||
|
||||
state = nm_client_get_state (data->client);
|
||||
if (!nm_client_get_nm_running (data->client)) {
|
||||
if (data->exit_no_nm) {
|
||||
_return (data, EXIT_FAILURE_OFFLINE);
|
||||
return TRUE;
|
||||
}
|
||||
} else if (data->wait_startup) {
|
||||
if (!nm_client_get_startup (data->client)) {
|
||||
_return (data, EXIT_SUCCESS);
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
if ( state == NM_STATE_CONNECTED_LOCAL
|
||||
|| state == NM_STATE_CONNECTED_SITE
|
||||
|| state == NM_STATE_CONNECTED_GLOBAL) {
|
||||
_return (data, EXIT_SUCCESS);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (data->exit_no_nm && (state != NM_STATE_CONNECTING)) {
|
||||
_return (data, EXIT_FAILURE_OFFLINE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
client_properties_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer loop)
|
||||
gpointer user_data)
|
||||
{
|
||||
NMClient *client = NM_CLIENT (object);
|
||||
NMState state;
|
||||
gboolean wait_startup = GPOINTER_TO_UINT (g_object_get_data (object, WAIT_STARTUP_TAG));
|
||||
|
||||
if (!nm_client_get_nm_running (client))
|
||||
return;
|
||||
|
||||
if (wait_startup) {
|
||||
if (!nm_client_get_startup (client))
|
||||
g_main_loop_quit (loop);
|
||||
} else {
|
||||
state = nm_client_get_state (client);
|
||||
if ( state == NM_STATE_CONNECTED_LOCAL
|
||||
|| state == NM_STATE_CONNECTED_SITE
|
||||
|| state == NM_STATE_CONNECTED_GLOBAL)
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
quit_if_connected (user_data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_timeout (gpointer data)
|
||||
handle_timeout (gpointer user_data)
|
||||
{
|
||||
const Timeout *timeout = data;
|
||||
const gint64 now = g_get_monotonic_time () / (G_USEC_PER_SEC / 1000);
|
||||
gint64 remaining_ms = timeout->end_timestamp_ms - now;
|
||||
const gint64 elapsed_ms = now - timeout->start_timestamp_ms;
|
||||
OnlineData *data = user_data;
|
||||
const gint64 now = _now_ms ();
|
||||
gint64 remaining_ms = data->end_timestamp_ms - now;
|
||||
const gint64 elapsed_ms = now - data->start_timestamp_ms;
|
||||
int progress_next_step_i = 0;
|
||||
|
||||
if (!timeout->quiet) {
|
||||
int i;
|
||||
|
||||
/* calculate the next step (not the current): floor()+1 */
|
||||
progress_next_step_i = (elapsed_ms / timeout->progress_step_duration) + 1;
|
||||
progress_next_step_i = MIN (progress_next_step_i, PROGRESS_STEPS);
|
||||
|
||||
g_print (_("\rConnecting"));
|
||||
for (i = 0; i < PROGRESS_STEPS; i++)
|
||||
putchar (i < progress_next_step_i ? '.' : ' ');
|
||||
g_print (" %4lds", (long) (MAX (0, remaining_ms) / 1000));
|
||||
fflush (stdout);
|
||||
}
|
||||
data->handle_timeout_id = 0;
|
||||
|
||||
if (remaining_ms <= 3) {
|
||||
if (!timeout->quiet)
|
||||
g_print ("\n");
|
||||
exit (1);
|
||||
_return (data, EXIT_FAILURE_OFFLINE);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
if (!timeout->quiet) {
|
||||
if (!data->quiet) {
|
||||
gint64 rem;
|
||||
|
||||
/* calculate the next step (not the current): floor()+1 */
|
||||
progress_next_step_i = NM_MIN ((elapsed_ms / data->progress_step_duration) + 1, PROGRESS_STEPS);
|
||||
_print_progress (data->wait_startup, progress_next_step_i, remaining_ms, EXIT_NONE);
|
||||
|
||||
/* synchronize the timeout with the ticking of the seconds. */
|
||||
rem = remaining_ms % 1000;
|
||||
if (rem <= 3)
|
||||
rem = rem + G_USEC_PER_SEC;
|
||||
rem = rem + 10; /* add small offset to awake a bit after the second ticks */
|
||||
if (remaining_ms > rem)
|
||||
remaining_ms = rem;
|
||||
/* add small offset to awake a bit after the second ticks */
|
||||
remaining_ms = NM_MIN (remaining_ms, rem + 10);
|
||||
|
||||
/* synchronize the timeout with the steps of the progress bar. */
|
||||
rem = (progress_next_step_i * timeout->progress_step_duration) - elapsed_ms;
|
||||
rem = (progress_next_step_i * data->progress_step_duration) - elapsed_ms;
|
||||
if (rem <= 3)
|
||||
rem = rem + timeout->progress_step_duration;
|
||||
rem = rem + 10; /* add small offset to awake a bit after the time out */
|
||||
if (remaining_ms > rem)
|
||||
remaining_ms = rem;
|
||||
rem = rem + data->progress_step_duration;
|
||||
/* add small offset to awake a bit after the second ticks */
|
||||
remaining_ms = NM_MIN (remaining_ms, rem + 10);
|
||||
}
|
||||
|
||||
g_timeout_add (remaining_ms, handle_timeout, (void *) timeout);
|
||||
data->handle_timeout_id = g_timeout_add (remaining_ms, handle_timeout, data);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
got_client_timeout (gpointer user_data)
|
||||
{
|
||||
OnlineData *data = user_data;
|
||||
|
||||
data->client_new_timeout_id = 0;
|
||||
data->quiet = TRUE;
|
||||
g_printerr (_("Error: timeout creating NMClient object\n"));
|
||||
_return (data, EXIT_FAILURE_LIBNM_BUG);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
got_client (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
||||
{
|
||||
OnlineData *data = user_data;
|
||||
gs_free_error GError *error = NULL;
|
||||
NMClient *client;
|
||||
|
||||
nm_clear_g_source (&data->client_new_timeout_id);
|
||||
g_clear_object (&data->client_new_cancellable);
|
||||
|
||||
client = nm_client_new_finish (res, &error);
|
||||
if (!client) {
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
return;
|
||||
data->quiet = TRUE;
|
||||
g_printerr (_("Error: Could not create NMClient object: %s\n"),
|
||||
error->message);
|
||||
_return (data, EXIT_FAILURE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
data->client = client;
|
||||
|
||||
if (quit_if_connected (data))
|
||||
return;
|
||||
|
||||
data->client_notify_id = g_signal_connect (data->client, "notify",
|
||||
G_CALLBACK (client_properties_changed), data);
|
||||
data->handle_timeout_id = g_timeout_add (data->quiet ? NM_MAX (0, data->end_timestamp_ms - _now_ms ()) : 0, handle_timeout, data);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
OnlineData data = {
|
||||
.retval = EXIT_FAILURE_UNSPECIFIED,
|
||||
};
|
||||
int t_secs = 30;
|
||||
gboolean exit_no_nm = FALSE;
|
||||
gboolean wait_startup = FALSE;
|
||||
Timeout timeout;
|
||||
GOptionContext *opt_ctx = NULL;
|
||||
gboolean success;
|
||||
NMClient *client;
|
||||
NMState state = NM_STATE_UNKNOWN;
|
||||
GMainLoop *loop;
|
||||
gint64 remaining_ms;
|
||||
GError *error = NULL;
|
||||
|
||||
GOptionEntry options[] = {
|
||||
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &data.quiet, N_("Don't print anything"), NULL},
|
||||
{"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &data.wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
|
||||
{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (without the option, default value is 30)"), "<timeout>"},
|
||||
{"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL},
|
||||
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &timeout.quiet, N_("Don't print anything"), NULL},
|
||||
{"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
|
||||
{NULL}
|
||||
{"exit", 'x', 0, G_OPTION_ARG_NONE, &data.exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL},
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
timeout.start_timestamp_ms = g_get_monotonic_time () / (G_USEC_PER_SEC / 1000);
|
||||
timeout.quiet = FALSE;
|
||||
|
||||
/* Set locale to be able to use environment variables */
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
|
|
@ -163,6 +248,8 @@ main (int argc, char *argv[])
|
|||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
data.start_timestamp_ms = _now_ms ();
|
||||
|
||||
opt_ctx = g_option_context_new (NULL);
|
||||
g_option_context_set_translation_domain (opt_ctx, GETTEXT_PACKAGE);
|
||||
g_option_context_set_ignore_unknown_options (opt_ctx, FALSE);
|
||||
|
|
@ -178,72 +265,40 @@ main (int argc, char *argv[])
|
|||
if (!success) {
|
||||
g_printerr ("%s: %s\n", argv[0],
|
||||
_("Invalid option. Please use --help to see a list of valid options."));
|
||||
return 2;
|
||||
return EXIT_FAILURE_ERROR;
|
||||
}
|
||||
|
||||
if (t_secs < 0 || t_secs > 3600) {
|
||||
g_printerr ("%s: %s\n", argv[0],
|
||||
_("Invalid option. Please use --help to see a list of valid options."));
|
||||
return 2;
|
||||
}
|
||||
remaining_ms = t_secs * 1000;
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 35, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
client = nm_client_new (NULL, &error);
|
||||
if (!client) {
|
||||
g_printerr (_("Error: Could not create NMClient object: %s."), error->message);
|
||||
g_error_free (error);
|
||||
return 2;
|
||||
return EXIT_FAILURE_ERROR;
|
||||
}
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
if (t_secs == 0)
|
||||
data.quiet = TRUE;
|
||||
|
||||
g_object_set_data (G_OBJECT (client), WAIT_STARTUP_TAG, GUINT_TO_POINTER (wait_startup));
|
||||
state = nm_client_get_state (client);
|
||||
if (!nm_client_get_nm_running (client)) {
|
||||
if (exit_no_nm) {
|
||||
g_object_unref (client);
|
||||
return 1;
|
||||
}
|
||||
} else if (wait_startup) {
|
||||
if (!nm_client_get_startup (client)) {
|
||||
g_object_unref (client);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if ( state == NM_STATE_CONNECTED_LOCAL
|
||||
|| state == NM_STATE_CONNECTED_SITE
|
||||
|| state == NM_STATE_CONNECTED_GLOBAL) {
|
||||
g_object_unref (client);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (exit_no_nm && (state != NM_STATE_CONNECTING)) {
|
||||
g_object_unref (client);
|
||||
return 1;
|
||||
}
|
||||
data.loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
if (remaining_ms == 0) {
|
||||
g_object_unref (client);
|
||||
return 1;
|
||||
}
|
||||
data.end_timestamp_ms = data.start_timestamp_ms + (t_secs * 1000);
|
||||
data.progress_step_duration = NM_MAX (1, (data.end_timestamp_ms - data.start_timestamp_ms + PROGRESS_STEPS/2) / PROGRESS_STEPS);
|
||||
|
||||
g_signal_connect (client, "notify",
|
||||
G_CALLBACK (client_properties_changed), loop);
|
||||
data.client_new_cancellable = g_cancellable_new ();
|
||||
|
||||
timeout.end_timestamp_ms = timeout.start_timestamp_ms + remaining_ms;
|
||||
timeout.progress_step_duration = (timeout.end_timestamp_ms - timeout.start_timestamp_ms + PROGRESS_STEPS/2) / PROGRESS_STEPS;
|
||||
data.client_new_timeout_id = g_timeout_add_seconds (30, got_client_timeout, &data);
|
||||
nm_client_new_async (data.client_new_cancellable, got_client, &data);
|
||||
|
||||
g_timeout_add (timeout.quiet ? remaining_ms : 0,
|
||||
handle_timeout, &timeout);
|
||||
g_main_loop_run (data.loop);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
g_main_loop_unref (loop);
|
||||
nm_clear_g_cancellable (&data.client_new_cancellable);
|
||||
nm_clear_g_source (&data.client_new_timeout_id);
|
||||
nm_clear_g_source (&data.handle_timeout_id);
|
||||
nm_clear_g_signal_handler (data.client, &data.client_notify_id);
|
||||
g_clear_object (&data.client);
|
||||
|
||||
g_object_unref (client);
|
||||
g_clear_pointer (&data.loop, g_main_loop_unref);
|
||||
|
||||
return 0;
|
||||
if (!data.quiet)
|
||||
_print_progress (data.wait_startup, -1, NM_MAX (0, data.end_timestamp_ms - _now_ms ()), data.retval);
|
||||
|
||||
return data.retval;
|
||||
}
|
||||
|
|
|
|||
0
clients/tests/terminal-colors.d/nmcli.enable
Normal file
0
clients/tests/terminal-colors.d/nmcli.enable
Normal file
0
clients/tests/terminal-colors.d/nmcli.schem
Normal file
0
clients/tests/terminal-colors.d/nmcli.schem
Normal file
1362
clients/tests/test-client.check-on-disk/test_001.expected
Normal file
1362
clients/tests/test-client.check-on-disk/test_001.expected
Normal file
File diff suppressed because it is too large
Load diff
570
clients/tests/test-client.check-on-disk/test_002.expected
Normal file
570
clients/tests/test-client.check-on-disk/test_002.expected
Normal file
|
|
@ -0,0 +1,570 @@
|
|||
size: 373
|
||||
location: clients/tests/test-client.py:test_002()/1
|
||||
cmd: $NMCLI d
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 258 bytes
|
||||
>>>
|
||||
DEVICE TYPE STATE CONNECTION
|
||||
eth0 ethernet unavailable --
|
||||
eth1 ethernet unavailable --
|
||||
wlan0 wifi unavailable --
|
||||
wlan1 wifi unavailable --
|
||||
wlan1 wifi unavailable --
|
||||
|
||||
<<<
|
||||
size: 388
|
||||
location: clients/tests/test-client.py:test_002()/2
|
||||
cmd: $NMCLI d
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 263 bytes
|
||||
>>>
|
||||
DEVICE TYPE STATE CONNECTION
|
||||
eth0 ethernet niedostępne --
|
||||
eth1 ethernet niedostępne --
|
||||
wlan0 wifi niedostępne --
|
||||
wlan1 wifi niedostępne --
|
||||
wlan1 wifi niedostępne --
|
||||
|
||||
<<<
|
||||
size: 974
|
||||
location: clients/tests/test-client.py:test_002()/3
|
||||
cmd: $NMCLI -f all d
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 852 bytes
|
||||
>>>
|
||||
DEVICE TYPE STATE IP4-CONNECTIVITY IP6-CONNECTIVITY DBUS-PATH CONNECTION CON-UUID CON-PATH
|
||||
eth0 ethernet unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/1 -- -- --
|
||||
eth1 ethernet unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/2 -- -- --
|
||||
wlan0 wifi unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/3 -- -- --
|
||||
wlan1 wifi unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/4 -- -- --
|
||||
wlan1 wifi unavailable unknown unknown /org/freedesktop/NetworkManager/Devices/5 -- -- --
|
||||
|
||||
<<<
|
||||
size: 989
|
||||
location: clients/tests/test-client.py:test_002()/4
|
||||
cmd: $NMCLI -f all d
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 857 bytes
|
||||
>>>
|
||||
DEVICE TYPE STATE IP4-CONNECTIVITY IP6-CONNECTIVITY DBUS-PATH CONNECTION CON-UUID CON-PATH
|
||||
eth0 ethernet niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/1 -- -- --
|
||||
eth1 ethernet niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/2 -- -- --
|
||||
wlan0 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/3 -- -- --
|
||||
wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/4 -- -- --
|
||||
wlan1 wifi niedostępne nieznane nieznane /org/freedesktop/NetworkManager/Devices/5 -- -- --
|
||||
|
||||
<<<
|
||||
size: 735
|
||||
location: clients/tests/test-client.py:test_002()/5
|
||||
cmd: $NMCLI
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 621 bytes
|
||||
>>>
|
||||
eth0: unavailable
|
||||
"eth0"
|
||||
ethernet (virtual), 65:2E:D3:9E:0A:0D, hw
|
||||
|
||||
eth1: unavailable
|
||||
"eth1"
|
||||
ethernet (virtual), 47:D5:6B:65:FD:6A, hw
|
||||
|
||||
wlan0: unavailable
|
||||
"wlan0"
|
||||
wifi (virtual), 3D:99:1D:8B:74:4D, hw
|
||||
|
||||
wlan1: unavailable
|
||||
"wlan1"
|
||||
wifi (virtual), 99:09:77:FD:FE:1D, hw
|
||||
|
||||
wlan1: unavailable
|
||||
"wlan1"
|
||||
wifi (virtual), 5D:30:4A:EC:3F:61, hw
|
||||
|
||||
DNS configuration:
|
||||
servers: 1.2.3.4 5.6.7.8
|
||||
|
||||
Use "nmcli device show" to get complete information about known devices and
|
||||
"nmcli connection show" to get an overview on active connection profiles.
|
||||
|
||||
Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.
|
||||
|
||||
<<<
|
||||
size: 808
|
||||
location: clients/tests/test-client.py:test_002()/6
|
||||
cmd: $NMCLI
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 684 bytes
|
||||
>>>
|
||||
eth0: niedostępne
|
||||
"eth0"
|
||||
ethernet (virtual), 65:2E:D3:9E:0A:0D, sprzęt
|
||||
|
||||
eth1: niedostępne
|
||||
"eth1"
|
||||
ethernet (virtual), 47:D5:6B:65:FD:6A, sprzęt
|
||||
|
||||
wlan0: niedostępne
|
||||
"wlan0"
|
||||
wifi (virtual), 3D:99:1D:8B:74:4D, sprzęt
|
||||
|
||||
wlan1: niedostępne
|
||||
"wlan1"
|
||||
wifi (virtual), 99:09:77:FD:FE:1D, sprzęt
|
||||
|
||||
wlan1: niedostępne
|
||||
"wlan1"
|
||||
wifi (virtual), 5D:30:4A:EC:3F:61, sprzęt
|
||||
|
||||
DNS configuration:
|
||||
servers: 1.2.3.4 5.6.7.8
|
||||
|
||||
Polecenie „nmcli device show” wyświetli pełne informacje o znanych
|
||||
urządzeniach, a „nmcli connection show” wyświetli przegląd aktywnych
|
||||
profili połączeń.
|
||||
|
||||
Strony podręcznika nmcli(1) i nmcli-examples(7) zawierają pełne informacje
|
||||
o użyciu.
|
||||
|
||||
<<<
|
||||
size: 1420
|
||||
location: clients/tests/test-client.py:test_002()/7
|
||||
cmd: $NMCLI -f AP -mode multiline d show wlan0
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 1271 bytes
|
||||
>>>
|
||||
AP[1].IN-USE:
|
||||
AP[1].BSSID: 60:B3:25:25:E2:C8
|
||||
AP[1].SSID: wlan0-ap-3
|
||||
AP[1].MODE: Infra
|
||||
AP[1].CHAN: 1
|
||||
AP[1].RATE: 54 Mbit/s
|
||||
AP[1].SIGNAL: 55
|
||||
AP[1].BARS: **
|
||||
AP[1].SECURITY: WPA3
|
||||
AP[2].IN-USE:
|
||||
AP[2].BSSID: 90:B1:5F:9E:E0:E3
|
||||
AP[2].SSID: wlan0-ap-1
|
||||
AP[2].MODE: Infra
|
||||
AP[2].CHAN: 1
|
||||
AP[2].RATE: 54 Mbit/s
|
||||
AP[2].SIGNAL: 44
|
||||
AP[2].BARS: **
|
||||
AP[2].SECURITY: WPA1
|
||||
AP[3].IN-USE:
|
||||
AP[3].BSSID: 61:66:D2:E7:44:A2
|
||||
AP[3].SSID: wlan0-ap-2
|
||||
AP[3].MODE: Infra
|
||||
AP[3].CHAN: 1
|
||||
AP[3].RATE: 54 Mbit/s
|
||||
AP[3].SIGNAL: 34
|
||||
AP[3].BARS: **
|
||||
AP[3].SECURITY: WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 1457
|
||||
location: clients/tests/test-client.py:test_002()/8
|
||||
cmd: $NMCLI -f AP -mode multiline d show wlan0
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 1298 bytes
|
||||
>>>
|
||||
AP[1].IN-USE:
|
||||
AP[1].BSSID: 60:B3:25:25:E2:C8
|
||||
AP[1].SSID: wlan0-ap-3
|
||||
AP[1].MODE: Infrastruktura
|
||||
AP[1].CHAN: 1
|
||||
AP[1].RATE: 54 Mb/s
|
||||
AP[1].SIGNAL: 55
|
||||
AP[1].BARS: **
|
||||
AP[1].SECURITY: WPA3
|
||||
AP[2].IN-USE:
|
||||
AP[2].BSSID: 90:B1:5F:9E:E0:E3
|
||||
AP[2].SSID: wlan0-ap-1
|
||||
AP[2].MODE: Infrastruktura
|
||||
AP[2].CHAN: 1
|
||||
AP[2].RATE: 54 Mb/s
|
||||
AP[2].SIGNAL: 44
|
||||
AP[2].BARS: **
|
||||
AP[2].SECURITY: WPA1
|
||||
AP[3].IN-USE:
|
||||
AP[3].BSSID: 61:66:D2:E7:44:A2
|
||||
AP[3].SSID: wlan0-ap-2
|
||||
AP[3].MODE: Infrastruktura
|
||||
AP[3].CHAN: 1
|
||||
AP[3].RATE: 54 Mb/s
|
||||
AP[3].SIGNAL: 34
|
||||
AP[3].BARS: **
|
||||
AP[3].SECURITY: WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 1874
|
||||
location: clients/tests/test-client.py:test_002()/9
|
||||
cmd: $NMCLI -f AP -mode multiline -p d show wlan0
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 1722 bytes
|
||||
>>>
|
||||
===============================================================================
|
||||
Device details (wlan0)
|
||||
===============================================================================
|
||||
AP[1].IN-USE:
|
||||
AP[1].BSSID: 60:B3:25:25:E2:C8
|
||||
AP[1].SSID: wlan0-ap-3
|
||||
AP[1].MODE: Infra
|
||||
AP[1].CHAN: 1
|
||||
AP[1].RATE: 54 Mbit/s
|
||||
AP[1].SIGNAL: 55
|
||||
AP[1].BARS: **
|
||||
AP[1].SECURITY: WPA3
|
||||
-------------------------------------------------------------------------------
|
||||
AP[2].IN-USE:
|
||||
AP[2].BSSID: 90:B1:5F:9E:E0:E3
|
||||
AP[2].SSID: wlan0-ap-1
|
||||
AP[2].MODE: Infra
|
||||
AP[2].CHAN: 1
|
||||
AP[2].RATE: 54 Mbit/s
|
||||
AP[2].SIGNAL: 44
|
||||
AP[2].BARS: **
|
||||
AP[2].SECURITY: WPA1
|
||||
-------------------------------------------------------------------------------
|
||||
AP[3].IN-USE:
|
||||
AP[3].BSSID: 61:66:D2:E7:44:A2
|
||||
AP[3].SSID: wlan0-ap-2
|
||||
AP[3].MODE: Infra
|
||||
AP[3].CHAN: 1
|
||||
AP[3].RATE: 54 Mbit/s
|
||||
AP[3].SIGNAL: 34
|
||||
AP[3].BARS: **
|
||||
AP[3].SECURITY: WPA1 WPA2
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
<<<
|
||||
size: 1919
|
||||
location: clients/tests/test-client.py:test_002()/10
|
||||
cmd: $NMCLI -f AP -mode multiline -p d show wlan0
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 1756 bytes
|
||||
>>>
|
||||
===============================================================================
|
||||
Informacje o urządzeniu (wlan0)
|
||||
===============================================================================
|
||||
AP[1].IN-USE:
|
||||
AP[1].BSSID: 60:B3:25:25:E2:C8
|
||||
AP[1].SSID: wlan0-ap-3
|
||||
AP[1].MODE: Infrastruktura
|
||||
AP[1].CHAN: 1
|
||||
AP[1].RATE: 54 Mb/s
|
||||
AP[1].SIGNAL: 55
|
||||
AP[1].BARS: **
|
||||
AP[1].SECURITY: WPA3
|
||||
-------------------------------------------------------------------------------
|
||||
AP[2].IN-USE:
|
||||
AP[2].BSSID: 90:B1:5F:9E:E0:E3
|
||||
AP[2].SSID: wlan0-ap-1
|
||||
AP[2].MODE: Infrastruktura
|
||||
AP[2].CHAN: 1
|
||||
AP[2].RATE: 54 Mb/s
|
||||
AP[2].SIGNAL: 44
|
||||
AP[2].BARS: **
|
||||
AP[2].SECURITY: WPA1
|
||||
-------------------------------------------------------------------------------
|
||||
AP[3].IN-USE:
|
||||
AP[3].BSSID: 61:66:D2:E7:44:A2
|
||||
AP[3].SSID: wlan0-ap-2
|
||||
AP[3].MODE: Infrastruktura
|
||||
AP[3].CHAN: 1
|
||||
AP[3].RATE: 54 Mb/s
|
||||
AP[3].SIGNAL: 34
|
||||
AP[3].BARS: **
|
||||
AP[3].SECURITY: WPA1 WPA2
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
<<<
|
||||
size: 667
|
||||
location: clients/tests/test-client.py:test_002()/11
|
||||
cmd: $NMCLI -f AP -mode multiline -t d show wlan0
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 515 bytes
|
||||
>>>
|
||||
AP[1].IN-USE:
|
||||
AP[1].BSSID:60:B3:25:25:E2:C8
|
||||
AP[1].SSID:wlan0-ap-3
|
||||
AP[1].MODE:Infra
|
||||
AP[1].CHAN:1
|
||||
AP[1].RATE:54 Mbit/s
|
||||
AP[1].SIGNAL:55
|
||||
AP[1].BARS:**
|
||||
AP[1].SECURITY:WPA3
|
||||
AP[2].IN-USE:
|
||||
AP[2].BSSID:90:B1:5F:9E:E0:E3
|
||||
AP[2].SSID:wlan0-ap-1
|
||||
AP[2].MODE:Infra
|
||||
AP[2].CHAN:1
|
||||
AP[2].RATE:54 Mbit/s
|
||||
AP[2].SIGNAL:44
|
||||
AP[2].BARS:**
|
||||
AP[2].SECURITY:WPA1
|
||||
AP[3].IN-USE:
|
||||
AP[3].BSSID:61:66:D2:E7:44:A2
|
||||
AP[3].SSID:wlan0-ap-2
|
||||
AP[3].MODE:Infra
|
||||
AP[3].CHAN:1
|
||||
AP[3].RATE:54 Mbit/s
|
||||
AP[3].SIGNAL:34
|
||||
AP[3].BARS:**
|
||||
AP[3].SECURITY:WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 704
|
||||
location: clients/tests/test-client.py:test_002()/12
|
||||
cmd: $NMCLI -f AP -mode multiline -t d show wlan0
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 542 bytes
|
||||
>>>
|
||||
AP[1].IN-USE:
|
||||
AP[1].BSSID:60:B3:25:25:E2:C8
|
||||
AP[1].SSID:wlan0-ap-3
|
||||
AP[1].MODE:Infrastruktura
|
||||
AP[1].CHAN:1
|
||||
AP[1].RATE:54 Mb/s
|
||||
AP[1].SIGNAL:55
|
||||
AP[1].BARS:**
|
||||
AP[1].SECURITY:WPA3
|
||||
AP[2].IN-USE:
|
||||
AP[2].BSSID:90:B1:5F:9E:E0:E3
|
||||
AP[2].SSID:wlan0-ap-1
|
||||
AP[2].MODE:Infrastruktura
|
||||
AP[2].CHAN:1
|
||||
AP[2].RATE:54 Mb/s
|
||||
AP[2].SIGNAL:44
|
||||
AP[2].BARS:**
|
||||
AP[2].SECURITY:WPA1
|
||||
AP[3].IN-USE:
|
||||
AP[3].BSSID:61:66:D2:E7:44:A2
|
||||
AP[3].SSID:wlan0-ap-2
|
||||
AP[3].MODE:Infrastruktura
|
||||
AP[3].CHAN:1
|
||||
AP[3].RATE:54 Mb/s
|
||||
AP[3].SIGNAL:34
|
||||
AP[3].BARS:**
|
||||
AP[3].SECURITY:WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 527
|
||||
location: clients/tests/test-client.py:test_002()/13
|
||||
cmd: $NMCLI -f AP -mode tabular d show wlan0
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 380 bytes
|
||||
>>>
|
||||
NAME IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
|
||||
AP[1] 60:B3:25:25:E2:C8 wlan0-ap-3 Infra 1 54 Mbit/s 55 ** WPA3
|
||||
AP[2] 90:B1:5F:9E:E0:E3 wlan0-ap-1 Infra 1 54 Mbit/s 44 ** WPA1
|
||||
AP[3] 61:66:D2:E7:44:A2 wlan0-ap-2 Infra 1 54 Mbit/s 34 ** WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 571
|
||||
location: clients/tests/test-client.py:test_002()/14
|
||||
cmd: $NMCLI -f AP -mode tabular d show wlan0
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 414 bytes
|
||||
>>>
|
||||
NAME IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
|
||||
AP[1] 60:B3:25:25:E2:C8 wlan0-ap-3 Infrastruktura 1 54 Mb/s 55 ** WPA3
|
||||
AP[2] 90:B1:5F:9E:E0:E3 wlan0-ap-1 Infrastruktura 1 54 Mb/s 44 ** WPA1
|
||||
AP[3] 61:66:D2:E7:44:A2 wlan0-ap-2 Infrastruktura 1 54 Mb/s 34 ** WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 705
|
||||
location: clients/tests/test-client.py:test_002()/15
|
||||
cmd: $NMCLI -f AP -mode tabular -p d show wlan0
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 555 bytes
|
||||
>>>
|
||||
==========================
|
||||
Device details (wlan0)
|
||||
==========================
|
||||
NAME IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
|
||||
-----------------------------------------------------------------------------------------------
|
||||
AP[1] 60:B3:25:25:E2:C8 wlan0-ap-3 Infra 1 54 Mbit/s 55 ** WPA3
|
||||
AP[2] 90:B1:5F:9E:E0:E3 wlan0-ap-1 Infra 1 54 Mbit/s 44 ** WPA1
|
||||
AP[3] 61:66:D2:E7:44:A2 wlan0-ap-2 Infra 1 54 Mbit/s 34 ** WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 785
|
||||
location: clients/tests/test-client.py:test_002()/16
|
||||
cmd: $NMCLI -f AP -mode tabular -p d show wlan0
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 625 bytes
|
||||
>>>
|
||||
===================================
|
||||
Informacje o urządzeniu (wlan0)
|
||||
===================================
|
||||
NAME IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
|
||||
------------------------------------------------------------------------------------------------------
|
||||
AP[1] 60:B3:25:25:E2:C8 wlan0-ap-3 Infrastruktura 1 54 Mb/s 55 ** WPA3
|
||||
AP[2] 90:B1:5F:9E:E0:E3 wlan0-ap-1 Infrastruktura 1 54 Mb/s 44 ** WPA1
|
||||
AP[3] 61:66:D2:E7:44:A2 wlan0-ap-2 Infrastruktura 1 54 Mb/s 34 ** WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 374
|
||||
location: clients/tests/test-client.py:test_002()/17
|
||||
cmd: $NMCLI -f AP -mode tabular -t d show wlan0
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 224 bytes
|
||||
>>>
|
||||
AP[1]: :60\:B3\:25\:25\:E2\:C8:wlan0-ap-3:Infra:1:54 Mbit/s:55:** :WPA3
|
||||
AP[2]: :90\:B1\:5F\:9E\:E0\:E3:wlan0-ap-1:Infra:1:54 Mbit/s:44:** :WPA1
|
||||
AP[3]: :61\:66\:D2\:E7\:44\:A2:wlan0-ap-2:Infra:1:54 Mbit/s:34:** :WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 411
|
||||
location: clients/tests/test-client.py:test_002()/18
|
||||
cmd: $NMCLI -f AP -mode tabular -t d show wlan0
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 251 bytes
|
||||
>>>
|
||||
AP[1]: :60\:B3\:25\:25\:E2\:C8:wlan0-ap-3:Infrastruktura:1:54 Mb/s:55:** :WPA3
|
||||
AP[2]: :90\:B1\:5F\:9E\:E0\:E3:wlan0-ap-1:Infrastruktura:1:54 Mb/s:44:** :WPA1
|
||||
AP[3]: :61\:66\:D2\:E7\:44\:A2:wlan0-ap-2:Infrastruktura:1:54 Mb/s:34:** :WPA1 WPA2
|
||||
|
||||
<<<
|
||||
size: 1969
|
||||
location: clients/tests/test-client.py:test_002()/19
|
||||
cmd: $NMCLI -f ALL d wifi
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 1840 bytes
|
||||
>>>
|
||||
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
|
||||
AP[1] wlan0-ap-3 776C616E302D61702D33 60:B3:25:25:E2:C8 Infra 1 2412 MHz 54 Mbit/s 55 ** WPA3 (none) pair_tkip pair_ccmp group_tkip group_ccmp sae wlan0 no /org/freedesktop/NetworkManager/AccessPoint/3
|
||||
AP[2] wlan0-ap-1 776C616E302D61702D31 90:B1:5F:9E:E0:E3 Infra 1 2412 MHz 54 Mbit/s 44 ** WPA1 pair_tkip pair_ccmp group_tkip group_ccmp psk (none) wlan0 no /org/freedesktop/NetworkManager/AccessPoint/1
|
||||
AP[3] wlan0-ap-2 776C616E302D61702D32 61:66:D2:E7:44:A2 Infra 1 2412 MHz 54 Mbit/s 34 ** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 no /org/freedesktop/NetworkManager/AccessPoint/2
|
||||
|
||||
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
|
||||
AP[1] wlan1-ap-4 776C616E312D61702D34 EE:52:8B:49:A1:96 Infra 1 2412 MHz 54 Mbit/s 38 ** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan1 no /org/freedesktop/NetworkManager/AccessPoint/4
|
||||
|
||||
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
|
||||
|
||||
<<<
|
||||
size: 2037
|
||||
location: clients/tests/test-client.py:test_002()/20
|
||||
cmd: $NMCLI -f ALL d wifi
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 1898 bytes
|
||||
>>>
|
||||
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
|
||||
AP[1] wlan0-ap-3 776C616E302D61702D33 60:B3:25:25:E2:C8 Infrastruktura 1 2412 MHz 54 Mb/s 55 ** WPA3 (brak) pair_tkip pair_ccmp group_tkip group_ccmp sae wlan0 nie /org/freedesktop/NetworkManager/AccessPoint/3
|
||||
AP[2] wlan0-ap-1 776C616E302D61702D31 90:B1:5F:9E:E0:E3 Infrastruktura 1 2412 MHz 54 Mb/s 44 ** WPA1 pair_tkip pair_ccmp group_tkip group_ccmp psk (brak) wlan0 nie /org/freedesktop/NetworkManager/AccessPoint/1
|
||||
AP[3] wlan0-ap-2 776C616E302D61702D32 61:66:D2:E7:44:A2 Infrastruktura 1 2412 MHz 54 Mb/s 34 ** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan0 nie /org/freedesktop/NetworkManager/AccessPoint/2
|
||||
|
||||
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
|
||||
AP[1] wlan1-ap-4 776C616E312D61702D34 EE:52:8B:49:A1:96 Infrastruktura 1 2412 MHz 54 Mb/s 38 ** WPA1 WPA2 pair_tkip pair_ccmp group_tkip group_ccmp psk pair_tkip pair_ccmp group_tkip group_ccmp psk wlan1 nie /org/freedesktop/NetworkManager/AccessPoint/4
|
||||
|
||||
NAME SSID SSID-HEX BSSID MODE CHAN FREQ RATE SIGNAL BARS SECURITY WPA-FLAGS RSN-FLAGS DEVICE ACTIVE IN-USE DBUS-PATH
|
||||
|
||||
<<<
|
||||
size: 242
|
||||
location: clients/tests/test-client.py:test_002()/21
|
||||
cmd: $NMCLI c
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 126 bytes
|
||||
>>>
|
||||
NAME UUID TYPE DEVICE
|
||||
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
|
||||
|
||||
<<<
|
||||
size: 252
|
||||
location: clients/tests/test-client.py:test_002()/22
|
||||
cmd: $NMCLI c
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 126 bytes
|
||||
>>>
|
||||
NAME UUID TYPE DEVICE
|
||||
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
|
||||
|
||||
<<<
|
||||
size: 1263
|
||||
location: clients/tests/test-client.py:test_002()/23
|
||||
cmd: $NMCLI c s con-1
|
||||
lang: C
|
||||
returncode: 0
|
||||
stdout: 1138 bytes
|
||||
>>>
|
||||
connection.id: con-1
|
||||
connection.uuid: 5fcfd6d7-1e63-3332-8826-a7eda103792d
|
||||
connection.stable-id: --
|
||||
connection.type: 802-3-ethernet
|
||||
connection.interface-name: --
|
||||
connection.autoconnect: yes
|
||||
connection.autoconnect-priority: 0
|
||||
connection.autoconnect-retries: -1 (default)
|
||||
connection.multi-connect: 0 (default)
|
||||
connection.auth-retries: -1
|
||||
connection.timestamp: 0
|
||||
connection.read-only: no
|
||||
connection.permissions: --
|
||||
connection.zone: --
|
||||
connection.master: --
|
||||
connection.slave-type: --
|
||||
connection.autoconnect-slaves: -1 (default)
|
||||
connection.secondaries: --
|
||||
connection.gateway-ping-timeout: 0
|
||||
connection.metered: unknown
|
||||
connection.lldp: default
|
||||
connection.mdns: -1 (default)
|
||||
connection.llmnr: -1 (default)
|
||||
connection.wait-device-timeout: -1
|
||||
|
||||
<<<
|
||||
size: 1275
|
||||
location: clients/tests/test-client.py:test_002()/24
|
||||
cmd: $NMCLI c s con-1
|
||||
lang: pl_PL.UTF-8
|
||||
returncode: 0
|
||||
stdout: 1140 bytes
|
||||
>>>
|
||||
connection.id: con-1
|
||||
connection.uuid: 5fcfd6d7-1e63-3332-8826-a7eda103792d
|
||||
connection.stable-id: --
|
||||
connection.type: 802-3-ethernet
|
||||
connection.interface-name: --
|
||||
connection.autoconnect: tak
|
||||
connection.autoconnect-priority: 0
|
||||
connection.autoconnect-retries: -1 (default)
|
||||
connection.multi-connect: 0 (default)
|
||||
connection.auth-retries: -1
|
||||
connection.timestamp: 0
|
||||
connection.read-only: nie
|
||||
connection.permissions: --
|
||||
connection.zone: --
|
||||
connection.master: --
|
||||
connection.slave-type: --
|
||||
connection.autoconnect-slaves: -1 (default)
|
||||
connection.secondaries: --
|
||||
connection.gateway-ping-timeout: 0
|
||||
connection.metered: nieznane
|
||||
connection.lldp: default
|
||||
connection.mdns: -1 (default)
|
||||
connection.llmnr: -1 (default)
|
||||
connection.wait-device-timeout: -1
|
||||
|
||||
<<<
|
||||
17752
clients/tests/test-client.check-on-disk/test_003.expected
Normal file
17752
clients/tests/test-client.check-on-disk/test_003.expected
Normal file
File diff suppressed because it is too large
Load diff
51882
clients/tests/test-client.check-on-disk/test_004.expected
Normal file
51882
clients/tests/test-client.check-on-disk/test_004.expected
Normal file
File diff suppressed because it is too large
Load diff
1305
clients/tests/test-client.py
Executable file
1305
clients/tests/test-client.py
Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -1,127 +0,0 @@
|
|||
if BUILD_NMTUI
|
||||
|
||||
SUBDIRS = newt .
|
||||
|
||||
AM_CPPFLAGS= \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/libnm-core \
|
||||
-I$(top_builddir)/libnm-core \
|
||||
-I$(top_srcdir)/libnm \
|
||||
-I$(top_builddir)/libnm \
|
||||
-I$(srcdir)/newt \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(NEWT_CFLAGS) \
|
||||
$(GUDEV_CFLAGS) \
|
||||
-DG_LOG_DOMAIN=\""nmtui"\" \
|
||||
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
|
||||
-DLOCALEDIR=\""$(localedir)"\" \
|
||||
$(NULL)
|
||||
|
||||
bin_PROGRAMS = nmtui
|
||||
links = nmtui-edit nmtui-connect nmtui-hostname
|
||||
|
||||
install-exec-hook:
|
||||
for link in $(links); do \
|
||||
ln -f $(DESTDIR)$(bindir)/nmtui $(DESTDIR)$(bindir)/$$link; \
|
||||
done
|
||||
|
||||
uninstall-hook:
|
||||
for link in $(links); do \
|
||||
rm -f $(DESTDIR)$(bindir)/$$link; \
|
||||
done
|
||||
|
||||
nmtui_SOURCES = \
|
||||
nmtui.c \
|
||||
nmtui.h \
|
||||
nmtui-connect.c \
|
||||
nmtui-connect.h \
|
||||
nmtui-edit.c \
|
||||
nmtui-edit.h \
|
||||
nmtui-hostname.c \
|
||||
nmtui-hostname.h \
|
||||
\
|
||||
nm-editor-bindings.c \
|
||||
nm-editor-bindings.h \
|
||||
nm-editor-utils.c \
|
||||
nm-editor-utils.h \
|
||||
\
|
||||
nmt-address-list.c \
|
||||
nmt-address-list.h \
|
||||
nmt-connect-connection-list.c \
|
||||
nmt-connect-connection-list.h \
|
||||
nmt-device-entry.c \
|
||||
nmt-device-entry.h \
|
||||
nmt-edit-connection-list.c \
|
||||
nmt-edit-connection-list.h \
|
||||
nmt-editor-page.c \
|
||||
nmt-editor-page.h \
|
||||
nmt-editor.c \
|
||||
nmt-editor.h \
|
||||
nmt-ip-entry.c \
|
||||
nmt-ip-entry.h \
|
||||
nmt-mac-entry.c \
|
||||
nmt-mac-entry.h \
|
||||
nmt-mtu-entry.c \
|
||||
nmt-mtu-entry.h \
|
||||
nmt-page-bond.c \
|
||||
nmt-page-bond.h \
|
||||
nmt-page-bridge.c \
|
||||
nmt-page-bridge.h \
|
||||
nmt-page-bridge-port.c \
|
||||
nmt-page-bridge-port.h \
|
||||
nmt-page-device.c \
|
||||
nmt-page-device.h \
|
||||
nmt-page-dsl.c \
|
||||
nmt-page-dsl.h \
|
||||
nmt-page-ethernet.c \
|
||||
nmt-page-ethernet.h \
|
||||
nmt-page-grid.c \
|
||||
nmt-page-grid.h \
|
||||
nmt-page-infiniband.c \
|
||||
nmt-page-infiniband.h \
|
||||
nmt-page-ip4.c \
|
||||
nmt-page-ip4.h \
|
||||
nmt-page-ip6.c \
|
||||
nmt-page-ip6.h \
|
||||
nmt-page-main.c \
|
||||
nmt-page-main.h \
|
||||
nmt-page-ppp.c \
|
||||
nmt-page-ppp.h \
|
||||
nmt-page-team.c \
|
||||
nmt-page-team.h \
|
||||
nmt-page-team-port.c \
|
||||
nmt-page-team-port.h \
|
||||
nmt-page-vlan.c \
|
||||
nmt-page-vlan.h \
|
||||
nmt-page-wifi.c \
|
||||
nmt-page-wifi.h \
|
||||
nmt-password-dialog.c \
|
||||
nmt-password-dialog.h \
|
||||
nmt-password-fields.c \
|
||||
nmt-password-fields.h \
|
||||
nmt-route-editor.c \
|
||||
nmt-route-editor.h \
|
||||
nmt-route-entry.c \
|
||||
nmt-route-entry.h \
|
||||
nmt-route-table.c \
|
||||
nmt-route-table.h \
|
||||
nmt-secret-agent.c \
|
||||
nmt-secret-agent.h \
|
||||
nmt-slave-list.c \
|
||||
nmt-slave-list.h \
|
||||
nmt-utils.c \
|
||||
nmt-utils.h \
|
||||
nmt-widget-list.c \
|
||||
nmt-widget-list.h \
|
||||
$(NULL)
|
||||
|
||||
nmtui_LDADD = \
|
||||
$(top_builddir)/libnm/libnm.la \
|
||||
$(builddir)/newt/libnmt-newt.a \
|
||||
$(GUDEV_LIBS) \
|
||||
$(NEWT_LIBS) \
|
||||
$(GLIB_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
endif
|
||||
65
clients/tui/meson.build
Normal file
65
clients/tui/meson.build
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
name = 'nmtui'
|
||||
|
||||
common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)]
|
||||
|
||||
subdir('newt')
|
||||
|
||||
sources = files(
|
||||
'nm-editor-bindings.c',
|
||||
'nm-editor-utils.c',
|
||||
'nmt-address-list.c',
|
||||
'nmt-connect-connection-list.c',
|
||||
'nmt-device-entry.c',
|
||||
'nmt-edit-connection-list.c',
|
||||
'nmt-editor.c',
|
||||
'nmt-editor-grid.c',
|
||||
'nmt-editor-page.c',
|
||||
'nmt-editor-page-device.c',
|
||||
'nmt-editor-section.c',
|
||||
'nmt-ip-entry.c',
|
||||
'nmt-mac-entry.c',
|
||||
'nmt-mtu-entry.c',
|
||||
'nmt-page-bond.c',
|
||||
'nmt-page-bridge.c',
|
||||
'nmt-page-bridge-port.c',
|
||||
'nmt-page-dsl.c',
|
||||
'nmt-page-ethernet.c',
|
||||
'nmt-page-infiniband.c',
|
||||
'nmt-page-ip4.c',
|
||||
'nmt-page-ip6.c',
|
||||
'nmt-page-ip-tunnel.c',
|
||||
'nmt-page-ppp.c',
|
||||
'nmt-page-team.c',
|
||||
'nmt-page-team-port.c',
|
||||
'nmt-page-vlan.c',
|
||||
'nmt-page-wifi.c',
|
||||
'nmt-password-dialog.c',
|
||||
'nmt-password-fields.c',
|
||||
'nmt-route-editor.c',
|
||||
'nmt-route-entry.c',
|
||||
'nmt-route-table.c',
|
||||
'nmt-slave-list.c',
|
||||
'nmtui.c',
|
||||
'nmtui-connect.c',
|
||||
'nmtui-edit.c',
|
||||
'nmtui-hostname.c',
|
||||
'nmt-utils.c',
|
||||
'nmt-widget-list.c',
|
||||
)
|
||||
|
||||
deps = [
|
||||
libnmc_base_dep,
|
||||
libnmc_dep,
|
||||
libnmt_newt_dep,
|
||||
]
|
||||
|
||||
executable(
|
||||
name,
|
||||
sources,
|
||||
dependencies: deps,
|
||||
c_args: common_c_flags,
|
||||
link_with: libnm_systemd_logging_stub,
|
||||
link_args: ldflags_linker_script_binary,
|
||||
link_depends: linker_script_binary,
|
||||
install: true,
|
||||
)
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
AM_CPPFLAGS= \
|
||||
-I$(top_srcdir)/include \
|
||||
-DG_LOG_DOMAIN=\""nmtui"\" \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(NEWT_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
noinst_LIBRARIES = libnmt-newt.a
|
||||
|
||||
libnmt_newt_a_SOURCES = \
|
||||
nmt-newt.h \
|
||||
nmt-newt-types.h \
|
||||
nmt-newt-button.c \
|
||||
nmt-newt-button.h \
|
||||
nmt-newt-button-box.c \
|
||||
nmt-newt-button-box.h \
|
||||
nmt-newt-checkbox.c \
|
||||
nmt-newt-checkbox.h \
|
||||
nmt-newt-component.c \
|
||||
nmt-newt-component.h \
|
||||
nmt-newt-container.c \
|
||||
nmt-newt-container.h \
|
||||
nmt-newt-entry.c \
|
||||
nmt-newt-entry.h \
|
||||
nmt-newt-entry-numeric.c \
|
||||
nmt-newt-entry-numeric.h \
|
||||
nmt-newt-form.c \
|
||||
nmt-newt-form.h \
|
||||
nmt-newt-grid.c \
|
||||
nmt-newt-grid.h \
|
||||
nmt-newt-hacks.c \
|
||||
nmt-newt-hacks.h \
|
||||
nmt-newt-label.c \
|
||||
nmt-newt-label.h \
|
||||
nmt-newt-listbox.c \
|
||||
nmt-newt-listbox.h \
|
||||
nmt-newt-popup.c \
|
||||
nmt-newt-popup.h \
|
||||
nmt-newt-section.c \
|
||||
nmt-newt-section.h \
|
||||
nmt-newt-separator.c \
|
||||
nmt-newt-separator.h \
|
||||
nmt-newt-stack.c \
|
||||
nmt-newt-stack.h \
|
||||
nmt-newt-textbox.c \
|
||||
nmt-newt-textbox.h \
|
||||
nmt-newt-toggle-button.c \
|
||||
nmt-newt-toggle-button.h \
|
||||
nmt-newt-utils.c \
|
||||
nmt-newt-utils.h \
|
||||
nmt-newt-widget.c \
|
||||
nmt-newt-widget.h \
|
||||
$(NULL)
|
||||
40
clients/tui/newt/meson.build
Normal file
40
clients/tui/newt/meson.build
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
sources = files(
|
||||
'nmt-newt-button-box.c',
|
||||
'nmt-newt-button.c',
|
||||
'nmt-newt-checkbox.c',
|
||||
'nmt-newt-component.c',
|
||||
'nmt-newt-container.c',
|
||||
'nmt-newt-entry.c',
|
||||
'nmt-newt-entry-numeric.c',
|
||||
'nmt-newt-form.c',
|
||||
'nmt-newt-grid.c',
|
||||
'nmt-newt-hacks.c',
|
||||
'nmt-newt-label.c',
|
||||
'nmt-newt-listbox.c',
|
||||
'nmt-newt-popup.c',
|
||||
'nmt-newt-section.c',
|
||||
'nmt-newt-separator.c',
|
||||
'nmt-newt-stack.c',
|
||||
'nmt-newt-textbox.c',
|
||||
'nmt-newt-toggle-button.c',
|
||||
'nmt-newt-utils.c',
|
||||
'nmt-newt-widget.c',
|
||||
)
|
||||
|
||||
deps = [
|
||||
libnm_nm_default_dep,
|
||||
newt_dep,
|
||||
]
|
||||
|
||||
libnmt_newt = static_library(
|
||||
'nmt-newt',
|
||||
sources: sources,
|
||||
dependencies: deps,
|
||||
c_args: common_c_flags,
|
||||
)
|
||||
|
||||
libnmt_newt_dep = declare_dependency(
|
||||
include_directories: include_directories('.'),
|
||||
dependencies: newt_dep,
|
||||
link_with: libnmt_newt,
|
||||
)
|
||||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -29,11 +16,10 @@
|
|||
* within each of the two sections.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nmt-newt-button-box.h"
|
||||
|
||||
#include "nmt-newt-button.h"
|
||||
|
||||
G_DEFINE_TYPE (NmtNewtButtonBox, nmt_newt_button_box, NMT_TYPE_NEWT_CONTAINER)
|
||||
|
|
@ -264,12 +250,10 @@ nmt_newt_button_box_size_request (NmtNewtWidget *widget,
|
|||
size_request_buttons (bbox, priv->start_buttons, width, height);
|
||||
size_request_buttons (bbox, priv->end_buttons, width, height);
|
||||
|
||||
if (priv->start_buttons && priv->end_buttons) {
|
||||
if (priv->orientation == NMT_NEWT_BUTTON_BOX_HORIZONTAL)
|
||||
*width += 1;
|
||||
else
|
||||
*height += 1;
|
||||
}
|
||||
if (priv->orientation == NMT_NEWT_BUTTON_BOX_HORIZONTAL)
|
||||
*width += 1;
|
||||
else
|
||||
*height += 1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMT_NEWT_BUTTON_BOX_H
|
||||
|
|
@ -21,8 +8,6 @@
|
|||
|
||||
#include "nmt-newt-grid.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NMT_TYPE_NEWT_BUTTON_BOX (nmt_newt_button_box_get_type ())
|
||||
#define NMT_NEWT_BUTTON_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMT_TYPE_NEWT_BUTTON_BOX, NmtNewtButtonBox))
|
||||
#define NMT_NEWT_BUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMT_TYPE_NEWT_BUTTON_BOX, NmtNewtButtonBoxClass))
|
||||
|
|
@ -59,7 +44,4 @@ void nmt_newt_button_box_add_widget_start (NmtNewtButtonBox *bbox,
|
|||
void nmt_newt_button_box_add_widget_end (NmtNewtButtonBox *bbox,
|
||||
NmtNewtWidget *widget);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NMT_NEWT_BUTTON_BOX_H */
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +10,7 @@
|
|||
* #NmtNewtButton implements a button widget.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nmt-newt-button.h"
|
||||
#include "nmt-newt-utils.h"
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMT_NEWT_BUTTON_H
|
||||
|
|
@ -21,8 +8,6 @@
|
|||
|
||||
#include "nmt-newt-component.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NMT_TYPE_NEWT_BUTTON (nmt_newt_button_get_type ())
|
||||
#define NMT_NEWT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMT_TYPE_NEWT_BUTTON, NmtNewtButton))
|
||||
#define NMT_NEWT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMT_TYPE_NEWT_BUTTON, NmtNewtButtonClass))
|
||||
|
|
@ -48,6 +33,4 @@ void nmt_newt_button_set_label (NmtNewtButton *button,
|
|||
const char *label);
|
||||
const char *nmt_newt_button_get_label (NmtNewtButton *button);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NMT_NEWT_BUTTON_H */
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +10,7 @@
|
|||
* #NmtNewtCheckbox implements a checkbox widget.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nmt-newt-checkbox.h"
|
||||
#include "nmt-newt-utils.h"
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMT_NEWT_CHECKBOX_H
|
||||
|
|
@ -21,8 +8,6 @@
|
|||
|
||||
#include "nmt-newt-component.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NMT_TYPE_NEWT_CHECKBOX (nmt_newt_checkbox_get_type ())
|
||||
#define NMT_NEWT_CHECKBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMT_TYPE_NEWT_CHECKBOX, NmtNewtCheckbox))
|
||||
#define NMT_NEWT_CHECKBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMT_TYPE_NEWT_CHECKBOX, NmtNewtCheckboxClass))
|
||||
|
|
@ -48,6 +33,4 @@ void nmt_newt_checkbox_set_active (NmtNewtCheckbox *checkbox,
|
|||
gboolean active);
|
||||
gboolean nmt_newt_checkbox_get_active (NmtNewtCheckbox *checkbox);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NMT_NEWT_CHECKBOX_H */
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +11,7 @@
|
|||
* wrap a (single) #newtComponent.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nmt-newt-component.h"
|
||||
#include "nmt-newt-form.h"
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMT_NEWT_COMPONENT_H
|
||||
|
|
@ -21,8 +8,6 @@
|
|||
|
||||
#include "nmt-newt-widget.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NMT_TYPE_NEWT_COMPONENT (nmt_newt_component_get_type ())
|
||||
#define NMT_NEWT_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMT_TYPE_NEWT_COMPONENT, NmtNewtComponent))
|
||||
#define NMT_NEWT_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMT_TYPE_NEWT_COMPONENT, NmtNewtComponentClass))
|
||||
|
|
@ -52,6 +37,4 @@ gboolean nmt_newt_component_get_sensitive (NmtNewtComponent *component);
|
|||
void nmt_newt_component_set_sensitive (NmtNewtComponent *component,
|
||||
gboolean sensitive);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NMT_NEWT_COMPONENT_H */
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -26,11 +13,10 @@
|
|||
* #NmtNewtGrid is the most generic container type.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nmt-newt-container.h"
|
||||
|
||||
#include "nmt-newt-component.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (NmtNewtContainer, nmt_newt_container, NMT_TYPE_NEWT_WIDGET)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,6 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NMT_NEWT_CONTAINER_H
|
||||
|
|
@ -21,8 +8,6 @@
|
|||
|
||||
#include "nmt-newt-widget.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NMT_TYPE_NEWT_CONTAINER (nmt_newt_container_get_type ())
|
||||
#define NMT_NEWT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMT_TYPE_NEWT_CONTAINER, NmtNewtContainer))
|
||||
#define NMT_NEWT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMT_TYPE_NEWT_CONTAINER, NmtNewtContainerClass))
|
||||
|
|
@ -56,6 +41,4 @@ void nmt_newt_container_remove (NmtNewtContainer *container,
|
|||
|
||||
GSList *nmt_newt_container_get_children (NmtNewtContainer *container);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NMT_NEWT_CONTAINER_H */
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue