summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--Makefile.am1498
-rw-r--r--README4
-rw-r--r--TODO4
-rw-r--r--catalog/systemd.be.catalog260
-rw-r--r--catalog/systemd.be@latin.catalog260
-rw-r--r--catalog/systemd.zh_TW.catalog263
-rw-r--r--configure.ac8
-rw-r--r--hwdb/20-bluetooth-vendor-product.hwdb39
-rw-r--r--hwdb/60-keyboard.hwdb6
-rw-r--r--man/hwdb.xml8
-rw-r--r--man/sd_bus_creds_get_pid.xml6
-rw-r--r--man/systemd-cgtop.xml23
-rw-r--r--man/systemd-gpt-auto-generator.xml15
-rw-r--r--man/systemd.kill.xml8
-rw-r--r--man/systemd.network.xml7
-rw-r--r--man/systemd.service.xml19
-rw-r--r--man/timesyncd.conf.xml4
-rw-r--r--po/LINGUAS3
-rw-r--r--po/be.po502
-rw-r--r--po/be@latin.po502
-rw-r--r--po/zh_TW.po477
-rw-r--r--rules/60-persistent-storage.rules5
-rw-r--r--shell-completion/zsh/_systemctl.in15
-rw-r--r--src/basic/.gitignore (renamed from src/shared/.gitignore)0
l---------src/basic/Makefile (renamed from src/shared/Makefile)0
-rw-r--r--src/basic/MurmurHash2.c (renamed from src/shared/MurmurHash2.c)0
-rw-r--r--src/basic/MurmurHash2.h (renamed from src/shared/MurmurHash2.h)0
-rw-r--r--src/basic/af-list.c (renamed from src/shared/af-list.c)0
-rw-r--r--src/basic/af-list.h (renamed from src/shared/af-list.h)0
-rw-r--r--src/basic/arphrd-list.c (renamed from src/shared/arphrd-list.c)0
-rw-r--r--src/basic/arphrd-list.h (renamed from src/shared/arphrd-list.h)0
-rw-r--r--src/basic/async.c (renamed from src/shared/async.c)0
-rw-r--r--src/basic/async.h (renamed from src/shared/async.h)0
-rw-r--r--src/basic/audit.c (renamed from src/shared/audit.c)0
-rw-r--r--src/basic/audit.h (renamed from src/shared/audit.h)0
-rw-r--r--src/basic/barrier.c (renamed from src/shared/barrier.c)0
-rw-r--r--src/basic/barrier.h (renamed from src/shared/barrier.h)0
-rw-r--r--src/basic/blkid-util.h (renamed from src/shared/blkid-util.h)0
-rw-r--r--src/basic/btrfs-ctree.h (renamed from src/shared/btrfs-ctree.h)0
-rw-r--r--src/basic/btrfs-util.c (renamed from src/shared/btrfs-util.c)0
-rw-r--r--src/basic/btrfs-util.h (renamed from src/shared/btrfs-util.h)0
-rw-r--r--src/basic/build.h (renamed from src/shared/build.h)0
-rw-r--r--src/basic/bus-label.c (renamed from src/shared/bus-label.c)0
-rw-r--r--src/basic/bus-label.h (renamed from src/shared/bus-label.h)0
-rw-r--r--src/basic/calendarspec.c (renamed from src/shared/calendarspec.c)0
-rw-r--r--src/basic/calendarspec.h (renamed from src/shared/calendarspec.h)0
-rw-r--r--src/basic/cap-list.c (renamed from src/shared/cap-list.c)0
-rw-r--r--src/basic/cap-list.h (renamed from src/shared/cap-list.h)0
-rw-r--r--src/basic/capability.c (renamed from src/shared/capability.c)0
-rw-r--r--src/basic/capability.h (renamed from src/shared/capability.h)0
-rw-r--r--src/basic/cgroup-util.c (renamed from src/shared/cgroup-util.c)26
-rw-r--r--src/basic/cgroup-util.h (renamed from src/shared/cgroup-util.h)2
-rw-r--r--src/basic/clock-util.c (renamed from src/shared/clock-util.c)0
-rw-r--r--src/basic/clock-util.h (renamed from src/shared/clock-util.h)0
-rw-r--r--src/basic/conf-files.c (renamed from src/shared/conf-files.c)0
-rw-r--r--src/basic/conf-files.h (renamed from src/shared/conf-files.h)0
-rw-r--r--src/basic/copy.c (renamed from src/shared/copy.c)0
-rw-r--r--src/basic/copy.h (renamed from src/shared/copy.h)0
-rw-r--r--src/basic/def.h (renamed from src/shared/def.h)2
-rw-r--r--src/basic/device-nodes.c (renamed from src/shared/device-nodes.c)0
-rw-r--r--src/basic/device-nodes.h (renamed from src/shared/device-nodes.h)0
-rw-r--r--src/basic/env-util.c (renamed from src/shared/env-util.c)0
-rw-r--r--src/basic/env-util.h (renamed from src/shared/env-util.h)0
-rw-r--r--src/basic/errno-list.c (renamed from src/shared/errno-list.c)0
-rw-r--r--src/basic/errno-list.h (renamed from src/shared/errno-list.h)0
-rw-r--r--src/basic/ether-addr-util.h (renamed from src/shared/ether-addr-util.h)0
-rw-r--r--src/basic/exit-status.c (renamed from src/shared/exit-status.c)0
-rw-r--r--src/basic/exit-status.h (renamed from src/shared/exit-status.h)0
-rw-r--r--src/basic/fdset.c (renamed from src/shared/fdset.c)0
-rw-r--r--src/basic/fdset.h (renamed from src/shared/fdset.h)0
-rw-r--r--src/basic/fileio-label.c (renamed from src/shared/fileio-label.c)0
-rw-r--r--src/basic/fileio-label.h (renamed from src/shared/fileio-label.h)0
-rw-r--r--src/basic/fileio.c (renamed from src/shared/fileio.c)0
-rw-r--r--src/basic/fileio.h (renamed from src/shared/fileio.h)0
-rw-r--r--src/basic/gunicode.c (renamed from src/shared/gunicode.c)0
-rw-r--r--src/basic/gunicode.h (renamed from src/shared/gunicode.h)0
-rw-r--r--src/basic/hashmap.c (renamed from src/shared/hashmap.c)0
-rw-r--r--src/basic/hashmap.h (renamed from src/shared/hashmap.h)0
-rw-r--r--src/basic/hostname-util.c (renamed from src/shared/hostname-util.c)0
-rw-r--r--src/basic/hostname-util.h (renamed from src/shared/hostname-util.h)0
-rw-r--r--src/basic/in-addr-util.c (renamed from src/shared/in-addr-util.c)0
-rw-r--r--src/basic/in-addr-util.h (renamed from src/shared/in-addr-util.h)0
-rw-r--r--src/basic/ioprio.h (renamed from src/shared/ioprio.h)0
-rw-r--r--src/basic/json.c (renamed from src/shared/json.c)0
-rw-r--r--src/basic/json.h (renamed from src/shared/json.h)0
-rw-r--r--src/basic/label.c (renamed from src/shared/label.c)0
-rw-r--r--src/basic/label.h (renamed from src/shared/label.h)0
l---------src/basic/linux/Makefile (renamed from src/shared/linux/Makefile)0
-rw-r--r--src/basic/list.h (renamed from src/shared/list.h)0
-rw-r--r--src/basic/locale-util.c (renamed from src/shared/locale-util.c)0
-rw-r--r--src/basic/locale-util.h (renamed from src/shared/locale-util.h)0
-rw-r--r--src/basic/lockfile-util.c (renamed from src/shared/lockfile-util.c)0
-rw-r--r--src/basic/lockfile-util.h (renamed from src/shared/lockfile-util.h)0
-rw-r--r--src/basic/log.c (renamed from src/shared/log.c)0
-rw-r--r--src/basic/log.h (renamed from src/shared/log.h)0
-rw-r--r--src/basic/login-util.c (renamed from src/shared/login-shared.c)2
-rw-r--r--src/basic/login-util.h (renamed from src/shared/login-shared.h)0
-rw-r--r--src/basic/macro.h (renamed from src/shared/macro.h)0
-rw-r--r--src/basic/memfd-util.c (renamed from src/shared/memfd-util.c)0
-rw-r--r--src/basic/memfd-util.h (renamed from src/shared/memfd-util.h)0
-rw-r--r--src/basic/mempool.c (renamed from src/shared/mempool.c)0
-rw-r--r--src/basic/mempool.h (renamed from src/shared/mempool.h)0
-rw-r--r--src/basic/missing.h (renamed from src/shared/missing.h)0
-rw-r--r--src/basic/mkdir-label.c (renamed from src/shared/mkdir-label.c)0
-rw-r--r--src/basic/mkdir.c (renamed from src/shared/mkdir.c)0
-rw-r--r--src/basic/mkdir.h (renamed from src/shared/mkdir.h)0
-rw-r--r--src/basic/ordered-set.h (renamed from src/shared/ordered-set.h)0
-rw-r--r--src/basic/path-util.c (renamed from src/shared/path-util.c)0
-rw-r--r--src/basic/path-util.h (renamed from src/shared/path-util.h)0
-rw-r--r--src/basic/prioq.c (renamed from src/shared/prioq.c)0
-rw-r--r--src/basic/prioq.h (renamed from src/shared/prioq.h)0
-rw-r--r--src/basic/process-util.c (renamed from src/shared/process-util.c)0
-rw-r--r--src/basic/process-util.h (renamed from src/shared/process-util.h)0
-rw-r--r--src/basic/random-util.c (renamed from src/shared/random-util.c)0
-rw-r--r--src/basic/random-util.h (renamed from src/shared/random-util.h)0
-rw-r--r--src/basic/ratelimit.c (renamed from src/shared/ratelimit.c)0
-rw-r--r--src/basic/ratelimit.h (renamed from src/shared/ratelimit.h)0
-rw-r--r--src/basic/refcnt.h (renamed from src/shared/refcnt.h)0
-rw-r--r--src/basic/replace-var.c (renamed from src/shared/replace-var.c)0
-rw-r--r--src/basic/replace-var.h (renamed from src/shared/replace-var.h)0
-rw-r--r--src/basic/ring.c (renamed from src/shared/ring.c)0
-rw-r--r--src/basic/ring.h (renamed from src/shared/ring.h)0
-rw-r--r--src/basic/rm-rf.c (renamed from src/shared/rm-rf.c)0
-rw-r--r--src/basic/rm-rf.h (renamed from src/shared/rm-rf.h)0
-rw-r--r--src/basic/securebits.h (renamed from src/shared/securebits.h)0
-rw-r--r--src/basic/selinux-util.c (renamed from src/shared/selinux-util.c)0
-rw-r--r--src/basic/selinux-util.h (renamed from src/shared/selinux-util.h)0
-rw-r--r--src/basic/set.h (renamed from src/shared/set.h)0
-rw-r--r--src/basic/sigbus.c (renamed from src/shared/sigbus.c)0
-rw-r--r--src/basic/sigbus.h (renamed from src/shared/sigbus.h)0
-rw-r--r--src/basic/signal-util.c (renamed from src/shared/signal-util.c)0
-rw-r--r--src/basic/signal-util.h (renamed from src/shared/signal-util.h)0
-rw-r--r--src/basic/siphash24.c (renamed from src/shared/siphash24.c)0
-rw-r--r--src/basic/siphash24.h (renamed from src/shared/siphash24.h)0
-rw-r--r--src/basic/smack-util.c (renamed from src/shared/smack-util.c)0
-rw-r--r--src/basic/smack-util.h (renamed from src/shared/smack-util.h)0
-rw-r--r--src/basic/socket-label.c (renamed from src/shared/socket-label.c)0
-rw-r--r--src/basic/socket-util.c (renamed from src/shared/socket-util.c)0
-rw-r--r--src/basic/socket-util.h (renamed from src/shared/socket-util.h)0
-rw-r--r--src/basic/sparse-endian.h (renamed from src/shared/sparse-endian.h)0
-rw-r--r--src/basic/special.h (renamed from src/shared/special.h)0
-rw-r--r--src/basic/strbuf.c (renamed from src/shared/strbuf.c)0
-rw-r--r--src/basic/strbuf.h (renamed from src/shared/strbuf.h)0
-rw-r--r--src/basic/strv.c (renamed from src/shared/strv.c)0
-rw-r--r--src/basic/strv.h (renamed from src/shared/strv.h)0
-rw-r--r--src/basic/strxcpyx.c (renamed from src/shared/strxcpyx.c)0
-rw-r--r--src/basic/strxcpyx.h (renamed from src/shared/strxcpyx.h)0
-rw-r--r--src/basic/terminal-util.c (renamed from src/shared/terminal-util.c)0
-rw-r--r--src/basic/terminal-util.h (renamed from src/shared/terminal-util.h)0
-rw-r--r--src/basic/time-util.c (renamed from src/shared/time-util.c)0
-rw-r--r--src/basic/time-util.h (renamed from src/shared/time-util.h)0
-rw-r--r--src/basic/unaligned.h (renamed from src/shared/unaligned.h)0
-rw-r--r--src/basic/unit-name.c (renamed from src/shared/unit-name.c)0
-rw-r--r--src/basic/unit-name.h (renamed from src/shared/unit-name.h)0
-rw-r--r--src/basic/utf8.c (renamed from src/shared/utf8.c)0
-rw-r--r--src/basic/utf8.h (renamed from src/shared/utf8.h)0
-rw-r--r--src/basic/util.c (renamed from src/shared/util.c)0
-rw-r--r--src/basic/util.h (renamed from src/shared/util.h)0
-rw-r--r--src/basic/verbs.c (renamed from src/shared/verbs.c)0
-rw-r--r--src/basic/verbs.h (renamed from src/shared/verbs.h)0
-rw-r--r--src/basic/virt.c (renamed from src/shared/virt.c)0
-rw-r--r--src/basic/virt.h (renamed from src/shared/virt.h)0
-rw-r--r--src/basic/xml.c (renamed from src/shared/xml.c)0
-rw-r--r--src/basic/xml.h (renamed from src/shared/xml.h)0
-rw-r--r--src/cgtop/cgtop.c53
-rw-r--r--src/core/ima-setup.c39
-rw-r--r--src/core/kmod-setup.c9
-rw-r--r--src/core/loopback-setup.c20
-rw-r--r--src/core/selinux-access.c28
-rw-r--r--src/core/service.c9
-rw-r--r--src/core/umount.c2
-rw-r--r--src/core/unit.c11
-rw-r--r--src/journal/journald-server.c204
-rw-r--r--src/journal/journald-syslog.c3
-rw-r--r--src/libsystemd-network/test-pppoe.c40
-rw-r--r--src/libsystemd-terminal/grdev-drm.c2
-rw-r--r--src/libsystemd-terminal/grdev.c2
-rw-r--r--src/libsystemd-terminal/idev.c2
-rw-r--r--src/libsystemd/sd-bus/bus-internal.c26
-rw-r--r--src/libsystemd/sd-bus/bus-internal.h2
-rw-r--r--src/libsystemd/sd-login/sd-login.c2
l---------src/libsystemd/sd-netlink/Makefile (renamed from src/libsystemd/sd-rtnl/Makefile)0
-rw-r--r--src/libsystemd/sd-netlink/local-addresses.c (renamed from src/libsystemd/sd-rtnl/local-addresses.c)62
-rw-r--r--src/libsystemd/sd-netlink/local-addresses.h (renamed from src/libsystemd/sd-rtnl/local-addresses.h)6
-rw-r--r--src/libsystemd/sd-netlink/netlink-internal.h (renamed from src/libsystemd/sd-rtnl/rtnl-internal.h)44
-rw-r--r--src/libsystemd/sd-netlink/netlink-message.c906
-rw-r--r--src/libsystemd/sd-netlink/netlink-socket.c322
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.c (renamed from src/libsystemd/sd-rtnl/rtnl-types.c)2
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.h (renamed from src/libsystemd/sd-rtnl/rtnl-types.h)0
-rw-r--r--src/libsystemd/sd-netlink/netlink-util.c (renamed from src/libsystemd/sd-rtnl/rtnl-util.c)32
-rw-r--r--src/libsystemd/sd-netlink/netlink-util.h (renamed from src/libsystemd/sd-rtnl/rtnl-util.h)20
-rw-r--r--src/libsystemd/sd-netlink/rtnl-message.c588
-rw-r--r--src/libsystemd/sd-netlink/sd-netlink.c (renamed from src/libsystemd/sd-rtnl/sd-rtnl.c)391
-rw-r--r--src/libsystemd/sd-netlink/test-local-addresses.c (renamed from src/libsystemd/sd-rtnl/test-local-addresses.c)0
-rw-r--r--src/libsystemd/sd-netlink/test-netlink.c440
-rw-r--r--src/libsystemd/sd-network/sd-network.c4
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-message.c1705
-rw-r--r--src/libsystemd/sd-rtnl/test-rtnl.c443
-rw-r--r--src/locale/localectl.c35
-rw-r--r--src/login/loginctl.c105
-rw-r--r--src/login/logind-session.h2
-rw-r--r--src/login/logind-user.c3
-rw-r--r--src/login/test-login-shared.c2
-rw-r--r--src/machine/machinectl.c48
-rw-r--r--src/network/networkctl.c84
-rw-r--r--src/network/networkd-address.c52
-rw-r--r--src/network/networkd-dhcp4.c8
-rw-r--r--src/network/networkd-dhcp6.c4
-rw-r--r--src/network/networkd-fdb.c14
-rw-r--r--src/network/networkd-ipv4ll.c8
-rw-r--r--src/network/networkd-link.c124
-rw-r--r--src/network/networkd-link.h10
-rw-r--r--src/network/networkd-manager.c52
-rw-r--r--src/network/networkd-netdev-bond.c53
-rw-r--r--src/network/networkd-netdev-ipvlan.c12
-rw-r--r--src/network/networkd-netdev-macvlan.c12
-rw-r--r--src/network/networkd-netdev-tunnel.c78
-rw-r--r--src/network/networkd-netdev-tuntap.c51
-rw-r--r--src/network/networkd-netdev-veth.c12
-rw-r--r--src/network/networkd-netdev-vlan.c4
-rw-r--r--src/network/networkd-netdev-vxlan.c32
-rw-r--r--src/network/networkd-netdev.c54
-rw-r--r--src/network/networkd-netdev.h10
-rw-r--r--src/network/networkd-network-gperf.gperf130
-rw-r--r--src/network/networkd-network.c34
-rw-r--r--src/network/networkd-route.c52
-rw-r--r--src/network/networkd-wait-online-link.c4
-rw-r--r--src/network/networkd-wait-online-link.h2
-rw-r--r--src/network/networkd-wait-online-manager.c30
-rw-r--r--src/network/networkd-wait-online.h4
-rw-r--r--src/network/networkd.h19
-rw-r--r--src/network/test-network-tables.c2
-rw-r--r--src/nspawn/nspawn.c135
-rw-r--r--src/resolve/resolved-link.c8
-rw-r--r--src/resolve/resolved-link.h4
-rw-r--r--src/resolve/resolved-manager.c50
-rw-r--r--src/resolve/resolved-manager.h4
-rw-r--r--src/shared/bus-util.c (renamed from src/libsystemd/sd-bus/bus-util.c)25
-rw-r--r--src/shared/bus-util.h (renamed from src/libsystemd/sd-bus/bus-util.h)2
-rw-r--r--src/shared/firewall-util.c (renamed from src/shared/fw-util.c)2
-rw-r--r--src/shared/firewall-util.h (renamed from src/shared/fw-util.h)0
-rw-r--r--src/systemctl/systemctl.c21
-rw-r--r--src/systemd/sd-netlink.h150
-rw-r--r--src/systemd/sd-rtnl.h153
-rw-r--r--src/test/test-cgroup-util.c20
-rw-r--r--src/test/test-firewall-util.c (renamed from src/test/test-fw-util.c)2
-rw-r--r--src/test/test-netlink-manual.c (renamed from src/test/test-rtnl-manual.c)54
-rw-r--r--src/timedate/timedatectl.c17
-rw-r--r--src/udev/net/link-config.c8
-rw-r--r--src/udev/udev-event.c29
-rw-r--r--src/udev/udev-rules.c4
-rw-r--r--src/udev/udev.h5
-rw-r--r--src/udev/udevd.c6
-rw-r--r--test/sysv-generator-test.py1
255 files changed, 6680 insertions, 4559 deletions
diff --git a/.gitignore b/.gitignore
index ea9aacfd9f..1e704a872b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -193,7 +193,7 @@
/test-fdset
/test-fileio
/test-fstab-util
-/test-fw-util
+/test-firewall-util
/test-hashmap
/test-hostname
/test-icmp6-rs
@@ -244,8 +244,8 @@
/test-replace-var
/test-resolve
/test-ring
-/test-rtnl
-/test-rtnl-manual
+/test-netlink
+/test-netlink-manual
/test-sched-prio
/test-set
/test-sigbus
diff --git a/Makefile.am b/Makefile.am
index 8fa43f50ba..a2e8709e52 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -211,8 +211,10 @@ AM_CPPFLAGS = \
-DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
-DTEST_DIR=\"$(abs_top_srcdir)/test\" \
-I $(top_srcdir)/src \
- -I $(top_builddir)/src/shared \
+ -I $(top_builddir)/src/basic \
+ -I $(top_srcdir)/src/basic \
-I $(top_srcdir)/src/shared \
+ -I $(top_builddir)/src/shared \
-I $(top_srcdir)/src/network \
-I $(top_srcdir)/src/login \
-I $(top_srcdir)/src/journal \
@@ -230,7 +232,8 @@ AM_CPPFLAGS = \
-I $(top_builddir)/src/udev \
-I $(top_srcdir)/src/libsystemd/sd-bus \
-I $(top_srcdir)/src/libsystemd/sd-event \
- -I $(top_srcdir)/src/libsystemd/sd-rtnl \
+ -I $(top_srcdir)/src/libsystemd/sd-login \
+ -I $(top_srcdir)/src/libsystemd/sd-netlink \
-I $(top_srcdir)/src/libsystemd/sd-network \
-I $(top_srcdir)/src/libsystemd/sd-hwdb \
-I $(top_srcdir)/src/libsystemd/sd-device \
@@ -714,9 +717,9 @@ man/systemd.index.xml: $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FIL
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
-man/systemd.directives.xml: $(top_srcdir)/tools/make-directive-index.py $(SOURCE_XML_FILES)
+man/systemd.directives.xml: $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
+ $(AM_V_GEN)$(PYTHON) $< $@ $(SOURCE_XML_FILES)
CLEANFILES += \
man/systemd.index.xml \
@@ -742,32 +745,182 @@ EXTRA_DIST += \
# ------------------------------------------------------------------------------
noinst_LTLIBRARIES += \
- libsystemd-shared.la
+ libbasic.la
+
+libbasic_la_SOURCES = \
+ src/basic/missing.h \
+ src/basic/capability.c \
+ src/basic/capability.h \
+ src/basic/conf-files.c \
+ src/basic/conf-files.h \
+ src/basic/hostname-util.h \
+ src/basic/hostname-util.c \
+ src/basic/unit-name.c \
+ src/basic/unit-name.h \
+ src/basic/ioprio.h \
+ src/basic/securebits.h \
+ src/basic/special.h \
+ src/basic/list.h \
+ src/basic/unaligned.h \
+ src/basic/macro.h \
+ src/basic/def.h \
+ src/basic/sparse-endian.h \
+ src/basic/refcnt.h \
+ src/basic/util.c \
+ src/basic/util.h \
+ src/basic/lockfile-util.c \
+ src/basic/lockfile-util.h \
+ src/basic/path-util.c \
+ src/basic/path-util.h \
+ src/basic/time-util.c \
+ src/basic/time-util.h \
+ src/basic/locale-util.c \
+ src/basic/locale-util.h \
+ src/basic/signal-util.c \
+ src/basic/signal-util.h \
+ src/basic/mempool.c \
+ src/basic/mempool.h \
+ src/basic/hashmap.c \
+ src/basic/hashmap.h \
+ src/basic/siphash24.c \
+ src/basic/siphash24.h \
+ src/basic/set.h \
+ src/basic/ordered-set.h \
+ src/basic/fdset.c \
+ src/basic/fdset.h \
+ src/basic/prioq.c \
+ src/basic/prioq.h \
+ src/basic/strv.c \
+ src/basic/strv.h \
+ src/basic/env-util.c \
+ src/basic/env-util.h \
+ src/basic/strbuf.c \
+ src/basic/strbuf.h \
+ src/basic/strxcpyx.c \
+ src/basic/strxcpyx.h \
+ src/basic/log.c \
+ src/basic/log.h \
+ src/basic/bus-label.c \
+ src/basic/bus-label.h \
+ src/basic/ratelimit.h \
+ src/basic/ratelimit.c \
+ src/basic/exit-status.c \
+ src/basic/exit-status.h \
+ src/basic/virt.c \
+ src/basic/virt.h \
+ src/basic/smack-util.c \
+ src/basic/smack-util.h \
+ src/basic/device-nodes.c \
+ src/basic/device-nodes.h \
+ src/basic/utf8.c \
+ src/basic/utf8.h \
+ src/basic/gunicode.c \
+ src/basic/gunicode.h \
+ src/basic/socket-util.c \
+ src/basic/socket-util.h \
+ src/basic/in-addr-util.c \
+ src/basic/in-addr-util.h \
+ src/basic/ether-addr-util.h \
+ src/basic/replace-var.c \
+ src/basic/replace-var.h \
+ src/basic/clock-util.c \
+ src/basic/clock-util.h \
+ src/basic/calendarspec.c \
+ src/basic/calendarspec.h \
+ src/basic/fileio.c \
+ src/basic/fileio.h \
+ src/basic/MurmurHash2.c \
+ src/basic/MurmurHash2.h \
+ src/basic/mkdir.c \
+ src/basic/mkdir.h \
+ src/basic/cgroup-util.c \
+ src/basic/cgroup-util.h \
+ src/basic/errno-list.c \
+ src/basic/errno-list.h \
+ src/basic/af-list.c \
+ src/basic/af-list.h \
+ src/basic/arphrd-list.c \
+ src/basic/arphrd-list.h \
+ src/basic/terminal-util.c \
+ src/basic/terminal-util.h \
+ src/basic/login-util.h \
+ src/basic/login-util.c \
+ src/basic/cap-list.c \
+ src/basic/cap-list.h \
+ src/basic/audit.c \
+ src/basic/audit.h \
+ src/basic/xml.c \
+ src/basic/xml.h \
+ src/basic/json.c \
+ src/basic/json.h \
+ src/basic/ring.c \
+ src/basic/ring.h \
+ src/basic/barrier.c \
+ src/basic/barrier.h \
+ src/basic/async.c \
+ src/basic/async.h \
+ src/basic/memfd-util.c \
+ src/basic/memfd-util.h \
+ src/basic/process-util.c \
+ src/basic/process-util.h \
+ src/basic/random-util.c \
+ src/basic/random-util.h \
+ src/basic/verbs.c \
+ src/basic/verbs.h \
+ src/basic/sigbus.c \
+ src/basic/sigbus.h \
+ src/basic/build.h \
+ src/basic/socket-label.c \
+ src/basic/label.c \
+ src/basic/label.h \
+ src/basic/btrfs-util.c \
+ src/basic/btrfs-util.h \
+ src/basic/btrfs-ctree.h \
+ src/basic/selinux-util.c \
+ src/basic/selinux-util.h \
+ src/basic/mkdir-label.c \
+ src/basic/fileio-label.c \
+ src/basic/fileio-label.h \
+ src/basic/rm-rf.c \
+ src/basic/rm-rf.h \
+ src/basic/copy.c \
+ src/basic/copy.h
+
+nodist_libbasic_la_SOURCES = \
+ src/basic/errno-from-name.h \
+ src/basic/errno-to-name.h \
+ src/basic/af-from-name.h \
+ src/basic/af-to-name.h \
+ src/basic/arphrd-from-name.h \
+ src/basic/arphrd-to-name.h \
+ src/basic/cap-from-name.h \
+ src/basic/cap-to-name.h
+
+libbasic_la_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SELINUX_CFLAGS) \
+ $(CAP_CFLAGS) \
+ -pthread
-libsystemd_shared_la_SOURCES = \
- src/shared/capability.c \
- src/shared/capability.h \
+libbasic_la_LIBADD = \
+ $(SELINUX_LIBS) \
+ $(CAP_LIBS) \
+ -ldl \
+ -lrt \
+ -lm
+
+# -----------------------------------------------------------------------------
+noinst_LTLIBRARIES += \
+ libshared.la
+
+libshared_la_SOURCES = \
+ src/shared/output-mode.h \
+ src/shared/gpt.h \
+ src/shared/udev-util.h \
src/shared/linux/auto_dev-ioctl.h \
- src/shared/ioprio.h \
- src/shared/missing.h \
src/shared/initreq.h \
- src/shared/securebits.h \
- src/shared/special.h \
- src/shared/list.h \
- src/shared/unaligned.h \
- src/shared/macro.h \
- src/shared/def.h \
- src/shared/sparse-endian.h \
- src/shared/refcnt.h \
- src/shared/udev-util.h \
- src/shared/device-nodes.c \
- src/shared/device-nodes.h \
src/shared/dns-domain.c \
src/shared/dns-domain.h \
- src/shared/util.c \
- src/shared/util.h \
- src/shared/virt.c \
- src/shared/virt.h \
src/shared/architecture.c \
src/shared/architecture.h \
src/shared/efivars.c \
@@ -775,238 +928,118 @@ libsystemd_shared_la_SOURCES = \
src/shared/formats-util.h \
src/shared/fstab-util.c \
src/shared/fstab-util.h \
- src/shared/lockfile-util.c \
- src/shared/lockfile-util.h \
- src/shared/path-util.c \
- src/shared/path-util.h \
- src/shared/time-util.c \
- src/shared/time-util.h \
- src/shared/locale-util.c \
- src/shared/locale-util.h \
- src/shared/signal-util.c \
- src/shared/signal-util.h \
- src/shared/mempool.c \
- src/shared/mempool.h \
- src/shared/hashmap.c \
- src/shared/hashmap.h \
- src/shared/siphash24.c \
- src/shared/siphash24.h \
- src/shared/set.h \
- src/shared/ordered-set.h \
- src/shared/fdset.c \
- src/shared/fdset.h \
- src/shared/prioq.c \
- src/shared/prioq.h \
src/shared/sleep-config.c \
src/shared/sleep-config.h \
- src/shared/strv.c \
- src/shared/strv.h \
- src/shared/env-util.c \
- src/shared/env-util.h \
- src/shared/strbuf.c \
- src/shared/strbuf.h \
- src/shared/strxcpyx.c \
- src/shared/strxcpyx.h \
src/shared/conf-parser.c \
src/shared/conf-parser.h \
- src/shared/log.c \
- src/shared/log.h \
- src/shared/ratelimit.h \
- src/shared/ratelimit.c \
- src/shared/exit-status.c \
- src/shared/exit-status.h \
- src/shared/utf8.c \
- src/shared/utf8.h \
- src/shared/gunicode.c \
- src/shared/gunicode.h \
src/shared/pager.c \
src/shared/pager.h \
- src/shared/socket-util.c \
- src/shared/socket-util.h \
- src/shared/in-addr-util.c \
- src/shared/in-addr-util.h \
- src/shared/ether-addr-util.h \
- src/shared/conf-files.c \
- src/shared/conf-files.h \
- src/shared/cgroup-util.c \
- src/shared/cgroup-util.h \
- src/shared/cgroup-show.c \
- src/shared/cgroup-show.h \
- src/shared/unit-name.c \
- src/shared/unit-name.h \
- src/shared/utmp-wtmp.h \
- src/shared/watchdog.c \
- src/shared/watchdog.h \
- src/shared/spawn-ask-password-agent.c \
- src/shared/spawn-ask-password-agent.h \
- src/shared/replace-var.c \
- src/shared/replace-var.h \
src/shared/spawn-polkit-agent.c \
src/shared/spawn-polkit-agent.h \
- src/shared/clock-util.c \
- src/shared/clock-util.h \
- src/shared/calendarspec.c \
- src/shared/calendarspec.h \
- src/shared/fileio.c \
- src/shared/fileio.h \
- src/shared/output-mode.h \
- src/shared/MurmurHash2.c \
- src/shared/MurmurHash2.h \
- src/shared/acpi-fpdt.h \
- src/shared/acpi-fpdt.c \
- src/shared/boot-timestamps.h \
- src/shared/boot-timestamps.c \
- src/shared/mkdir.c \
- src/shared/mkdir.h \
- src/shared/smack-util.c \
- src/shared/smack-util.h \
src/shared/apparmor-util.c \
src/shared/apparmor-util.h \
src/shared/ima-util.c \
src/shared/ima-util.h \
src/shared/ptyfwd.c \
src/shared/ptyfwd.h \
- src/shared/errno-list.c \
- src/shared/errno-list.h \
- src/shared/af-list.c \
- src/shared/af-list.h \
- src/shared/arphrd-list.c \
- src/shared/arphrd-list.h \
- src/shared/cap-list.c \
- src/shared/cap-list.h \
- src/shared/audit.c \
- src/shared/audit.h \
- src/shared/xml.c \
- src/shared/xml.h \
- src/shared/json.c \
- src/shared/json.h \
- src/shared/bus-label.c \
- src/shared/bus-label.h \
- src/shared/gpt.h \
- src/shared/clean-ipc.h \
- src/shared/clean-ipc.c \
- src/shared/login-shared.c \
- src/shared/login-shared.h \
- src/shared/ring.c \
- src/shared/ring.h \
- src/shared/barrier.c \
- src/shared/barrier.h \
src/shared/pty.c \
src/shared/pty.h \
- src/shared/async.c \
- src/shared/async.h \
src/shared/base-filesystem.c \
src/shared/base-filesystem.h \
- src/shared/memfd-util.c \
- src/shared/memfd-util.h \
- src/shared/process-util.c \
- src/shared/process-util.h \
- src/shared/random-util.c \
- src/shared/random-util.h \
- src/shared/terminal-util.c \
- src/shared/terminal-util.h \
src/shared/uid-range.c \
src/shared/uid-range.h \
src/shared/nss-util.h \
- src/shared/verbs.c \
- src/shared/verbs.h \
- src/shared/sigbus.c \
- src/shared/sigbus.h \
- src/shared/build.h \
- src/shared/import-util.c \
- src/shared/import-util.h \
- src/shared/sysctl-util.c \
- src/shared/sysctl-util.h \
- src/shared/hostname-util.h \
- src/shared/hostname-util.c \
- src/shared/socket-label.c \
- src/shared/label.c \
- src/shared/label.h \
- src/shared/selinux-util.c \
- src/shared/selinux-util.h \
- src/shared/mkdir-label.c \
- src/shared/ask-password-api.c \
- src/shared/ask-password-api.h \
- src/shared/switch-root.h \
- src/shared/switch-root.c \
- src/shared/fileio-label.c \
- src/shared/fileio-label.h \
+ src/shared/install.c \
+ src/shared/install.h \
+ src/shared/install-printf.c \
+ src/shared/install-printf.h \
+ src/shared/path-lookup.c \
+ src/shared/path-lookup.h \
+ src/shared/specifier.c \
+ src/shared/specifier.h \
src/shared/dev-setup.c \
src/shared/dev-setup.h \
src/shared/dropin.c \
src/shared/dropin.h \
src/shared/condition.c \
src/shared/condition.h \
+ src/shared/clean-ipc.c \
+ src/shared/clean-ipc.h \
src/shared/generator.h \
src/shared/generator.c \
- src/shared/btrfs-util.c \
- src/shared/btrfs-util.h \
- src/shared/btrfs-ctree.h \
- src/shared/rm-rf.c \
- src/shared/rm-rf.h \
- src/shared/copy.c \
- src/shared/copy.h \
- src/shared/install.c \
- src/shared/install.h \
- src/shared/install-printf.c \
- src/shared/install-printf.h \
- src/shared/path-lookup.c \
- src/shared/path-lookup.h \
- src/shared/specifier.c \
- src/shared/specifier.h
+ src/shared/acpi-fpdt.h \
+ src/shared/acpi-fpdt.c \
+ src/shared/boot-timestamps.h \
+ src/shared/boot-timestamps.c \
+ src/shared/cgroup-show.c \
+ src/shared/cgroup-show.h \
+ src/shared/utmp-wtmp.h \
+ src/shared/watchdog.c \
+ src/shared/watchdog.h \
+ src/shared/spawn-ask-password-agent.c \
+ src/shared/spawn-ask-password-agent.h \
+ src/shared/ask-password-api.c \
+ src/shared/ask-password-api.h \
+ src/shared/switch-root.h \
+ src/shared/switch-root.c \
+ src/shared/import-util.c \
+ src/shared/import-util.h \
+ src/shared/sysctl-util.c \
+ src/shared/sysctl-util.h \
+ src/shared/bus-util.c \
+ src/shared/bus-util.h \
+ src/shared/logs-show.c \
+ src/shared/logs-show.h \
+ src/shared/machine-image.c \
+ src/shared/machine-image.h \
+ src/shared/machine-pool.c \
+ src/shared/machine-pool.h
if HAVE_UTMP
-libsystemd_shared_la_SOURCES += \
+libshared_la_SOURCES += \
src/shared/utmp-wtmp.c
endif
-nodist_libsystemd_shared_la_SOURCES = \
- src/shared/errno-from-name.h \
- src/shared/errno-to-name.h \
- src/shared/af-from-name.h \
- src/shared/af-to-name.h \
- src/shared/arphrd-from-name.h \
- src/shared/arphrd-to-name.h \
- src/shared/cap-from-name.h \
- src/shared/cap-to-name.h
-
-libsystemd_shared_la_CFLAGS = \
- $(AM_CFLAGS) \
- $(SELINUX_CFLAGS) \
- $(CAP_CFLAGS) \
- $(SECCOMP_CFLAGS) \
- -pthread
+if HAVE_SECCOMP
+libshared_la_SOURCES += \
+ src/shared/seccomp-util.h \
+ src/shared/seccomp-util.c
+endif
-libsystemd_shared_la_LIBADD = \
- $(SELINUX_LIBS) \
- $(CAP_LIBS) \
- $(LIBIDN_LIBS) \
- -lm
+if HAVE_ACL
+libshared_la_SOURCES += \
+ src/shared/acl-util.c \
+ src/shared/acl-util.h
+endif
-# -----------------------------------------------------------------------------
-noinst_LTLIBRARIES += \
- libsystemd-machine.la
+libshared_la_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(ACL_CFLAGS) \
+ $(LIBIDN_CFLAGS) \
+ $(SECCOMP_CFLAGS)
-libsystemd_machine_la_SOURCES = \
- src/shared/machine-image.c \
- src/shared/machine-image.h \
- src/shared/machine-pool.c \
- src/shared/machine-pool.h
+libshared_la_LIBADD = \
+ libsystemd-internal.la \
+ libsystemd-journal-internal.la \
+ libudev-internal.la \
+ $(ACL_LIBS) \
+ $(LIBIDN_LIBS) \
+ $(SECCOMP_LIBS)
# -----------------------------------------------------------------------------
if HAVE_LIBIPTC
noinst_LTLIBRARIES += \
- libsystemd-fw.la
+ libfirewall.la
-libsystemd_fw_la_SOURCES = \
- src/shared/fw-util.h \
- src/shared/fw-util.c
+libfirewall_la_SOURCES = \
+ src/shared/firewall-util.h \
+ src/shared/firewall-util.c
-libsystemd_fw_la_CFLAGS = \
+libfirewall_la_CFLAGS = \
$(AM_CFLAGS) \
$(LIBIPTC_CFLAGS)
-libsystemd_fw_la_LIBADD = \
+libfirewall_la_LIBADD = \
$(LIBIPTC_LIBS)
endif
@@ -1020,53 +1053,10 @@ SYSINIT_TARGET_WANTS += \
endif
# ------------------------------------------------------------------------------
-
-if HAVE_SECCOMP
-noinst_LTLIBRARIES += \
- libsystemd-seccomp.la
-
-libsystemd_seccomp_la_SOURCES = \
- src/shared/seccomp-util.h \
- src/shared/seccomp-util.c
-
-libsystemd_seccomp_la_CFLAGS = \
- $(AM_CFLAGS) \
- $(SECCOMP_CFLAGS)
-
-libsystemd_seccomp_la_LIBADD = \
- $(SECCOMP_LIBS)
-endif
-
-# ------------------------------------------------------------------------------
noinst_LTLIBRARIES += \
- libsystemd-logs.la
+ libcore.la
-libsystemd_logs_la_SOURCES = \
- src/shared/logs-show.c \
- src/shared/logs-show.h
-
-# ------------------------------------------------------------------------------
-if HAVE_ACL
-noinst_LTLIBRARIES += \
- libsystemd-acl.la
-
-libsystemd_acl_la_SOURCES = \
- src/shared/acl-util.c \
- src/shared/acl-util.h
-
-libsystemd_acl_la_CFLAGS = \
- $(AM_CFLAGS) \
- $(ACL_CFLAGS)
-
-libsystemd_acl_la_LIBADD = \
- $(ACL_LIBS)
-endif
-
-# ------------------------------------------------------------------------------
-noinst_LTLIBRARIES += \
- libsystemd-core.la
-
-libsystemd_core_la_SOURCES = \
+libcore_la_SOURCES = \
src/core/unit.c \
src/core/unit.h \
src/core/unit-printf.c \
@@ -1188,36 +1178,26 @@ libsystemd_core_la_SOURCES = \
src/core/failure-action.c \
src/core/failure-action.h
-nodist_libsystemd_core_la_SOURCES = \
+nodist_libcore_la_SOURCES = \
src/core/load-fragment-gperf.c \
src/core/load-fragment-gperf-nulstr.c
-libsystemd_core_la_CFLAGS = \
+libcore_la_CFLAGS = \
$(AM_CFLAGS) \
$(PAM_CFLAGS) \
$(AUDIT_CFLAGS) \
$(KMOD_CFLAGS) \
$(APPARMOR_CFLAGS) \
- $(SECCOMP_CFLAGS) \
- $(MOUNT_CFLAGS) \
- -pthread
+ $(MOUNT_CFLAGS)
-libsystemd_core_la_LIBADD = \
- libudev-internal.la \
- libsystemd-shared.la \
- libsystemd-internal.la \
+libcore_la_LIBADD = \
+ libshared.la \
$(PAM_LIBS) \
$(AUDIT_LIBS) \
$(KMOD_LIBS) \
$(APPARMOR_LIBS) \
- $(SECCOMP_LIBS) \
$(MOUNT_LIBS)
-if HAVE_SECCOMP
-libsystemd_core_la_LIBADD += \
- libsystemd-seccomp.la
-endif
-
src/core/load-fragment-gperf-nulstr.c: src/core/load-fragment-gperf.gperf
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ keywords=0 ; FS="," ; print "extern const char load_fragment_gperf_nulstr[];" ; print "const char load_fragment_gperf_nulstr[] ="} ; keyword==1 { print "\"" $$1 "\\0\"" } ; /%%/ { keyword=1} ; END { print ";" }' < $< > $@
@@ -1226,10 +1206,10 @@ gperf_gperf_m4_sources = \
src/core/load-fragment-gperf.gperf.m4
gperf_txt_sources = \
- src/shared/errno-list.txt \
- src/shared/af-list.txt \
- src/shared/arphrd-list.txt \
- src/shared/cap-list.txt
+ src/basic/errno-list.txt \
+ src/basic/af-list.txt \
+ src/basic/arphrd-list.txt \
+ src/basic/cap-list.txt
BUILT_SOURCES += \
$(gperf_gperf_m4_sources:-gperf.gperf.m4=-gperf.c) \
@@ -1259,50 +1239,50 @@ CLEANFILES += \
$(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
-src/shared/errno-list.txt:
+src/basic/errno-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
-src/shared/errno-to-name.h: src/shared/errno-list.txt
+src/basic/errno-to-name.h: src/basic/errno-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
-src/shared/af-list.txt:
+src/basic/af-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include sys/socket.h - </dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' >$@
-src/shared/af-to-name.h: src/shared/af-list.txt
+src/basic/af-to-name.h: src/basic/af-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const af_names[] = { "} !/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
-src/shared/arphrd-list.txt:
+src/basic/arphrd-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include net/if_arp.h - </dev/null | $(AWK) '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $$2; }' | sed -e 's/ARPHRD_//' >$@
-src/shared/arphrd-to-name.h: src/shared/arphrd-list.txt
+src/basic/arphrd-to-name.h: src/basic/arphrd-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const arphrd_names[] = { "} !/CISCO/ { printf "[ARPHRD_%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
-src/shared/arphrd-from-name.gperf: src/shared/arphrd-list.txt
+src/basic/arphrd-from-name.gperf: src/basic/arphrd-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "struct arphrd_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, ARPHRD_%s\n", $$1, $$1 }' <$< >$@
-src/shared/cap-list.txt:
+src/basic/cap-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/capability.h -include missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@
-src/shared/cap-to-name.h: src/shared/cap-list.txt
+src/basic/cap-to-name.h: src/basic/cap-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@
-src/shared/cap-from-name.gperf: src/shared/cap-list.txt
+src/basic/cap-from-name.gperf: src/basic/cap-list.txt
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(AWK) 'BEGIN{ print "struct capability_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
-src/shared/cap-from-name.h: src/shared/cap-from-name.gperf
+src/basic/cap-from-name.h: src/basic/cap-from-name.gperf
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@
@@ -1336,13 +1316,8 @@ src/resolve/dns_type-from-name.gperf: src/resolve/dns_type-list.txt
systemd_SOURCES = \
src/core/main.c
-systemd_CFLAGS = \
- $(AM_CFLAGS) \
- $(SECCOMP_CFLAGS)
-
systemd_LDADD = \
- libsystemd-core.la \
- $(RT_LIBS)
+ libcore.la
dist_pkgsysconf_DATA += \
src/core/system.conf \
@@ -1383,12 +1358,12 @@ manual_tests += \
if HAVE_LIBIPTC
manual_tests += \
- test-fw-util
+ test-firewall-util
endif
if HAVE_KMOD
manual_tests += \
- test-rtnl-manual
+ test-netlink-manual
endif
tests += \
@@ -1535,7 +1510,7 @@ test_device_nodes_SOURCES = \
src/test/test-device-nodes.c
test_device_nodes_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_engine_SOURCES = \
src/test/test-engine.c
@@ -1545,8 +1520,7 @@ test_engine_CFLAGS = \
$(SECCOMP_CFLAGS)
test_engine_LDADD = \
- libsystemd-core.la \
- $(RT_LIBS)
+ libcore.la
test_job_type_SOURCES = \
src/test/test-job-type.c
@@ -1556,8 +1530,7 @@ test_job_type_CFLAGS = \
$(SECCOMP_CFLAGS)
test_job_type_LDADD = \
- libsystemd-core.la \
- $(RT_LIBS)
+ libcore.la
test_ns_SOURCES = \
src/test/test-ns.c
@@ -1567,28 +1540,26 @@ test_ns_CFLAGS = \
$(SECCOMP_CFLAGS)
test_ns_LDADD = \
- libsystemd-core.la
+ libcore.la
test_loopback_SOURCES = \
src/test/test-loopback.c
test_loopback_LDADD = \
- libsystemd-core.la
+ libcore.la
test_hostname_SOURCES = \
src/test/test-hostname.c
test_hostname_LDADD = \
- libsystemd-core.la
+ libcore.la
test_dns_domain_SOURCES = \
src/test/test-dns-domain.c
test_dns_domain_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
- $(LIBIDN_LIBS)
+ libshared.la
if ENABLE_EFI
manual_tests += \
@@ -1598,7 +1569,7 @@ test_boot_timestamp_SOURCES = \
src/test/test-boot-timestamps.c
test_boot_timestamp_LDADD = \
- libsystemd-shared.la
+ libshared.la
endif
test_unit_name_SOURCES = \
@@ -1609,8 +1580,7 @@ test_unit_name_CFLAGS = \
$(SECCOMP_CFLAGS)
test_unit_name_LDADD = \
- libsystemd-core.la \
- $(RT_LIBS)
+ libcore.la
test_unit_file_SOURCES = \
src/test/test-unit-file.c
@@ -1620,137 +1590,133 @@ test_unit_file_CFLAGS = \
$(SECCOMP_CFLAGS)
test_unit_file_LDADD = \
- libsystemd-core.la \
- $(RT_LIBS)
+ libcore.la
test_utf8_SOURCES = \
src/test/test-utf8.c
test_utf8_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_capability_SOURCES = \
src/test/test-capability.c
test_capability_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_async_SOURCES = \
src/test/test-async.c
test_async_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_locale_util_SOURCES = \
src/test/test-locale-util.c
test_locale_util_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_copy_SOURCES = \
src/test/test-copy.c
test_copy_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_sigbus_SOURCES = \
src/test/test-sigbus.c
test_sigbus_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_condition_SOURCES = \
src/test/test-condition.c
test_condition_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
test_fdset_SOURCES = \
src/test/test-fdset.c
test_fdset_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
test_fstab_util_SOURCES = \
src/test/test-fstab-util.c
test_fstab_util_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_ratelimit_SOURCES = \
src/test/test-ratelimit.c
test_ratelimit_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_util_SOURCES = \
src/test/test-util.c
test_util_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_process_util_SOURCES = \
src/test/test-process-util.c
test_process_util_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_terminal_util_SOURCES = \
src/test/test-terminal-util.c
test_terminal_util_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_path_lookup_SOURCES = \
src/test/test-path-lookup.c
test_path_lookup_LDADD = \
- -lm \
- libsystemd-shared.la
+ libshared.la
test_uid_range_SOURCES = \
src/test/test-uid-range.c
test_uid_range_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_cap_list_SOURCES = \
src/test/test-cap-list.c
test_cap_list_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_socket_util_SOURCES = \
src/test/test-socket-util.c
test_socket_util_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_ring_SOURCES = \
src/test/test-ring.c
test_ring_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_barrier_SOURCES = \
src/test/test-barrier.c
test_barrier_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_pty_SOURCES = \
src/test/test-pty.c
test_pty_LDADD = \
- libsystemd-core.la
+ libcore.la
test_tmpfiles_SOURCES = \
src/test/test-tmpfiles.c
test_tmpfiles_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_namespace_SOURCES = \
src/test/test-namespace.c
@@ -1759,10 +1725,10 @@ test_verbs_SOURCES = \
src/test/test-verbs.c
test_verbs_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_namespace_LDADD = \
- libsystemd-core.la
+ libcore.la
BUILT_SOURCES += \
src/test/test-hashmap-ordered.c
@@ -1784,34 +1750,34 @@ test_hashmap_SOURCES = \
src/test/test-hashmap-plain.c
test_hashmap_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_set_SOURCES = \
src/test/test-set.c
test_set_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_xml_SOURCES = \
src/test/test-xml.c
test_xml_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_json_SOURCES = \
src/test/test-json.c
test_json_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_list_SOURCES = \
src/test/test-list.c
test_list_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_unaligned_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_unaligned_SOURCES = \
src/test/test-unaligned.c
@@ -1833,131 +1799,124 @@ test_tables_CFLAGS = \
$(SECCOMP_CFLAGS)
test_tables_LDADD = \
- libsystemd-logs.la \
- libsystemd-journal-internal.la \
- libsystemd-journal-core.la \
- libsystemd-core.la \
- libudev-core.la \
- $(RT_LIBS)
+ libjournal-core.la \
+ libcore.la \
+ libudev-core.la
test_prioq_SOURCES = \
src/test/test-prioq.c
test_prioq_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_fileio_SOURCES = \
src/test/test-fileio.c
test_fileio_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_time_SOURCES = \
src/test/test-time.c
test_time_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_architecture_SOURCES = \
src/test/test-architecture.c
test_architecture_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_log_SOURCES = \
src/test/test-log.c
test_log_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_ipcrm_SOURCES = \
src/test/test-ipcrm.c
test_ipcrm_LDADD = \
- libsystemd-shared.la \
- -lrt
+ libshared.la
test_btrfs_SOURCES = \
src/test/test-btrfs.c
test_btrfs_LDADD = \
- libsystemd-shared.la
+ libshared.la
if HAVE_LIBIPTC
-test_fw_util_SOURCES = \
- src/test/test-fw-util.c
+test_firewall_util_SOURCES = \
+ src/test/test-firewall-util.c
-test_fw_util_CFLAGS = \
+test_firewall_util_CFLAGS = \
$(AM_CFLAGS) \
$(LIBIPTC_CFLAGS)
-test_fw_util_LDADD = \
- libsystemd-fw.la \
- libsystemd-shared.la \
+test_firewall_util_LDADD = \
+ libfirewall.la \
+ libshared.la \
$(LIBIPTC_LIBS)
endif
-test_rtnl_manual_SOURCES = \
- src/test/test-rtnl-manual.c
+test_netlink_manual_SOURCES = \
+ src/test/test-netlink-manual.c
-test_rtnl_manual_CFLAGS = \
+test_netlink_manual_CFLAGS = \
$(AM_CFLAGS) \
$(KMOD_CFLAGS)
-test_rtnl_manual_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la \
+test_netlink_manual_LDADD = \
+ libshared.la \
$(KMOD_LIBS)
test_ellipsize_SOURCES = \
src/test/test-ellipsize.c
test_ellipsize_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_date_SOURCES = \
src/test/test-date.c
test_date_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_sleep_SOURCES = \
src/test/test-sleep.c
test_sleep_LDADD = \
- libsystemd-core.la
+ libcore.la
test_replace_var_SOURCES = \
src/test/test-replace-var.c
test_replace_var_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_calendarspec_SOURCES = \
src/test/test-calendarspec.c
test_calendarspec_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_strip_tab_ansi_SOURCES = \
src/test/test-strip-tab-ansi.c
test_strip_tab_ansi_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_daemon_SOURCES = \
src/test/test-daemon.c
test_daemon_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_cgroup_SOURCES = \
src/test/test-cgroup.c
test_cgroup_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
test_cgroup_mask_SOURCES = \
src/test/test-cgroup-mask.c
@@ -1970,40 +1929,37 @@ test_cgroup_mask_CFLAGS = \
$(SECCOMP_CFLAGS)
test_cgroup_mask_LDADD = \
- libsystemd-core.la \
- $(RT_LIBS)
+ libcore.la
test_cgroup_util_SOURCES = \
src/test/test-cgroup-util.c
test_cgroup_util_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
test_env_replace_SOURCES = \
src/test/test-env-replace.c
test_env_replace_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_strbuf_SOURCES = \
src/test/test-strbuf.c
test_strbuf_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_strv_SOURCES = \
src/test/test-strv.c
test_strv_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
test_path_util_SOURCES = \
src/test/test-path-util.c
test_path_util_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_path_SOURCES = \
src/test/test-path.c
@@ -2012,7 +1968,7 @@ test_path_CFLAGS = \
$(AM_CFLAGS)
test_path_LDADD = \
- libsystemd-core.la
+ libcore.la
test_execute_SOURCES = \
src/test/test-execute.c
@@ -2021,26 +1977,25 @@ test_execute_CFLAGS = \
$(AM_CFLAGS)
test_execute_LDADD = \
- libsystemd-core.la
+ libcore.la
test_strxcpyx_SOURCES = \
src/test/test-strxcpyx.c
test_strxcpyx_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_install_SOURCES = \
src/test/test-install.c
test_install_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
test_watchdog_SOURCES = \
src/test/test-watchdog.c
test_watchdog_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_sched_prio_SOURCES = \
src/test/test-sched-prio.c
@@ -2053,28 +2008,26 @@ test_sched_prio_CFLAGS = \
$(SECCOMP_CFLAGS)
test_sched_prio_LDADD = \
- libsystemd-core.la \
- $(RT_LIBS)
+ libcore.la
test_conf_files_SOURCES = \
src/test/test-conf-files.c
test_conf_files_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_conf_parser_SOURCES = \
src/test/test-conf-parser.c
test_conf_parser_LDADD = \
- libsystemd-shared.la
+ libshared.la
test_bus_policy_SOURCES = \
src/bus-proxyd/test-bus-xml-policy.c
test_bus_policy_LDADD = \
- libsystemd-proxy.la \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libbus-proxy-core.la \
+ libshared.la
# ------------------------------------------------------------------------------
## .PHONY so it always rebuilds it
@@ -2126,18 +2079,14 @@ systemd_analyze_CFLAGS = \
$(SECCOMP_CFLAGS)
systemd_analyze_LDADD = \
- libsystemd-core.la \
- libsystemd-shared.la \
- libsystemd-internal.la \
- $(RT_LIBS)
+ libcore.la
# ------------------------------------------------------------------------------
systemd_initctl_SOURCES = \
src/initctl/initctl.c
systemd_initctl_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_update_utmp_SOURCES = \
@@ -2148,8 +2097,7 @@ systemd_update_utmp_CFLAGS = \
$(AUDIT_CFLAGS)
systemd_update_utmp_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(AUDIT_LIBS)
# ------------------------------------------------------------------------------
@@ -2157,8 +2105,7 @@ systemd_update_done_SOURCES = \
src/update-done/update-done.c
systemd_update_done_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_shutdown_SOURCES = \
@@ -2171,9 +2118,7 @@ systemd_shutdown_SOURCES = \
src/core/killall.c
systemd_shutdown_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
if HAVE_KMOD
@@ -2185,7 +2130,7 @@ systemd_modules_load_CFLAGS = \
$(KMOD_CFLAGS)
systemd_modules_load_LDADD = \
- libsystemd-shared.la \
+ libshared.la \
$(KMOD_LIBS)
rootlibexec_PROGRAMS += \
@@ -2216,13 +2161,7 @@ systemd_tmpfiles_SOURCES = \
src/tmpfiles/tmpfiles.c
systemd_tmpfiles_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
-
-if HAVE_ACL
-systemd_tmpfiles_LDADD += \
- libsystemd-acl.la
-endif
+ libshared.la
rootbin_PROGRAMS += \
systemd-tmpfiles
@@ -2279,8 +2218,7 @@ systemd_sysusers_SOURCES = \
src/sysusers/sysusers.c
systemd_sysusers_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
rootbin_PROGRAMS += \
systemd-sysusers
@@ -2320,8 +2258,7 @@ systemd_firstboot_SOURCES = \
src/firstboot/firstboot.c
systemd_firstboot_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la \
+ libshared.la \
-lcrypt
rootbin_PROGRAMS += \
@@ -2344,31 +2281,28 @@ systemd_machine_id_setup_SOURCES = \
src/core/machine-id-setup.h
systemd_machine_id_setup_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_sysctl_SOURCES = \
src/sysctl/sysctl.c
systemd_sysctl_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_sleep_SOURCES = \
src/sleep/sleep.c
systemd_sleep_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_fsck_SOURCES = \
src/fsck/fsck.c
systemd_fsck_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_machine_id_commit_SOURCES = \
@@ -2377,8 +2311,7 @@ systemd_machine_id_commit_SOURCES = \
src/core/machine-id-setup.h
systemd_machine_id_commit_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
SYSINIT_TARGET_WANTS += \
systemd-machine-id-commit.service
@@ -2388,16 +2321,14 @@ systemd_ac_power_SOURCES = \
src/ac-power/ac-power.c
systemd_ac_power_LDADD = \
- libudev-internal.la \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_detect_virt_SOURCES = \
src/detect-virt/detect-virt.c
systemd_detect_virt_LDADD = \
- libsystemd-shared.la
+ libshared.la
INSTALL_EXEC_HOOKS += \
systemd-detect-virt-install-hook
@@ -2407,21 +2338,21 @@ systemd_delta_SOURCES = \
src/delta/delta.c
systemd_delta_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_getty_generator_SOURCES = \
src/getty-generator/getty-generator.c
systemd_getty_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_debug_generator_SOURCES = \
src/debug-generator/debug-generator.c
systemd_debug_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_fstab_generator_SOURCES = \
@@ -2429,14 +2360,14 @@ systemd_fstab_generator_SOURCES = \
src/core/mount-setup.c
systemd_fstab_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_system_update_generator_SOURCES = \
src/system-update-generator/system-update-generator.c
systemd_system_update_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
if ENABLE_HIBERNATE
@@ -2450,14 +2381,13 @@ systemd_hibernate_resume_SOURCES = \
src/hibernate-resume/hibernate-resume.c
systemd_hibernate_resume_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
systemd_hibernate_resume_generator_SOURCES = \
src/hibernate-resume/hibernate-resume-generator.c
systemd_hibernate_resume_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
dist_systemunit_DATA += \
units/hibernate.target \
@@ -2483,7 +2413,7 @@ systemd_efi_boot_generator_SOURCES = \
src/efi-boot-generator/efi-boot-generator.c
systemd_efi_boot_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
if HAVE_BLKID
@@ -2500,8 +2430,7 @@ bootctl_CFLAGS = \
$(BLKID_CFLAGS)
bootctl_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la \
+ libshared.la \
$(BLKID_LIBS)
bin_PROGRAMS += \
@@ -2675,12 +2604,10 @@ systemgenerator_PROGRAMS += \
systemd_gpt_auto_generator_SOURCES = \
src/gpt-auto-generator/gpt-auto-generator.c \
- src/shared/blkid-util.h
+ src/basic/blkid-util.h
systemd_gpt_auto_generator_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(BLKID_LIBS)
systemd_gpt_auto_generator_CFLAGS = \
@@ -2697,8 +2624,7 @@ systemd_dbus1_generator_SOURCES = \
src/dbus1-generator/dbus1-generator.c
systemd_dbus1_generator_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
dbus1-generator-install-hook:
$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(usergeneratordir)
@@ -2720,15 +2646,14 @@ systemd_sysv_generator_SOURCES = \
src/sysv-generator/sysv-generator.c
systemd_sysv_generator_LDADD = \
- libsystemd-core.la \
- libsystemd-shared.la
+ libcore.la
# ------------------------------------------------------------------------------
systemd_rc_local_generator_SOURCES = \
src/rc-local-generator/rc-local-generator.c
systemd_rc_local_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_remount_fs_SOURCES = \
@@ -2737,77 +2662,70 @@ systemd_remount_fs_SOURCES = \
src/core/mount-setup.h
systemd_remount_fs_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_cgroups_agent_SOURCES = \
src/cgroups-agent/cgroups-agent.c
systemd_cgroups_agent_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_escape_SOURCES = \
src/escape/escape.c
systemd_escape_LDADD = \
- libsystemd-shared.la
+ libshared.la
# -----------------------------------------------------------------------------
systemctl_SOURCES = \
src/systemctl/systemctl.c
systemctl_LDADD = \
- libsystemd-logs.la \
- libsystemd-journal-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_notify_SOURCES = \
src/notify/notify.c
systemd_notify_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_path_SOURCES = \
src/path/path.c
systemd_path_LDADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_ask_password_SOURCES = \
src/ask-password/ask-password.c
systemd_ask_password_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_reply_password_SOURCES = \
src/reply-password/reply-password.c
systemd_reply_password_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_cgls_SOURCES = \
src/cgls/cgls.c
systemd_cgls_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_cgtop_SOURCES = \
src/cgtop/cgtop.c
systemd_cgtop_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_nspawn_SOURCES = \
@@ -2819,25 +2737,15 @@ systemd_nspawn_SOURCES = \
systemd_nspawn_CFLAGS = \
$(AM_CFLAGS) \
- $(SECCOMP_CFLAGS) \
$(BLKID_CFLAGS)
systemd_nspawn_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-machine.la \
- libsystemd-shared.la \
+ libshared.la \
$(BLKID_LIBS)
-if HAVE_SECCOMP
-systemd_nspawn_LDADD += \
- libsystemd-seccomp.la \
- $(SECCOMP_LIBS)
-endif
-
if HAVE_LIBIPTC
systemd_nspawn_LDADD += \
- libsystemd-fw.la
+ libfirewall.la
endif
# ------------------------------------------------------------------------------
@@ -2845,14 +2753,13 @@ systemd_run_SOURCES = \
src/run/run.c
systemd_run_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
noinst_LTLIBRARIES += \
- libsystemd-proxy.la
+ libbus-proxy-core.la
-libsystemd_proxy_la_SOURCES = \
+libbus_proxy_core_la_SOURCES = \
src/bus-proxyd/bus-xml-policy.c \
src/bus-proxyd/bus-xml-policy.h \
src/bus-proxyd/driver.c \
@@ -2862,33 +2769,22 @@ libsystemd_proxy_la_SOURCES = \
src/bus-proxyd/synthesize.c \
src/bus-proxyd/synthesize.h
-libsystemd_proxy_la_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
-
-libsystemd_proxy_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+libbus_proxy_core_la_LIBADD = \
+ libshared.la
systemd_bus_proxyd_SOURCES = \
src/bus-proxyd/bus-proxyd.c
-systemd_bus_proxyd_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
-
systemd_bus_proxyd_LDADD = \
- libsystemd-proxy.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libbus-proxy-core.la \
+ libshared.la
systemd_stdio_bridge_SOURCES = \
src/bus-proxyd/stdio-bridge.c
systemd_stdio_bridge_LDADD = \
- libsystemd-proxy.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libbus-proxy-core.la \
+ libshared.la
if ENABLE_KDBUS
nodist_systemunit_DATA += \
@@ -2920,7 +2816,7 @@ systemd_tty_ask_password_agent_SOURCES = \
src/tty-ask-password-agent/tty-ask-password-agent.c
systemd_tty_ask_password_agent_LDADD = \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
libsystemd_internal_la_SOURCES = \
@@ -2929,7 +2825,7 @@ libsystemd_internal_la_SOURCES = \
src/systemd/sd-bus-vtable.h \
src/systemd/sd-utf8.h \
src/systemd/sd-event.h \
- src/systemd/sd-rtnl.h \
+ src/systemd/sd-netlink.h \
src/systemd/sd-resolve.h \
src/systemd/sd-login.h \
src/systemd/sd-id128.h \
@@ -2974,24 +2870,26 @@ libsystemd_internal_la_SOURCES = \
src/libsystemd/sd-bus/bus-convenience.c \
src/libsystemd/sd-bus/bus-track.c \
src/libsystemd/sd-bus/bus-track.h \
- src/libsystemd/sd-bus/bus-util.c \
- src/libsystemd/sd-bus/bus-util.h \
src/libsystemd/sd-bus/bus-slot.c \
src/libsystemd/sd-bus/bus-slot.h \
src/libsystemd/sd-bus/bus-protocol.h \
src/libsystemd/sd-bus/kdbus.h \
+ src/libsystemd/sd-bus/bus-dump.c \
+ src/libsystemd/sd-bus/bus-dump.h \
src/libsystemd/sd-utf8/sd-utf8.c \
src/libsystemd/sd-event/sd-event.c \
src/libsystemd/sd-event/event-util.h \
- src/libsystemd/sd-rtnl/sd-rtnl.c \
- src/libsystemd/sd-rtnl/rtnl-internal.h \
- src/libsystemd/sd-rtnl/rtnl-message.c \
- src/libsystemd/sd-rtnl/rtnl-types.h \
- src/libsystemd/sd-rtnl/rtnl-types.c \
- src/libsystemd/sd-rtnl/rtnl-util.h \
- src/libsystemd/sd-rtnl/rtnl-util.c \
- src/libsystemd/sd-rtnl/local-addresses.h \
- src/libsystemd/sd-rtnl/local-addresses.c \
+ src/libsystemd/sd-netlink/sd-netlink.c \
+ src/libsystemd/sd-netlink/netlink-internal.h \
+ src/libsystemd/sd-netlink/netlink-message.c \
+ src/libsystemd/sd-netlink/netlink-socket.c \
+ src/libsystemd/sd-netlink/rtnl-message.c \
+ src/libsystemd/sd-netlink/netlink-types.h \
+ src/libsystemd/sd-netlink/netlink-types.c \
+ src/libsystemd/sd-netlink/netlink-util.h \
+ src/libsystemd/sd-netlink/netlink-util.c \
+ src/libsystemd/sd-netlink/local-addresses.h \
+ src/libsystemd/sd-netlink/local-addresses.c \
src/libsystemd/sd-id128/sd-id128.c \
src/libsystemd/sd-daemon/sd-daemon.c \
src/libsystemd/sd-login/sd-login.c \
@@ -3008,39 +2906,19 @@ libsystemd_internal_la_SOURCES = \
src/libsystemd/sd-device/device-enumerator-private.h \
src/libsystemd/sd-device/sd-device.c \
src/libsystemd/sd-device/device-private.c \
- src/libsystemd/sd-device/device-private.h
+ src/libsystemd/sd-device/device-private.h \
+ src/libsystemd/sd-resolve/sd-resolve.c \
+ src/libsystemd/sd-resolve/resolve-util.h
nodist_libsystemd_internal_la_SOURCES = \
src/libsystemd/libsystemd.sym
-libsystemd_internal_la_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
-
libsystemd_internal_la_LIBADD = \
- $(RT_LIBS)
-
-libsystemd_resolve_la_SOURCES = \
- src/libsystemd/sd-resolve/sd-resolve.c \
- src/libsystemd/sd-resolve/resolve-util.h
-
-libsystemd_resolve_la_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
-
-libsystemd_resolve_la_LIBADD = \
+ libbasic.la \
-lresolv
noinst_LTLIBRARIES += \
- libsystemd-internal.la \
- libsystemd-resolve.la
-
-libsystemd_dump_la_SOURCES = \
- src/libsystemd/sd-bus/bus-dump.c \
- src/libsystemd/sd-bus/bus-dump.h
-
-noinst_LTLIBRARIES += \
- libsystemd-dump.la
+ libsystemd-internal.la
EXTRA_DIST += \
src/libsystemd/libsystemd.sym.m4 \
@@ -3053,7 +2931,6 @@ BUILT_SOURCES += \
libsystemd_la_SOURCES = \
$(libsystemd_internal_la_SOURCES) \
- $(libsystemd_resolve_la_SOURCES) \
$(libsystemd_journal_internal_la_SOURCES)
nodist_libsystemd_la_SOURCES = \
@@ -3061,7 +2938,6 @@ nodist_libsystemd_la_SOURCES = \
libsystemd_la_CFLAGS = \
$(libsystemd_internal_la_CFLAGS) \
- $(libsystemd_resolve_la_CFLAGS) \
$(libsystemd_journal_internal_la_CFLAGS)
libsystemd_la_LDFLAGS = \
@@ -3070,10 +2946,8 @@ libsystemd_la_LDFLAGS = \
-Wl,--version-script=$(top_builddir)/src/libsystemd/libsystemd.sym
libsystemd_la_LIBADD = \
- libsystemd-shared.la \
$(libsystemd_internal_la_LIBADD) \
- $(libsystemd_journal_internal_la_LIBADD) \
- $(libsystemd_resolve_la_LIBADD)
+ $(libsystemd_journal_internal_la_LIBADD)
libsystemd-install-hook:
libname=libsystemd.so && $(move-to-rootlibdir)
@@ -3099,7 +2973,7 @@ pkginclude_HEADERS += \
if ENABLE_KDBUS
pkginclude_HEADERS += \
src/systemd/sd-utf8.h \
- src/systemd/sd-rtnl.h \
+ src/systemd/sd-netlink.h \
src/systemd/sd-resolve.h \
src/systemd/sd-path.h
endif
@@ -3124,7 +2998,7 @@ tests += \
test-bus-creds \
test-bus-gvariant \
test-event \
- test-rtnl \
+ test-netlink \
test-local-addresses \
test-resolve
@@ -3135,9 +3009,7 @@ test_bus_marshal_SOURCES = \
src/libsystemd/sd-bus/test-bus-marshal.c
test_bus_marshal_LDADD = \
- libsystemd-dump.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)
@@ -3150,19 +3022,13 @@ test_bus_signature_SOURCES = \
src/libsystemd/sd-bus/test-bus-signature.c
test_bus_signature_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_chat_SOURCES = \
src/libsystemd/sd-bus/test-bus-chat.c
-test_bus_chat_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
-
test_bus_chat_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_cleanup_SOURCES = \
src/libsystemd/sd-bus/test-bus-cleanup.c
@@ -3172,46 +3038,31 @@ test_bus_cleanup_CFLAGS = \
$(SECCOMP_CFLAGS)
test_bus_cleanup_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_server_SOURCES = \
src/libsystemd/sd-bus/test-bus-server.c
-test_bus_server_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
-
test_bus_server_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_objects_SOURCES = \
src/libsystemd/sd-bus/test-bus-objects.c
-test_bus_objects_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
-
test_bus_objects_LDADD = \
- libsystemd-dump.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_error_SOURCES = \
src/libsystemd/sd-bus/test-bus-error.c
test_bus_error_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_gvariant_SOURCES = \
src/libsystemd/sd-bus/test-bus-gvariant.c
test_bus_gvariant_LDADD = \
- libsystemd-dump.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(GLIB_LIBS)
test_bus_gvariant_CFLAGS = \
@@ -3222,86 +3073,67 @@ test_bus_creds_SOURCES = \
src/libsystemd/sd-bus/test-bus-creds.c
test_bus_creds_LDADD = \
- libsystemd-dump.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_match_SOURCES = \
src/libsystemd/sd-bus/test-bus-match.c
test_bus_match_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_kernel_SOURCES = \
src/libsystemd/sd-bus/test-bus-kernel.c
test_bus_kernel_LDADD = \
- libsystemd-dump.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_kernel_bloom_SOURCES = \
src/libsystemd/sd-bus/test-bus-kernel-bloom.c
test_bus_kernel_bloom_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_benchmark_SOURCES = \
src/libsystemd/sd-bus/test-bus-benchmark.c
test_bus_benchmark_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_zero_copy_SOURCES = \
src/libsystemd/sd-bus/test-bus-zero-copy.c
test_bus_zero_copy_LDADD = \
- libsystemd-dump.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_bus_introspect_SOURCES = \
src/libsystemd/sd-bus/test-bus-introspect.c
test_bus_introspect_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_event_SOURCES = \
src/libsystemd/sd-event/test-event.c
test_event_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
-test_rtnl_SOURCES = \
- src/libsystemd/sd-rtnl/test-rtnl.c
+test_netlink_SOURCES = \
+ src/libsystemd/sd-netlink/test-netlink.c
-test_rtnl_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+test_netlink_LDADD = \
+ libshared.la
test_local_addresses_SOURCES = \
- src/libsystemd/sd-rtnl/test-local-addresses.c
+ src/libsystemd/sd-netlink/test-local-addresses.c
test_local_addresses_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_resolve_SOURCES = \
src/libsystemd/sd-resolve/test-resolve.c
test_resolve_LDADD = \
- libsystemd-resolve.la \
- libsystemd-internal.la \
- libsystemd-shared.la
-
-test_resolve_CFLAGS = \
- $(AM_CFLAGS) \
- -pthread
+ libshared.la
busctl_SOURCES = \
src/libsystemd/sd-bus/busctl.c \
@@ -3309,9 +3141,7 @@ busctl_SOURCES = \
src/libsystemd/sd-bus/busctl-introspect.h
busctl_LDADD = \
- libsystemd-dump.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
noinst_LTLIBRARIES += \
@@ -3371,9 +3201,6 @@ libsystemd_network_la_SOURCES = \
src/libsystemd-network/sd-lldp.c
libsystemd_network_la_LIBADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
$(KMOD_LIBS)
test_dhcp_option_SOURCES = \
@@ -3383,8 +3210,7 @@ test_dhcp_option_SOURCES = \
test_dhcp_option_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_dhcp_client_SOURCES = \
src/systemd/sd-dhcp-client.h \
@@ -3394,17 +3220,14 @@ test_dhcp_client_SOURCES = \
test_dhcp_client_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
- $(LIBIDN_LIBS)
+ libshared.la
test_dhcp_server_SOURCES = \
src/libsystemd-network/test-dhcp-server.c
test_dhcp_server_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_ipv4ll_SOURCES = \
src/systemd/sd-ipv4ll.h \
@@ -3413,8 +3236,7 @@ test_ipv4ll_SOURCES = \
test_ipv4ll_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_pppoe_SOURCES = \
src/systemd/sd-pppoe.h \
@@ -3422,7 +3244,7 @@ test_pppoe_SOURCES = \
test_pppoe_LDADD = \
libsystemd-network.la \
- libsystemd-shared.la
+ libshared.la
test_icmp6_rs_SOURCES = \
src/systemd/sd-dhcp6-client.h \
@@ -3434,8 +3256,8 @@ test_icmp6_rs_SOURCES = \
test_icmp6_rs_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libudev.la \
+ libshared.la
test_dhcp6_client_SOURCES = \
src/systemd/sd-dhcp6-client.h \
@@ -3446,19 +3268,18 @@ test_dhcp6_client_SOURCES = \
test_dhcp6_client_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libudev.la \
+ libshared.la
test_lldp_SOURCES = \
- src/libsystemd-network/lldp.h \
- src/libsystemd-network/lldp-tlv.h \
- src/libsystemd-network/lldp-tlv.c \
- src/libsystemd-network/test-lldp.c
+ src/libsystemd-network/lldp.h \
+ src/libsystemd-network/lldp-tlv.h \
+ src/libsystemd-network/lldp-tlv.c \
+ src/libsystemd-network/test-lldp.c
test_lldp_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
tests += \
test-dhcp-option \
@@ -3532,9 +3353,7 @@ libsystemd_terminal_la_SOURCES = \
src/libsystemd-terminal/unifont.c
libsystemd_terminal_la_LIBADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(TERMINAL_LIBS)
systemd_consoled_CFLAGS = \
@@ -3552,8 +3371,7 @@ systemd_consoled_SOURCES = \
systemd_consoled_LDADD = \
libsystemd-terminal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(TERMINAL_LIBS)
systemd_evcat_CFLAGS = \
@@ -3565,8 +3383,7 @@ systemd_evcat_SOURCES = \
systemd_evcat_LDADD = \
libsystemd-terminal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(TERMINAL_LIBS)
systemd_modeset_CFLAGS = \
@@ -3578,8 +3395,7 @@ systemd_modeset_SOURCES = \
systemd_modeset_LDADD = \
libsystemd-terminal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(TERMINAL_LIBS)
systemd_subterm_SOURCES = \
@@ -3587,32 +3403,28 @@ systemd_subterm_SOURCES = \
systemd_subterm_LDADD = \
libsystemd-terminal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_term_page_SOURCES = \
src/libsystemd-terminal/test-term-page.c
test_term_page_LDADD = \
libsystemd-terminal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_term_parser_SOURCES = \
src/libsystemd-terminal/test-term-parser.c
test_term_parser_LDADD = \
libsystemd-terminal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_unifont_SOURCES = \
src/libsystemd-terminal/test-unifont.c
test_unifont_LDADD = \
libsystemd-terminal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
src/libsystemd-terminal/unifont-glyph-array.bin: tools/compile-unifont.py $(UNIFONT)
$(AM_V_GEN)$(PYTHON) $< <$(UNIFONT) >$@
@@ -3651,8 +3463,7 @@ libudev_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/libudev/libudev.sym
libudev_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libsystemd-internal.la
pkgconfiglib_DATA += \
src/libudev/libudev.pc
@@ -3795,10 +3606,8 @@ libudev_core_la_CFLAGS = \
$(KMOD_CFLAGS)
libudev_core_la_LIBADD = \
- libudev-internal.la \
- libsystemd-internal.la \
libsystemd-network.la \
- libsystemd-shared.la \
+ libshared.la \
$(BLKID_LIBS) \
$(KMOD_LIBS)
@@ -3821,9 +3630,6 @@ libudev_core_la_SOURCES += \
src/login/logind-acl.c \
src/libsystemd/sd-login/sd-login.c \
src/systemd/sd-login.h
-
-libudev_core_la_LIBADD += \
- libsystemd-acl.la
endif
systemd_udevd_SOURCES = \
@@ -3858,9 +3664,7 @@ systemd_hwdb_SOURCES = \
src/hwdb/hwdb.c
systemd_hwdb_LDADD = \
- libudev-internal.la \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
rootbin_PROGRAMS += \
systemd-hwdb
@@ -3927,9 +3731,7 @@ test_libudev_SOURCES = \
src/test/test-libudev.c
test_libudev_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_udev_SOURCES = \
src/test/test-udev.c
@@ -3937,13 +3739,7 @@ test_udev_SOURCES = \
test_udev_LDADD = \
libudev-core.la \
$(BLKID_LIBS) \
- $(KMOD_LIBS) \
- $(SELINUX_LIBS)
-
-if HAVE_ACL
-test_udev_LDADD += \
- libsystemd-acl.la
-endif
+ $(KMOD_LIBS)
check_DATA += \
test/sys
@@ -3971,9 +3767,7 @@ ata_id_SOURCES = \
src/udev/ata_id/ata_id.c
ata_id_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
udevlibexec_PROGRAMS += \
ata_id
@@ -3983,9 +3777,7 @@ cdrom_id_SOURCES = \
src/udev/cdrom_id/cdrom_id.c
cdrom_id_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
udevlibexec_PROGRAMS += \
cdrom_id
@@ -3998,9 +3790,7 @@ collect_SOURCES = \
src/udev/collect/collect.c
collect_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
udevlibexec_PROGRAMS += \
collect
@@ -4013,9 +3803,7 @@ scsi_id_SOURCES =\
src/udev/scsi_id/scsi_id.h
scsi_id_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
udevlibexec_PROGRAMS += \
scsi_id
@@ -4028,9 +3816,7 @@ v4l_id_SOURCES = \
src/udev/v4l_id/v4l_id.c
v4l_id_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
udevlibexec_PROGRAMS += \
v4l_id
@@ -4043,9 +3829,7 @@ accelerometer_SOURCES = \
src/udev/accelerometer/accelerometer.c
accelerometer_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
udevlibexec_PROGRAMS += \
accelerometer
@@ -4070,8 +3854,7 @@ test_id128_SOURCES = \
src/test/test-id128.c
test_id128_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
tests += \
test-id128
@@ -4085,8 +3868,7 @@ systemd_activate_SOURCES = \
src/activate/activate.c
systemd_activate_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
# ------------------------------------------------------------------------------
systemd_journald_SOURCES = \
@@ -4094,15 +3876,14 @@ systemd_journald_SOURCES = \
src/journal/journald-server.h
systemd_journald_LDADD = \
- libsystemd-journal-core.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libjournal-core.la \
+ libshared.la
systemd_cat_SOURCES = \
src/journal/cat.c
systemd_cat_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
if HAVE_MICROHTTPD
rootlibexec_PROGRAMS += \
@@ -4117,8 +3898,7 @@ systemd_journal_remote_SOURCES = \
src/journal-remote/journal-remote.c
systemd_journal_remote_LDADD = \
- libsystemd-internal.la \
- libsystemd-journal-core.la
+ libjournal-core.la
systemd_journal_remote_SOURCES += \
src/journal-remote/microhttpd-util.h \
@@ -4184,9 +3964,7 @@ systemd_journal_upload_CFLAGS = \
$(LIBCURL_CFLAGS)
systemd_journal_upload_LDADD = \
- libsystemd-internal.la \
- libsystemd-journal-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(LIBCURL_LIBS)
nodist_systemunit_DATA += \
@@ -4209,15 +3987,7 @@ journalctl_SOURCES = \
src/journal/journalctl.c
journalctl_LDADD = \
- libsystemd-journal-internal.la \
- libsystemd-internal.la \
- libsystemd-logs.la \
- libsystemd-shared.la
-
-if HAVE_ACL
-journalctl_LDADD += \
- libsystemd-acl.la
-endif
+ libshared.la
if HAVE_QRENCODE
journalctl_SOURCES += \
@@ -4235,67 +4005,67 @@ test_journal_SOURCES = \
src/journal/test-journal.c
test_journal_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_send_SOURCES = \
src/journal/test-journal-send.c
test_journal_send_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_syslog_SOURCES = \
src/journal/test-journal-syslog.c
test_journal_syslog_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_match_SOURCES = \
src/journal/test-journal-match.c
test_journal_match_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_enum_SOURCES = \
src/journal/test-journal-enum.c
test_journal_enum_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_stream_SOURCES = \
src/journal/test-journal-stream.c
test_journal_stream_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_flush_SOURCES = \
src/journal/test-journal-flush.c
test_journal_flush_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_init_SOURCES = \
src/journal/test-journal-init.c
test_journal_init_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_verify_SOURCES = \
src/journal/test-journal-verify.c
test_journal_verify_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_journal_interleaving_SOURCES = \
src/journal/test-journal-interleaving.c
test_journal_interleaving_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_mmap_cache_SOURCES = \
src/journal/test-mmap-cache.c
test_mmap_cache_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_catalog_SOURCES = \
src/journal/test-catalog.c
@@ -4305,29 +4075,27 @@ test_catalog_CPPFLAGS = \
-DCATALOG_DIR=\"$(abs_top_srcdir)/catalog\"
test_catalog_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
test_compress_SOURCES = \
src/journal/test-compress.c
test_compress_LDADD = \
- libsystemd-journal-internal.la \
- libsystemd-shared.la
+ libshared.la
test_compress_benchmark_SOURCES = \
src/journal/test-compress-benchmark.c
test_compress_benchmark_LDADD = \
- libsystemd-journal-internal.la \
- libsystemd-shared.la
+ libshared.la
test_audit_type_SOURCES = \
src/journal/test-audit-type.c
test_audit_type_LDADD = \
- libsystemd-journal-core.la
+ libjournal-core.la
-libsystemd_journal_core_la_SOURCES = \
+libjournal_core_la_SOURCES = \
src/journal/journald-kmsg.c \
src/journal/journald-kmsg.h \
src/journal/journald-syslog.c \
@@ -4348,22 +4116,14 @@ libsystemd_journal_core_la_SOURCES = \
src/journal/journald-rate-limit.h \
src/journal/journal-internal.h
-nodist_libsystemd_journal_core_la_SOURCES = \
+nodist_libjournal_core_la_SOURCES = \
src/journal/journald-gperf.c
-libsystemd_journal_core_la_LIBADD = \
- libsystemd-journal-internal.la \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
-
-if HAVE_ACL
-libsystemd_journal_core_la_LIBADD += \
- libsystemd-acl.la
-endif
+libjournal_core_la_LIBADD = \
+ libshared.la
noinst_LTLIBRARIES += \
- libsystemd-journal-core.la
+ libjournal-core.la
journal-install-hook:
-$(MKDIR_P) $(DESTDIR)/var/log/journal
@@ -4512,11 +4272,14 @@ dist_pkgsysconf_DATA += \
src/journal/journald.conf
dist_catalog_DATA = \
+ catalog/systemd.be.catalog \
+ catalog/systemd.be@latin.catalog \
catalog/systemd.fr.catalog \
catalog/systemd.it.catalog \
catalog/systemd.pl.catalog \
catalog/systemd.pt_BR.catalog \
catalog/systemd.ru.catalog \
+ catalog/systemd.zh_TW.catalog \
catalog/systemd.catalog
SOCKETS_TARGET_WANTS += \
@@ -4550,10 +4313,7 @@ systemd_journal_gatewayd_SOURCES = \
src/journal-remote/microhttpd-util.c
systemd_journal_gatewayd_LDADD = \
- libsystemd-logs.la \
- libsystemd-journal-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(MICROHTTPD_LIBS)
if HAVE_GNUTLS
@@ -4589,11 +4349,7 @@ systemd_socket_proxyd_SOURCES = \
src/socket-proxy/socket-proxyd.c
systemd_socket_proxyd_LDADD = \
- libsystemd-logs.la \
- libsystemd-internal.la \
- libsystemd-journal-internal.la \
- libsystemd-shared.la \
- libsystemd-resolve.la
+ libshared.la
# ------------------------------------------------------------------------------
if ENABLE_COREDUMP
@@ -4603,9 +4359,7 @@ systemd_coredump_SOURCES = \
src/journal/coredump-vacuum.h
systemd_coredump_LDADD = \
- libsystemd-journal-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
if HAVE_ELFUTILS
systemd_coredump_SOURCES += \
@@ -4622,18 +4376,11 @@ rootlibexec_PROGRAMS += \
dist_pkgsysconf_DATA += \
src/journal/coredump.conf
-if HAVE_ACL
-systemd_coredump_LDADD += \
- libsystemd-acl.la
-endif
-
coredumpctl_SOURCES = \
src/journal/coredumpctl.c
coredumpctl_LDADD = \
- libsystemd-journal-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
bin_PROGRAMS += \
coredumpctl
@@ -4647,8 +4394,7 @@ test_coredump_vacuum_SOURCES = \
src/journal/coredump-vacuum.h
test_coredump_vacuum_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
dist_bashcompletion_DATA += \
shell-completion/bash/coredumpctl
@@ -4672,7 +4418,7 @@ systemd_binfmt_SOURCES = \
src/binfmt/binfmt.c
systemd_binfmt_LDADD = \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-binfmt
@@ -4703,7 +4449,7 @@ systemd_vconsole_setup_SOURCES = \
src/vconsole/vconsole-setup.c
systemd_vconsole_setup_LDADD = \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-vconsole-setup
@@ -4733,8 +4479,7 @@ systemd_bootchart_SOURCES = \
src/bootchart/svg.h
systemd_bootchart_LDADD = \
- libsystemd-journal-internal.la \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-bootchart
@@ -4761,7 +4506,7 @@ systemd_quotacheck_SOURCES = \
src/quotacheck/quotacheck.c
systemd_quotacheck_LDADD = \
- libsystemd-shared.la
+ libshared.la
endif
EXTRA_DIST += \
@@ -4782,7 +4527,7 @@ systemd_random_seed_SOURCES = \
src/random-seed/random-seed.c
systemd_random_seed_LDADD = \
- libsystemd-shared.la
+ libshared.la
SYSINIT_TARGET_WANTS += \
systemd-random-seed.service
@@ -4804,9 +4549,7 @@ systemd_backlight_SOURCES = \
src/backlight/backlight.c
systemd_backlight_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
endif
EXTRA_DIST += \
@@ -4824,9 +4567,7 @@ systemd_rfkill_SOURCES = \
src/rfkill/rfkill.c
systemd_rfkill_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
endif
EXTRA_DIST += \
@@ -4852,16 +4593,14 @@ systemd_cryptsetup_CFLAGS = \
$(LIBCRYPTSETUP_CFLAGS)
systemd_cryptsetup_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(LIBCRYPTSETUP_LIBS)
systemd_cryptsetup_generator_SOURCES = \
src/cryptsetup/cryptsetup-generator.c
systemd_cryptsetup_generator_LDADD = \
- libsystemd-shared.la
+ libshared.la
SYSINIT_TARGET_WANTS += \
cryptsetup.target
@@ -4874,8 +4613,7 @@ systemd_hostnamed_SOURCES = \
src/hostname/hostnamed.c
systemd_hostnamed_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-hostnamed
@@ -4905,8 +4643,7 @@ hostnamectl_SOURCES = \
src/hostname/hostnamectl.c
hostnamectl_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
bin_PROGRAMS += \
hostnamectl
@@ -4938,8 +4675,7 @@ systemd_localed_SOURCES = \
src/locale/localed.c
systemd_localed_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(XKBCOMMON_LIBS)
systemd_localed_CFLAGS = \
@@ -4978,8 +4714,7 @@ localectl_SOURCES = \
src/locale/localectl.c
localectl_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
bin_PROGRAMS += \
localectl
@@ -5006,8 +4741,7 @@ systemd_timedated_SOURCES = \
src/timedate/timedated.c
systemd_timedated_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-timedated
@@ -5037,8 +4771,7 @@ timedatectl_SOURCES = \
src/timedate/timedatectl.c
timedatectl_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
bin_PROGRAMS += \
timedatectl
@@ -5074,10 +4807,8 @@ gperf_gperf_sources += \
src/timesync/timesyncd-gperf.gperf
systemd_timesyncd_LDADD = \
- libsystemd-resolve.la \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-timesyncd
@@ -5114,8 +4845,7 @@ libnss_myhostname_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/nss-myhostname/nss-myhostname.sym
libnss_myhostname_la_LIBADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
lib_LTLIBRARIES += \
libnss_myhostname.la
@@ -5128,12 +4858,12 @@ systemd_machined_SOURCES = \
src/machine/machined.h
systemd_machined_LDADD = \
- libsystemd-machine-core.la
+ libmachine-core.la
rootlibexec_PROGRAMS += \
systemd-machined
-libsystemd_machine_core_la_SOURCES = \
+libmachine_core_la_SOURCES = \
src/machine/machine.c \
src/machine/machine.h \
src/machine/machined-dbus.c \
@@ -5142,23 +4872,17 @@ libsystemd_machine_core_la_SOURCES = \
src/machine/image-dbus.c \
src/machine/image-dbus.h
-libsystemd_machine_core_la_LIBADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-machine.la \
- libsystemd-shared.la
+libmachine_core_la_LIBADD = \
+ libshared.la
noinst_LTLIBRARIES += \
- libsystemd-machine-core.la
+ libmachine-core.la
machinectl_SOURCES = \
src/machine/machinectl.c
machinectl_LDADD = \
- libsystemd-internal.la \
- libsystemd-logs.la \
- libsystemd-journal-internal.la \
- libsystemd-shared.la
+ libshared.la
rootbin_PROGRAMS += \
machinectl
@@ -5170,7 +4894,7 @@ test_machine_tables_SOURCES = \
src/machine/test-machine-tables.c
test_machine_tables_LDADD = \
- libsystemd-machine-core.la
+ libmachine-core.la
tests += \
test-machine-tables
@@ -5217,8 +4941,7 @@ libnss_mymachines_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/nss-mymachines/nss-mymachines.sym
libnss_mymachines_la_LIBADD = \
- libsystemd-shared.la \
- libsystemd-internal.la
+ libshared.la
lib_LTLIBRARIES += \
libnss_mymachines.la
@@ -5256,9 +4979,7 @@ systemd_importd_CFLAGS = \
-D SYSTEMD_EXPORT_PATH=\"$(rootlibexecdir)/systemd-export\"
systemd_importd_LDADD = \
- libsystemd-machine.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
systemd_pull_SOURCES = \
src/import/pull.c \
@@ -5293,9 +5014,7 @@ systemd_pull_CFLAGS = \
-D USER_KEYRING_PATH=\"$(pkgsysconfdir)/import-pubring.gpg\"
systemd_pull_LDADD = \
- libsystemd-machine.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(LIBCURL_LIBS) \
$(XZ_LIBS) \
$(ZLIB_LIBS) \
@@ -5321,9 +5040,7 @@ systemd_import_CFLAGS = \
$(ZLIB_CFLAGS)
systemd_import_LDADD = \
- libsystemd-machine.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(XZ_LIBS) \
$(ZLIB_LIBS) \
-lbz2
@@ -5345,9 +5062,7 @@ systemd_export_CFLAGS = \
$(ZLIB_CFLAGS)
systemd_export_LDADD = \
- libsystemd-machine.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(XZ_LIBS) \
$(ZLIB_LIBS) \
-lbz2
@@ -5389,8 +5104,7 @@ test_qcow2_CFLAGS = \
$(ZLIB_CFLAGS)
test_qcow2_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(ZLIB_LIBS)
endif
@@ -5460,9 +5174,7 @@ gperf_txt_sources += \
systemd_resolved_LDADD = \
libsystemd-network.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
- $(LIBIDN_LIBS)
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-resolved
@@ -5491,6 +5203,9 @@ GENERAL_ALIASES += \
nodist_pkgsysconf_DATA += \
src/resolve/resolved.conf
+tests += \
+ test-dns-domain
+
libnss_resolve_la_SOURCES = \
src/nss-resolve/nss-resolve.sym \
src/nss-resolve/nss-resolve.c
@@ -5505,8 +5220,7 @@ libnss_resolve_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/nss-resolve/nss-resolve.sym
libnss_resolve_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
lib_LTLIBRARIES += \
libnss_resolve.la
@@ -5529,9 +5243,7 @@ nodist_systemd_resolve_host_SOURCES = \
src/resolve/dns_type-to-name.h
systemd_resolve_host_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la \
- $(LIBIDN_LIBS)
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-resolve-host
@@ -5550,21 +5262,20 @@ systemd_networkd_SOURCES = \
src/network/networkd.c
systemd_networkd_LDADD = \
- libsystemd-networkd-core.la \
- $(LIBIDN_LIBS)
+ libnetworkd-core.la
if HAVE_LIBIPTC
systemd_networkd_LDADD += \
- libsystemd-fw.la
+ libfirewall.la
endif
noinst_LTLIBRARIES += \
- libsystemd-networkd-core.la
+ libnetworkd-core.la
-libsystemd_networkd_core_la_CFLAGS = \
+libnetworkd_core_la_CFLAGS = \
$(AM_CFLAGS)
-libsystemd_networkd_core_la_SOURCES = \
+libnetworkd_core_la_SOURCES = \
src/libsystemd-network/network-internal.h \
src/network/networkd.h \
src/network/networkd-link.h \
@@ -5604,15 +5315,13 @@ libsystemd_networkd_core_la_SOURCES = \
src/network/networkd-fdb.c \
src/network/networkd-address-pool.c
-nodist_libsystemd_networkd_core_la_SOURCES = \
+nodist_libnetworkd_core_la_SOURCES = \
src/network/networkd-network-gperf.c \
src/network/networkd-netdev-gperf.c
-libsystemd_networkd_core_la_LIBADD = \
- libudev-internal.la \
- libsystemd-internal.la \
+libnetworkd_core_la_LIBADD = \
libsystemd-network.la \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-networkd-wait-online
@@ -5630,9 +5339,7 @@ systemd_networkd_wait_online_SOURCES = \
systemd_networkd_wait_online_LDADD = \
libsystemd-network.la \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
rootbin_PROGRAMS += \
networkctl
@@ -5641,21 +5348,18 @@ networkctl_SOURCES = \
src/network/networkctl.c
networkctl_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
libsystemd-network.la
test_network_SOURCES = \
src/network/test-network.c
test_network_LDADD = \
- libsystemd-networkd-core.la \
- $(LIBIDN_LIBS)
+ libnetworkd-core.la
if HAVE_LIBIPTC
test_network_LDADD += \
- libsystemd-fw.la
+ libfirewall.la
endif
test_network_tables_SOURCES = \
@@ -5663,12 +5367,12 @@ test_network_tables_SOURCES = \
src/shared/test-tables.h
test_network_tables_LDADD = \
- libsystemd-networkd-core.la \
+ libnetworkd-core.la \
libudev-core.la
if HAVE_LIBIPTC
test_network_tables_LDADD += \
- libsystemd-fw.la
+ libfirewall.la
endif
tests += \
@@ -5721,9 +5425,9 @@ nodist_systemd_logind_SOURCES = \
src/login/logind-gperf.c
systemd_logind_LDADD = \
- libsystemd-logind-core.la
+ liblogind-core.la
-libsystemd_logind_core_la_SOURCES = \
+liblogind_core_la_SOURCES = \
src/login/logind-core.c \
src/login/logind-device.c \
src/login/logind-device.h \
@@ -5748,21 +5452,16 @@ libsystemd_logind_core_la_SOURCES = \
src/login/logind-utmp.c \
src/login/logind-acl.h
-libsystemd_logind_core_la_LIBADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+liblogind_core_la_LIBADD = \
+ libshared.la
if HAVE_ACL
-libsystemd_logind_core_la_SOURCES += \
+liblogind_core_la_SOURCES += \
src/login/logind-acl.c
-
-libsystemd_logind_core_la_LIBADD += \
- libsystemd-acl.la
endif
noinst_LTLIBRARIES += \
- libsystemd-logind-core.la
+ liblogind-core.la
rootlibexec_PROGRAMS += \
systemd-logind
@@ -5773,11 +5472,7 @@ loginctl_SOURCES = \
src/login/sysfs-show.c
loginctl_LDADD = \
- libudev-internal.la \
- libsystemd-internal.la \
- libsystemd-logs.la \
- libsystemd-journal-internal.la \
- libsystemd-shared.la
+ libshared.la
rootbin_PROGRAMS += \
loginctl
@@ -5793,8 +5488,7 @@ systemd_inhibit_SOURCES = \
src/login/inhibit.c
systemd_inhibit_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
rootbin_PROGRAMS += \
systemd-inhibit
@@ -5803,28 +5497,25 @@ test_login_SOURCES = \
src/libsystemd/sd-login/test-login.c
test_login_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_login_shared_SOURCES = \
src/login/test-login-shared.c
test_login_shared_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_inhibit_SOURCES = \
src/login/test-inhibit.c
test_inhibit_LDADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libshared.la
test_login_tables_SOURCES = \
src/login/test-login-tables.c
test_login_tables_LDADD = \
- libsystemd-logind-core.la
+ liblogind-core.la
manual_tests += \
test-login \
@@ -5853,8 +5544,7 @@ pam_systemd_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/login/pam_systemd.sym
pam_systemd_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-shared.la \
+ libshared.la \
$(PAM_LIBS)
pamlib_LTLIBRARIES = \
@@ -5926,7 +5616,7 @@ systemd_user_sessions_SOURCES = \
src/user-sessions/user-sessions.c
systemd_user_sessions_LDADD = \
- libsystemd-shared.la
+ libshared.la
rootlibexec_PROGRAMS += \
systemd-user-sessions
@@ -5992,7 +5682,7 @@ id128_la_LDFLAGS = \
id128_la_LIBADD = \
$(PYTHON_DEVEL_LIBS) \
- libsystemd-shared.la \
+ libshared.la \
libsystemd.la
_daemon_la_SOURCES = \
@@ -6014,7 +5704,7 @@ _daemon_la_LDFLAGS = \
_daemon_la_LIBADD = \
$(PYTHON_DEVEL_LIBS) \
- libsystemd-shared.la \
+ libshared.la \
libsystemd.la
_reader_la_SOURCES = \
@@ -6035,7 +5725,7 @@ _reader_la_LDFLAGS = \
_reader_la_LIBADD = \
$(PYTHON_DEVEL_LIBS) \
- libsystemd-shared.la \
+ libshared.la \
libsystemd.la
login_la_SOURCES = \
@@ -6056,7 +5746,7 @@ login_la_LDFLAGS = \
login_la_LIBADD = \
$(PYTHON_DEVEL_LIBS) \
- libsystemd-shared.la \
+ libshared.la \
libsystemd.la
dist_pkgpyexec_PYTHON = \
@@ -6128,8 +5818,7 @@ libsystemd_journal_la_LDFLAGS = \
libsystemd_journal_la_LIBADD = \
libsystemd-journal-internal.la \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libsystemd-internal.la
libsystemd_login_la_SOURCES = \
libsystemd-login.c \
@@ -6145,8 +5834,7 @@ libsystemd_login_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/compat-libs/libsystemd-login.sym
libsystemd_login_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libsystemd-internal.la
libsystemd_id128_la_SOURCES = \
libsystemd-id128.c \
@@ -6162,8 +5850,7 @@ libsystemd_id128_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/compat-libs/libsystemd-id128.sym
libsystemd_id128_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libsystemd-internal.la
libsystemd_daemon_la_SOURCES = \
libsystemd-daemon.c \
@@ -6179,8 +5866,7 @@ libsystemd_daemon_la_LDFLAGS = \
-Wl,--version-script=$(top_srcdir)/src/compat-libs/libsystemd-daemon.sym
libsystemd_daemon_la_LIBADD = \
- libsystemd-internal.la \
- libsystemd-shared.la
+ libsystemd-internal.la
lib_LTLIBRARIES += \
libsystemd-journal.la \
diff --git a/README b/README
index 777b34335e..651aa98377 100644
--- a/README
+++ b/README
@@ -30,8 +30,8 @@ AUTHOR:
LICENSE:
LGPLv2.1+ for all code
- - except src/shared/MurmurHash2.c which is Public Domain
- - except src/shared/siphash24.c which is CC0 Public Domain
+ - except src/basic/MurmurHash2.c which is Public Domain
+ - except src/basic/siphash24.c which is CC0 Public Domain
- except src/journal/lookup3.c which is Public Domain
- except src/udev/* which is (currently still) GPLv2, GPLv2+
diff --git a/TODO b/TODO
index db3205c9e8..3cc3596273 100644
--- a/TODO
+++ b/TODO
@@ -26,6 +26,10 @@ External:
Features:
+* install: include generator dirs in unit file search paths
+
+* networkd: add ipv6 privacy extensions
+
* introduce an NSS module that uses machined info to give container UIDs pretty names when user namespacing is used.
* stop using off_t, it's a crazy type. Use uint64_t instead.
diff --git a/catalog/systemd.be.catalog b/catalog/systemd.be.catalog
new file mode 100644
index 0000000000..be081d6efc
--- /dev/null
+++ b/catalog/systemd.be.catalog
@@ -0,0 +1,260 @@
+# This file is part of systemd.
+#
+# Copyright 2012 Lennart Poettering
+# Copyright 2015 Viktar Vaŭčkievič
+#
+# systemd 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.1 of the License, or
+# (at your option) any later version.
+#
+# systemd 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+# Message catalog for systemd's own messages
+# Belarusian translation
+
+# The catalog format is documented on
+# Фармат каталога апісаны на старонцы
+# http://www.freedesktop.org/wiki/Software/systemd/catalog
+
+# For an explanation why we do all this, see https://xkcd.com/1024/
+
+-- f77379a8490b408bbe5f6940505a777b
+Subject: Сэрвіс журналявання запусціўся
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Працэс сістэмнага журналявання запусціўся, адкрыў файлы для
+запісу і гатовы апрацоўваць запыты.
+
+-- d93fb3c9c24d451a97cea615ce59c00b
+Subject: Сэрвіс журналявання спыніўся
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Працэс сістэмнага журналявання спыніўся і закрыў усе файлы.
+
+-- a596d6fe7bfa4994828e72309e95d61e
+Subject: Паведамленні з сэрвісу адкінуты
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: man:journald.conf(5)
+
+Сэрвіс адправіў занадта штат паведамленняў за кароткі прамежак часу.
+Частка паведамленняў была адкінута.
+
+Майце на ўвазе, што былі адкінуты паведамлення толькі гэтага сэрвісу.
+Паведамленні іншых сэрвісаў засталіся.
+
+Мяжа, пасля якой паведамленні будуць адкінуты, наладжваецца з
+дапамогай RateLimitInterval= і RateLimitBurst= у файле
+/etc/systemd/journald.conf. Глядзіце journald.conf(5) для дэталей.
+
+-- e9bf28e6e834481bb6f48f548ad13606
+Subject: Паведамленні страчаны
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Паведамленні ядра былі страчаны, так як сістэма журналявання не паспела
+іх апрацаваць.
+
+-- fc2e22bc6ee647b6b90729ab34a250b1
+Subject: Працэс @COREDUMP_PID@ (@COREDUMP_COMM@) скінуў дамп памяці
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: man:core(5)
+
+Працэс @COREDUMP_PID@ (@COREDUMP_COMM@) разбіўся і скінуў дамп памяці.
+
+Звычайна гэта сведчыць аб памылцы ў праграмным кодзе.
+Рэкамендуецца паведаміць аб гэтым распрацоўнікам.
+
+-- 8d45620c1a4348dbb17410da57c60c66
+Subject: Новая сесія № @SESSION_ID@ створана для карыстальніка @USER_ID@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Новая сесія з № @SESSION_ID@ створана для карыстальніка @USER_ID@.
+
+Лідар гэтай сесіі пад № @LEADER@.
+
+-- 3354939424b4456d9802ca8333ed424a
+Subject: Сесія № @SESSION_ID@ спынена
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Сесія № @SESSION_ID@ спынена.
+
+-- fcbefc5da23d428093f97c82a9290f7b
+Subject: Даступна новае працоўнае месца № @SEAT_ID@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Новае працоўнае месца № @SEAT_ID@ наладжана і даступна для выкарыстання.
+
+-- e7852bfe46784ed0accde04bc864c2d5
+Subject: Працоўнае месца № @SEAT_ID@ выдалена
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Працоўнае месца № @SEAT_ID@ выдалена і больш не даступна.
+
+-- c7a787079b354eaaa9e77b371893cd27
+Subject: Час зменены
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Сістэмны гадзіннік зменены на @REALTIME@ мікрасекунд ад 1 студзеня 1970.
+
+-- 45f82f4aef7a4bbf942ce861d1f20990
+Subject: Часавы пояс зменены на @TIMEZONE@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Сістэмны часавы пояс зменены на @TIMEZONE@.
+
+-- b07a249cd024414a82dd00cd181378ff
+Subject: Запуск сістэмы завяршыўся
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Усе сістэмныя сэрвісы, неабходныя для загрузкі сістэмы, паспяхова
+запусціліся. Майце на ўвазе, што гэта не значыць, што машына нічога не
+робіць. Магчыма, некаторыя сэрвісы яшчэ ініцыялізіруюцца.
+
+На запуск ядра спатрэбілася @KERNEL_USEC@ мікрасекунд.
+
+На запуск пачатковага RAM-дыска спатрэбілася @INITRD_USEC@ мікрасекунд.
+
+На запуск сістэмных сэрвісаў спатрэбілася @USERSPACE_USEC@ мікрасекунд.
+
+-- 6bbd95ee977941e497c48be27c254128
+Subject: Сістэма перайшла ў стан сну @SLEEP@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Цяпер сістэма перайшла у стан сну @SLEEP@.
+
+-- 8811e6df2a8e40f58a94cea26f8ebf14
+Subject: Сістэма выйшла са стана сну @SLEEP@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Цяпер сістэма выйшла са стана сну @SLEEP@.
+
+-- 98268866d1d54a499c4e98921d93bc40
+Subject: Сістэма завяршае работу
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Пачаўся працэс выключэння сістэмы.
+Спыняюцца ўсе сістэмныя сэрвісы і дэмантуюцца файлавыя сістэмы.
+
+-- 7d4958e842da4a758f6c1cdc7b36dcc5
+Subject: Юніт @UNIT@ запускаецца
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Пачаўся працэс запуску юніта @UNIT@.
+
+-- 39f53479d3a045ac8e11786248231fbf
+Subject: Юніт @UNIT@ запусціўся
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Працэс запуску юніта @UNIT@ завершаны.
+
+Вынік: @RESULT@.
+
+-- de5b426a63be47a7b6ac3eaac82e2f6f
+Subject: Юніт @UNIT@ спыняецца
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Пачаўся працэс спынення юніта @UNIT@.
+
+-- 9d1aaa27d60140bd96365438aad20286
+Subject: Юніт @UNIT@ спынены
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Працэс спынення юніта @UNIT@ завершаны.
+
+-- be02cf6855d2428ba40df7e9d022f03d
+Subject: Збой юніта @UNIT@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Збой юніта @UNIT@.
+
+Вынік: @RESULT@.
+
+-- d34d037fff1847e6ae669a370e694725
+Subject: Юніт @UNIT@ перачытвае сваю канфігурацыю
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Юніт @UNIT@ пачаў перачытваць сваю канфігурацыю.
+
+-- 7b05ebc668384222baa8881179cfda54
+Subject: Юніт @UNIT@ перачытаў сваю канфігурацыю
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Юніт @UNIT@ перачытаў сваю канфігурацыю.
+
+Вынік: @RESULT@.
+
+-- 641257651c1b4ec9a8624d7a40a9e1e7
+Subject: Працэс @EXECUTABLE@ не можа быць выкананы
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Працэс @EXECUTABLE@ не можа быць выкананы ў выніку збою.
+
+Ён вярнуў памылку нумар @ERRNO@.
+
+-- 0027229ca0644181a76c4e92458afa2e
+Sibject: Адно ці больш паведамленняў не былі накіраваны ў syslog
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Адно ці больш паведамленняў не былі накіраваны ў syslog сэрвіс, які
+выконваецца паралельна з journald. Звычайна гэта значыць, што
+рэалізацыя syslog не паспявае апрацаваць паведамленні з неабходнай
+хуткасцю.
+
+-- 1dee0369c7fc4736b7099b38ecb46ee7
+Subject: Кропка мантавання не пустая
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Каталог @WHERE@ указаны як кропка мантавання (другое поле ў /etc/fstab
+ці Where= поле ў файле юніта systemd) і не пусты. Гэта не перашкаджае
+мантаванню, але існуючыя ў ім файлы будуць недаступны. Для доступу да
+іх, калі ласка, змантуйце гэтую файлавую сістэму ў іншае месца.
+
+-- 24d8d4452573402496068381a6312df2
+Subject: Віртуальная машына або кантэйнер запусціўся
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Віртуальная машына @NAME@ з лідарам № @LEADER@ запусцілася і
+гатова для выкарыстання.
+
+-- 58432bd3bace477cb514b56381b8a758
+Subject: Віртуальная машына або кантэйнер спынены
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Віртуальная машына @NAME@ з лідарам № @LEADER@ спынена.
diff --git a/catalog/systemd.be@latin.catalog b/catalog/systemd.be@latin.catalog
new file mode 100644
index 0000000000..382fdb8b04
--- /dev/null
+++ b/catalog/systemd.be@latin.catalog
@@ -0,0 +1,260 @@
+# This file is part of systemd.
+#
+# Copyright 2012 Lennart Poettering
+# Copyright 2015 Viktar Vaŭčkievič
+#
+# systemd 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.1 of the License, or
+# (at your option) any later version.
+#
+# systemd 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+# Message catalog for systemd's own messages
+# Belarusian Latin translation
+
+# The catalog format is documented on
+# Farmat kataloha apisany na staroncy
+# http://www.freedesktop.org/wiki/Software/systemd/catalog
+
+# For an explanation why we do all this, see https://xkcd.com/1024/
+
+-- f77379a8490b408bbe5f6940505a777b
+Subject: Servis žurnaliavannia zapusciŭsia
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Praces sistemnaha žurnaliavannia zapusciŭsia, adkryŭ fajly dlia
+zapisu i hatovy apracoŭvać zapyty.
+
+-- d93fb3c9c24d451a97cea615ce59c00b
+Subject: Servis žurnaliavannia spyniŭsia
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Praces sistemnaha žurnaliavannia spyniŭsia i zakryŭ usie fajly.
+
+-- a596d6fe7bfa4994828e72309e95d61e
+Subject: Paviedamlienni z servisu adkinuty
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: man:journald.conf(5)
+
+Servis adpraviŭ zanadta štat paviedamlienniaŭ za karotki pramiežak času.
+Častka paviedamlienniaŭ byla adkinuta.
+
+Majcie na ŭvazie, što byli adkinuty paviedamliennia toĺki hetaha servisu.
+Paviedamlienni inšych servisaŭ zastalisia.
+
+Miaža, paslia jakoj paviedamlienni buduć adkinuty, naladžvajecca z
+dapamohaj RateLimitInterval= i RateLimitBurst= u fajlie
+/etc/systemd/journald.conf. Hliadzicie journald.conf(5) dlia detaliej.
+
+-- e9bf28e6e834481bb6f48f548ad13606
+Subject: Paviedamlienni stračany
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Paviedamlienni jadra byli stračany, tak jak sistema žurnaliavannia nie paspiela
+ich apracavać.
+
+-- fc2e22bc6ee647b6b90729ab34a250b1
+Subject: Praces @COREDUMP_PID@ (@COREDUMP_COMM@) skinuŭ damp pamiaci
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: man:core(5)
+
+Praces @COREDUMP_PID@ (@COREDUMP_COMM@) razbiŭsia i skinuŭ damp pamiaci.
+
+Zvyčajna heta sviedčyć ab pamylcy ŭ prahramnym kodzie.
+Rekamiendujecca paviedamić ab hetym raspracoŭnikam.
+
+-- 8d45620c1a4348dbb17410da57c60c66
+Subject: Novaja siesija № @SESSION_ID@ stvorana dlia karystaĺnika @USER_ID@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Novaja siesija z № @SESSION_ID@ stvorana dlia karystaĺnika @USER_ID@.
+
+Lidar hetaj siesii pad № @LEADER@.
+
+-- 3354939424b4456d9802ca8333ed424a
+Subject: Siesija № @SESSION_ID@ spyniena
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Siesija № @SESSION_ID@ spyniena.
+
+-- fcbefc5da23d428093f97c82a9290f7b
+Subject: Dastupna novaje pracoŭnaje miesca № @SEAT_ID@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Novaje pracoŭnaje miesca № @SEAT_ID@ naladžana i dastupna dlia vykarystannia.
+
+-- e7852bfe46784ed0accde04bc864c2d5
+Subject: Pracoŭnaje miesca № @SEAT_ID@ vydaliena
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+Pracoŭnaje miesca № @SEAT_ID@ vydaliena i boĺš nie dastupna.
+
+-- c7a787079b354eaaa9e77b371893cd27
+Subject: Čas zmienieny
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Sistemny hadzinnik zmienieny na @REALTIME@ mikrasiekund ad 1 studzienia 1970.
+
+-- 45f82f4aef7a4bbf942ce861d1f20990
+Subject: Časavy pojas zmienieny na @TIMEZONE@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Sistemny časavy pojas zmienieny na @TIMEZONE@.
+
+-- b07a249cd024414a82dd00cd181378ff
+Subject: Zapusk sistemy zaviaršyŭsia
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Usie sistemnyja servisy, nieabchodnyja dlia zahruzki sistemy, paspiachova
+zapuscilisia. Majcie na ŭvazie, što heta nie značyć, što mašyna ničoha nie
+robić. Mahčyma, niekatoryja servisy jašče inicyjalizirujucca.
+
+Na zapusk jadra spatrebilasia @KERNEL_USEC@ mikrasiekund.
+
+Na zapusk pačatkovaha RAM-dyska spatrebilasia @INITRD_USEC@ mikrasiekund.
+
+Na zapusk sistemnych servisaŭ spatrebilasia @USERSPACE_USEC@ mikrasiekund.
+
+-- 6bbd95ee977941e497c48be27c254128
+Subject: Sistema pierajšla ŭ stan snu @SLEEP@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Ciapier sistema pierajšla u stan snu @SLEEP@.
+
+-- 8811e6df2a8e40f58a94cea26f8ebf14
+Subject: Sistema vyjšla sa stana snu @SLEEP@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Ciapier sistema vyjšla sa stana snu @SLEEP@.
+
+-- 98268866d1d54a499c4e98921d93bc40
+Subject: Sistema zaviaršaje rabotu
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Pačaŭsia praces vykliučennia sistemy.
+Spyniajucca ŭsie sistemnyja servisy i demantujucca fajlavyja sistemy.
+
+-- 7d4958e842da4a758f6c1cdc7b36dcc5
+Subject: Junit @UNIT@ zapuskajecca
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Pačaŭsia praces zapusku junita @UNIT@.
+
+-- 39f53479d3a045ac8e11786248231fbf
+Subject: Junit @UNIT@ zapusciŭsia
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Praces zapusku junita @UNIT@ zavieršany.
+
+Vynik: @RESULT@.
+
+-- de5b426a63be47a7b6ac3eaac82e2f6f
+Subject: Junit @UNIT@ spyniajecca
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Pačaŭsia praces spyniennia junita @UNIT@.
+
+-- 9d1aaa27d60140bd96365438aad20286
+Subject: Junit @UNIT@ spynieny
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Praces spyniennia junita @UNIT@ zavieršany.
+
+-- be02cf6855d2428ba40df7e9d022f03d
+Subject: Zboj junita @UNIT@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Zboj junita @UNIT@.
+
+Vynik: @RESULT@.
+
+-- d34d037fff1847e6ae669a370e694725
+Subject: Junit @UNIT@ pieračytvaje svaju kanfihuracyju
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Junit @UNIT@ pačaŭ pieračytvać svaju kanfihuracyju.
+
+-- 7b05ebc668384222baa8881179cfda54
+Subject: Junit @UNIT@ pieračytaŭ svaju kanfihuracyju
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Junit @UNIT@ pieračytaŭ svaju kanfihuracyju.
+
+Vynik: @RESULT@.
+
+-- 641257651c1b4ec9a8624d7a40a9e1e7
+Subject: Praces @EXECUTABLE@ nie moža być vykanany
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Praces @EXECUTABLE@ nie moža być vykanany ŭ vyniku zboju.
+
+Jon viarnuŭ pamylku numar @ERRNO@.
+
+-- 0027229ca0644181a76c4e92458afa2e
+Sibject: Adno ci boĺš paviedamlienniaŭ nie byli nakiravany ŭ syslog
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Adno ci boĺš paviedamlienniaŭ nie byli nakiravany ŭ syslog servis, jaki
+vykonvajecca paralieĺna z journald. Zvyčajna heta značyć, što
+realizacyja syslog nie paspiavaje apracavać paviedamlienni z nieabchodnaj
+chutkasciu.
+
+-- 1dee0369c7fc4736b7099b38ecb46ee7
+Subject: Kropka mantavannia nie pustaja
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Kataloh @WHERE@ ukazany jak kropka mantavannia (druhoje polie ŭ /etc/fstab
+ci Where= polie ŭ fajlie junita systemd) i nie pusty. Heta nie pieraškadžaje
+mantavanniu, alie isnujučyja ŭ im fajly buduć niedastupny. Dlia dostupu da
+ich, kali laska, zmantujcie hetuju fajlavuju sistemu ŭ inšaje miesca.
+
+-- 24d8d4452573402496068381a6312df2
+Subject: Virtuaĺnaja mašyna abo kantejnier zapusciŭsia
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Virtuaĺnaja mašyna @NAME@ z lidaram № @LEADER@ zapuscilasia i
+hatova dlia vykarystannia.
+
+-- 58432bd3bace477cb514b56381b8a758
+Subject: Virtuaĺnaja mašyna abo kantejnier spynieny
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Virtuaĺnaja mašyna @NAME@ z lidaram № @LEADER@ spyniena.
diff --git a/catalog/systemd.zh_TW.catalog b/catalog/systemd.zh_TW.catalog
new file mode 100644
index 0000000000..027ffe44e5
--- /dev/null
+++ b/catalog/systemd.zh_TW.catalog
@@ -0,0 +1,263 @@
+# This file is part of systemd.
+#
+# Copyright 2012 Lennart Poettering
+# Copyright 2015 Jeff Huang
+#
+# systemd 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.1 of the License, or
+# (at your option) any later version.
+#
+# systemd 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+# Message catalog for systemd's own messages
+# Traditional Chinese translation
+
+# Catalog 的格式記錄於
+# http://www.freedesktop.org/wiki/Software/systemd/catalog
+
+# For an explanation why we do all this, see https://xkcd.com/1024/
+
+-- f77379a8490b408bbe5f6940505a777b
+Subject: 日誌已開始
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+系統日誌行程已啟動,已開啟日誌
+檔案供寫入並準備好對行程的要求做出回應。
+
+-- d93fb3c9c24d451a97cea615ce59c00b
+Subject: 日誌已停止
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+系統日誌行程已關閉,且關閉所有目前
+活躍的日誌檔案。
+
+-- a596d6fe7bfa4994828e72309e95d61e
+Subject: 從服務而來的訊息已被抑制
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: man:journald.conf(5)
+
+有一個服務在一個時間週期內記錄了太多訊息。
+從該服務而來的訊息已被丟棄。
+
+注意,只有有問題的服務之訊息被丟棄,
+其他服務的訊息則不受影響。
+
+可以在 /etc/systemd/journald.conf 中設定
+RateLimitInterval= 以及 RateLimitBurst=
+來控制當訊息要開始被丟棄時的限制。參見 journald.conf(5) 以獲得更多資訊。
+
+-- e9bf28e6e834481bb6f48f548ad13606
+Subject: 日誌訊息已遺失
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+因日誌系統對核心訊息的處理不夠快速,
+部份訊息已遺失。
+
+-- fc2e22bc6ee647b6b90729ab34a250b1
+Subject: 行程 @COREDUMP_PID@ (@COREDUMP_COMM@) 核心傾印
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: man:core(5)
+
+行程 @COREDUMP_PID@ (@COREDUMP_COMM@) 當掉並核心傾印。
+
+這通常代表了在當掉的程式中的一個程式錯誤
+並需要回報錯誤給其開發者。
+
+-- 8d45620c1a4348dbb17410da57c60c66
+Subject: 新的工作階段 @SESSION_ID@ 已為使用者 @USER_ID@ 建立
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+一個新的工作階段,ID @SESSION_ID@ 已為使用者 @USER_ID@ 建立。
+
+這個工作階段的領導行程為 @LEADER@。
+
+-- 3354939424b4456d9802ca8333ed424a
+Subject: 工作階段 @SESSION_ID@ 已結束
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+一個工作階段,ID @SESSION_ID@ 已結束。
+
+-- fcbefc5da23d428093f97c82a9290f7b
+Subject: 新的座位 @SEAT_ID@ 可用
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+一個新的座位 @SEAT_ID@ 已被設定且現在可用。
+
+-- e7852bfe46784ed0accde04bc864c2d5
+Subject: 座位 @SEAT_ID@ 已被移除
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
+
+座位 @SEAT_ID@ 已被移除且不再可用。
+
+-- c7a787079b354eaaa9e77b371893cd27
+Subject: 時間變更
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+系統時間已變更為1970年1月1日後 @REALTIME@ 微秒。
+
+-- 45f82f4aef7a4bbf942ce861d1f20990
+Subject: 時區變更為 @TIMEZONE@
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+系統時區已變更為 @TIMEZONE@。
+
+-- b07a249cd024414a82dd00cd181378ff
+Subject: 系統啟動已完成
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+所有開機所必要的系統服務都已成功啟動。
+注意這並不代表這臺機器有空閒的時間
+可以服務,可能仍忙於完成啟動。
+
+核心啟動需要 @KERNEL_USEC@ 微秒。
+
+初始 RAM 磁碟啟動需要 @INITRD_USEC@ 微秒。
+
+使用者空間啟動需要 @USERSPACE_USEC@ 微秒。
+
+-- 6bbd95ee977941e497c48be27c254128
+Subject: 系統進入 @SLEEP@ 睡眠狀態
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+系統現在已進入 @SLEEP@ 睡眠狀態。
+
+-- 8811e6df2a8e40f58a94cea26f8ebf14
+Subject: 系統離開 @SLEEP@ 睡眠狀態
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+系統現在已離開 @SLEEP@ 睡眠狀態。
+
+-- 98268866d1d54a499c4e98921d93bc40
+Subject: 系統關機開始
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+Systemd 關閉已經開始。關閉已開始且所有系統服務
+都已結束,所有的檔案系統也都已被卸載。
+
+-- 7d4958e842da4a758f6c1cdc7b36dcc5
+Subject: 單位 @UNIT@ 已開始啟動
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+單位 @UNIT@ 已開始啟動。
+
+-- 39f53479d3a045ac8e11786248231fbf
+Subject: 單位 @UNIT@ 啟動已結束
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+單位 @UNIT@ 啟動已結束。
+
+啟動結果為 @RESULT@。
+
+-- de5b426a63be47a7b6ac3eaac82e2f6f
+Subject: 單位 @UNIT@ 已開始關閉
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+單位 @UNIT@ 已開始關閉。
+
+-- 9d1aaa27d60140bd96365438aad20286
+Subject: 單位 @UNIT@ 已關閉結束
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+單位 @UNIT@ 已關閉結束。
+
+-- be02cf6855d2428ba40df7e9d022f03d
+Subject: 單位 @UNIT@ 已失敗
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+單位 @UNIT@ 已失敗。
+
+結果為 @RESULT@。
+
+-- d34d037fff1847e6ae669a370e694725
+Subject: 單位 @UNIT@ 已開始重新載入其設定
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+單位 @UNIT@ 已開始重新載入其設定
+
+-- 7b05ebc668384222baa8881179cfda54
+Subject: 單位 @UNIT@ 已結束重新載入其設定
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+單位 @UNIT@ 已結束重新載入其設定
+
+結果為 @RESULT@。
+
+-- 641257651c1b4ec9a8624d7a40a9e1e7
+Subject: 行程 @EXECUTABLE@ 無法執行
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+行程 @EXECUTABLE@ 無法執行且失敗。
+
+由該行程所回傳的錯誤碼為 @ERRNO@。
+
+-- 0027229ca0644181a76c4e92458afa2e
+Subject: 一個或更多訊息無法被轉發到 syslog
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+一個或更多訊息無法被轉發到 syslog 服務
+以及並行執行的 journald。這通常代表著
+syslog 實作並無未跟上佇列中訊息
+的速度。
+
+-- 1dee0369c7fc4736b7099b38ecb46ee7
+Subject: 掛載點不為空
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+目錄 @WHERE@ 被指定為掛載點(在 /etc/fstab 中的
+第二欄或是在 systemd 單位檔案中的 Where= 欄位)且其不為空。
+這並不會干擾掛載,但在此目錄中已存在的檔案
+會變成無法存取的狀態。要檢視這些 over-mounted 的檔案,
+請手動掛載下面的檔案系統到次要
+位置。
+
+-- 24d8d4452573402496068381a6312df2
+Subject: 虛擬機器或容器已啟動
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+虛擬機器 @NAME@ 包含它的領導 PID @LEADER@ 現在
+已經開始並已經可以使用。
+
+-- 58432bd3bace477cb514b56381b8a758
+Subject: 虛擬機器或容器已結束
+Defined-By: systemd
+Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
+
+虛擬機器 @NAME@ 包含它的領導 PID @LEADER@ 已經
+關閉。
diff --git a/configure.ac b/configure.ac
index 878b23b061..b94dbd1613 100644
--- a/configure.ac
+++ b/configure.ac
@@ -173,6 +173,7 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-Wwrite-strings \
-Wno-unused-parameter \
-Wno-missing-field-initializers \
+ -Wno-unused-result \
-Wno-format-signedness \
-Werror=overflow \
-Wdate-time \
@@ -300,12 +301,6 @@ AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not
CAP_LIBS="$LIBS"
AC_SUBST(CAP_LIBS)
-LIBS=
-AC_SEARCH_LIBS([mq_open], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
-RT_LIBS="$LIBS"
-AC_SUBST(RT_LIBS)
-LIBS="$save_LIBS"
-
AC_CHECK_FUNCS([memfd_create])
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, getrandom, renameat2, kcmp, LO_FLAGS_PARTSCAN],
@@ -1576,7 +1571,6 @@ AC_MSG_RESULT([
sysconf dir: ${sysconfdir}
datarootdir: ${datarootdir}
includedir: ${includedir}
- include_prefix: ${INCLUDE_PREFIX}
lib dir: ${libdir}
rootlib dir: ${with_rootlibdir}
SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
diff --git a/hwdb/20-bluetooth-vendor-product.hwdb b/hwdb/20-bluetooth-vendor-product.hwdb
index 93241ca490..b737e6b308 100644
--- a/hwdb/20-bluetooth-vendor-product.hwdb
+++ b/hwdb/20-bluetooth-vendor-product.hwdb
@@ -1667,3 +1667,42 @@ bluetooth:v0228*
bluetooth:v0229*
ID_VENDOR_FROM_DATABASE=Muoverti Limited
+
+bluetooth:v022A*
+ ID_VENDOR_FROM_DATABASE=Stamer Musikanlagen GMBH
+
+bluetooth:v022B*
+ ID_VENDOR_FROM_DATABASE=Tesla Motors
+
+bluetooth:v022C*
+ ID_VENDOR_FROM_DATABASE=Pharynks Corporation
+
+bluetooth:v022D*
+ ID_VENDOR_FROM_DATABASE=Lupine
+
+bluetooth:v022E*
+ ID_VENDOR_FROM_DATABASE=Siemens AG
+
+bluetooth:v022F*
+ ID_VENDOR_FROM_DATABASE=Huami (Shanghai) Culture Communication CO., LTD
+
+bluetooth:v0230*
+ ID_VENDOR_FROM_DATABASE=Foster Electric Company, Ltd
+
+bluetooth:v0231*
+ ID_VENDOR_FROM_DATABASE=ETA SA
+
+bluetooth:v0232*
+ ID_VENDOR_FROM_DATABASE=x-Senso Solutions Kft
+
+bluetooth:v0233*
+ ID_VENDOR_FROM_DATABASE=Shenzhen SuLong Communication Ltd
+
+bluetooth:v0234*
+ ID_VENDOR_FROM_DATABASE=FengFan (BeiJing) Technology Co, Ltd
+
+bluetooth:v0235*
+ ID_VENDOR_FROM_DATABASE=Qrio Inc
+
+bluetooth:v0236*
+ ID_VENDOR_FROM_DATABASE=Pitpatpet Ltd
diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
index 007c6a809e..d0fc914d17 100644
--- a/hwdb/60-keyboard.hwdb
+++ b/hwdb/60-keyboard.hwdb
@@ -144,6 +144,12 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pnAOA*:pvr*
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAlienware*:pn*
KEYBOARD_KEY_8a=ejectcd
+# Alienware/Dell reserves these keys; safe to apply on all their devices
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAlienware*:pn*:pvr*
+ KEYBOARD_KEY_bf=!prog1 #graphics amplifier, cable plug-in event
+ KEYBOARD_KEY_c1=!prog2 #graphics amplifier, undock-button event
+ KEYBOARD_KEY_c2=!power #graphics amplifier, surprise undock event
+
###########################################################
# Asus
###########################################################
diff --git a/man/hwdb.xml b/man/hwdb.xml
index e6215df738..8a6e26d089 100644
--- a/man/hwdb.xml
+++ b/man/hwdb.xml
@@ -43,15 +43,13 @@
<refsect1><title>Hardware Database Files</title>
<para>The hwdb files are read from the files located in the
- system hwdb directory <filename>&udevlibexecdir;/hwdb.d</filename>,
- the volatile runtime directory <filename>/run/udev/hwdb.d</filename>
+ system hwdb directory <filename>&udevlibexecdir;/hwdb.d</filename>
and the local administration directory <filename>/etc/udev/hwdb.d</filename>.
All hwdb files are collectively sorted and processed in lexical order,
regardless of the directories in which they live. However, files with
identical filenames replace each other. Files in <filename>/etc</filename>
- have the highest priority, files in <filename>/run</filename> take precedence
- over files with the same name in <filename>&rootprefix;/lib</filename>. This can be
- used to override a system-supplied hwdb file with a local file if needed;
+ take precedence over files with the same name in <filename>&rootprefix;/lib</filename>.
+ This can be used to override a system-supplied hwdb file with a local file if needed;
a symlink in <filename>/etc</filename> with the same name as a hwdb file in
<filename>&rootprefix;/lib</filename>, pointing to <filename>/dev/null</filename>,
disables the hwdb file entirely. hwdb files must have the extension
diff --git a/man/sd_bus_creds_get_pid.xml b/man/sd_bus_creds_get_pid.xml
index 54714dea1d..8a193d5a59 100644
--- a/man/sd_bus_creds_get_pid.xml
+++ b/man/sd_bus_creds_get_pid.xml
@@ -299,10 +299,12 @@
identified by the specified PID, with
<citerefentry><refentrytitle>sd_bus_get_name_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
in which case they describe the credentials of a bus peer
- identified by the specified bus name, or with
+ identified by the specified bus name, with
<citerefentry><refentrytitle>sd_bus_get_owner_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
in which case they describe the credentials of the creator of a
- bus.</para>
+ bus, or with
+ <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ in which case they describe the credentials of the sender of the message.</para>
<para><function>sd_bus_creds_get_pid()</function> will retrieve
the PID (process identifier). Similar,
diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml
index b0c88001d4..d14564480d 100644
--- a/man/systemd-cgtop.xml
+++ b/man/systemd-cgtop.xml
@@ -65,10 +65,12 @@
groups of the local Linux control group hierarchy, ordered by
their CPU, memory, or disk I/O load. The display is refreshed in
regular intervals (by default every 1s), similar in style to
- <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
- If <command>systemd-cgtop</command> is not connected to a tty,
- only one iteration is performed and no columns headers are
- printed. This mode is suitable for scripting.</para>
+ <citerefentry project='man-pages'><refentrytitle>top</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
+
+ <para>If <command>systemd-cgtop</command> is not connected to a tty, no
+ column headers are printed and the default is to only run one iteration.
+ The <varname>--iterations</varname> argument, if given, is still honored.
+ This mode is suitable for scripting.</para>
<para>Resource usage is only accounted for control groups in the
relevant hierarchy, i.e. CPU usage is only accounted for control
@@ -143,11 +145,20 @@
</varlistentry>
<varlistentry>
+ <term><option>-r</option></term>
+ <term><option>--raw</option></term>
+
+ <listitem><para>Format byte counts (as in memory usage and IO metrics)
+ with raw numeric values rather than human-readable
+ numbers.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-n</option></term>
<term><option>--iterations=</option></term>
- <listitem><para>Perform only this many iterations.
- </para></listitem>
+ <listitem><para>Perform only this many iterations. A value of 0
+ indicates that the program should run indefinitely.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/man/systemd-gpt-auto-generator.xml b/man/systemd-gpt-auto-generator.xml
index 16ff100d73..d3e02d6f7b 100644
--- a/man/systemd-gpt-auto-generator.xml
+++ b/man/systemd-gpt-auto-generator.xml
@@ -64,13 +64,16 @@
<filename>/home</filename>, <filename>/srv</filename> and swap
partitions and creates mount and swap units for them, based on the
partition type GUIDs of GUID partition tables (GPT). It implements
- the
- <ulink url="http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/">Discoverable
+ the <ulink
+ url="http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/">Discoverable
Partitions Specification</ulink>. Note that this generator has no
- effect on non-GPT systems, on systems where the units are
- explicitly configured (for example, listed in
- <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
- or where the mount points are non-empty.</para>
+ effect on non-GPT systems, or where the directories under the
+ mount points are already non-empty. Also, on systems where the
+ units are explicitly configured (for example, listed in
+ <citerefentry
+ project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
+ the units this generator creates are overriden, but additional
+ automatic dependencies might be created.</para>
<para>This generator will only look for root partitions on the
same physical disk the EFI System Partition (ESP) is located on.
diff --git a/man/systemd.kill.xml b/man/systemd.kill.xml
index ef828e081c..c51cf81320 100644
--- a/man/systemd.kill.xml
+++ b/man/systemd.kill.xml
@@ -139,7 +139,13 @@
by <constant>SIGKILL</constant> (see above and below). For a
list of valid signals, see
<citerefentry project='man-pages'><refentrytitle>signal</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
- Defaults to <constant>SIGTERM</constant>. </para></listitem>
+ Defaults to <constant>SIGTERM</constant>. </para>
+
+ <para>Note that right after sending the signal specified in
+ this setting systemd will always send
+ <constant>SIGCONT</constant>, to ensure that even suspended
+ tasks can be terminated cleanly.</para>
+ </listitem>
</varlistentry>
<varlistentry>
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index bd061c270a..54fef4c9c4 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -366,7 +366,8 @@
the routing table. Takes either a boolean argument, or the
values <literal>ipv4</literal> or <literal>ipv6</literal>,
which only enables IP forwarding for the specified address
- family. This controls the
+ family, or <literal>kernel</literal>, which preserves existing sysctl settings.
+ This controls the
<filename>net.ipv4.conf.&lt;interface&gt;.forwarding</filename>
and
<filename>net.ipv6.conf.&lt;interface&gt;.forwarding</filename>
@@ -375,8 +376,8 @@
for details about sysctl options). Defaults to
<literal>no</literal>.</para>
- <para>Note: unless this option is turned on, no IP
- forwarding is done on this interface, even if this is
+ <para>Note: unless this option is turned on, or set to <literal>kernel</literal>,
+ no IP forwarding is done on this interface, even if this is
globally turned on in the kernel, with the
<filename>net.ipv4.ip_forward</filename> and
<filename>net.ipv4.ip_forward</filename> sysctl
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 0fe694ab7e..e26196323d 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -383,10 +383,21 @@
run, all processes remaining for a service are terminated
according to the <varname>KillMode=</varname> setting (see
<citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
- If this option is not specified, the process is terminated
- immediately when service stop is requested. Specifier and
- environment variable substitution is supported (including
- <varname>$MAINPID</varname>, see above).</para></listitem>
+ If this option is not specified, the process is terminated by
+ sending the signal specified in <varname>KillSignal=</varname>
+ when service stop is requested. Specifier and environment
+ variable substitution is supported (including
+ <varname>$MAINPID</varname>, see above).</para>
+
+ <para>Note that it is usually not sufficient to specify a
+ command for this setting that only asks the service to
+ terminate (for example by queuing some form of termination
+ signal for it), but does not wait for it to do so. Since the
+ remaining processes of the services are killed using
+ <constant>SIGKILL</constant> immediately after the command
+ exited this would not result in a clean stop. The specified
+ command should hence be a synchronous operation, not an
+ asynchronous one.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/man/timesyncd.conf.xml b/man/timesyncd.conf.xml
index c297d3254c..ee054f9ef1 100644
--- a/man/timesyncd.conf.xml
+++ b/man/timesyncd.conf.xml
@@ -75,13 +75,13 @@
<varlistentry>
<term><varname>NTP=</varname></term>
- <listitem><para>A space separated list of NTP servers host
+ <listitem><para>A space separated list of NTP server host
names or IP addresses. During runtime this list is combined
with any per-interface NTP servers acquired from
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
systemd-timesyncd will contact all configured system or
per-interface servers in turn until one is found that
- responds. This setting defaults to the empty
+ responds. This setting defaults to an empty
list.</para></listitem>
</varlistentry>
diff --git a/po/LINGUAS b/po/LINGUAS
index 562c5627be..859d2383af 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -9,3 +9,6 @@ ru
uk
sv
es
+zh_TW
+be
+be@latin
diff --git a/po/be.po b/po/be.po
new file mode 100644
index 0000000000..8746d34aac
--- /dev/null
+++ b/po/be.po
@@ -0,0 +1,502 @@
+# Belarusian translation for systemd.
+# Copyright (C) 2015 systemd's COPYRIGHT HOLDER
+# This file is distributed under the same license as the systemd package.
+#
+# Viktar Vaŭčkievič <victorenator@gmail.com>, 2015.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: systemd master\n"
+"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
+"POT-Creation-Date: 2015-06-08 23:20+0300\n"
+"PO-Revision-Date: 2015-06-14 11:17+0300\n"
+"Last-Translator: Viktar Vaŭčkievič <victorenator@gmail.com>\n"
+"Language: be\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
+"X-Generator: Lokalize 1.5\n"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "Адправіць пароль назад сістэме"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr "Неабходна аўтэнтыфікацыя для адпраўкі пароля назад сістэме."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Manage system services or other units"
+msgstr "Кіраваць сэрвісамі і іншымі сістэмнымі адзінкамі"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to manage system services or other units."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для кіравання сэрвісамі і іншымі сістэмнымі "
+"адзінкамі."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
+msgid "Manage system service or unit files"
+msgstr "Кіраваць файламі сэрвісаў і іншых сістэмных адзінак"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:6
+msgid "Authentication is required to manage system service or unit files."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для кіравання файламі сэрвісаў і іншых сістэмных "
+"адзінак."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
+msgid "Set or unset system and service manager environment variables"
+msgstr "Усталяваць або скінуць зменныя асяроддзя сістэмнага мэнэджэра"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
+msgid ""
+"Authentication is required to set or unset system and service manager "
+"environment variables."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для ўсталявання або скіду зменных асяроддзя "
+"сістэмнага мэнэджэра."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
+msgid "Reload the systemd state"
+msgstr "Перачытаць стан systemd"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:10
+msgid "Authentication is required to reload the systemd state."
+msgstr "Неабходна аўтэнтыфікацыя для перачытання стану systemd."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "Усталяваць імя вузла"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "Неабходна аўтэнтыфікацыя для ўсталявання імя вузла."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "Усталяваць статычнае імя вузла"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для ўсталявання як статычнага так і прыгожага імя "
+"вузла."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "Усталяваць інфармацыю аб машыне"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для ўсталявання інфармацыі аб лакальнай машыне."
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:1
+msgid "Import a VM or container image"
+msgstr "Імпартаваць вобраз ВМ або кантэйнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:2
+msgid "Authentication is required to import a VM or container image"
+msgstr "Неабходна аўтэнтыфікацыя для імпарту вобраза ВМ або кантэйнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:3
+msgid "Export a VM or container image"
+msgstr "Экспартаваць вобраз ВМ або кантэйнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:4
+msgid "Authentication is required to export a VM or container image"
+msgstr "Неабходна аўтэнтыфікацыя для экспарту вобраза ВМ або кантэйнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:5
+msgid "Download a VM or container image"
+msgstr "Спампаваць вобраз ВМ або кантэйнера"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:6
+msgid "Authentication is required to download a VM or container image"
+msgstr "Неабходна аўтэнтыфікацыя для спампоўкі вобраза ВМ або кантэйнера"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "Усталяваць сістэмную лакаль"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr "Неабходна аўтэнтыфікацыя для ўсталявання сістэмнай лакалі."
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "Усталяваць сістэмныя налады клавіятуры"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr "Неабходна аўтэнтыфікацыя для ўсталявання сістэмных налад клавіятуры."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "Дазволіць праграмам перашкаджаць выключэнню сістэмы"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required for an application to inhibit system shutdown."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам перашкаджаць выключэнню "
+"сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "Дазволіць праграмам затрымліваць выключэнне сістэмы"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid "Authentication is required for an application to delay system shutdown."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам затрымліваць выключэнне "
+"сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "Дазволіць праграмам перашкаджаць засыпанню сістэмы"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid "Authentication is required for an application to inhibit system sleep."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам перашкаджаць засыпанню "
+"сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "Дазволіць праграмам затрымліваць засыпанне сістэмы"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid "Authentication is required for an application to delay system sleep."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам затрымліваць засыпанне "
+"сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr "Дазволіць праграмам перашкаджаць аўтаматычнаму прыпыненню сістэмы"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required for an application to inhibit automatic system "
+"suspend."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам перашкаджаць "
+"аўтаматычнаму прыпыненню сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr ""
+"Дазволіць праграмам перашкаджаць сістэме апрацоўваць клавішу выключэння"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the power key."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам перашкаджаць сістэме "
+"апрацоўваць клавішу выключэння."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr ""
+"Дазволіць праграмам перашкаджаць сістэме апрацоўваць клавішу прыпынення"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the suspend key."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам перашкаджаць сістэме "
+"апрацоўваць клавішу прыпынення."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr ""
+"Дазволіць праграмам перашкаджаць сістэме апрацоўваць клавішу гібернацыі"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the hibernate key."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам перашкаджаць сістэме "
+"апрацоўваць клавішу гібернацыі."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr ""
+"Дазволіць праграмам перашкаджаць сістэме апрацоўваць закрыццё крышкі ноўтбука"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the lid switch."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для дазволу праграмам перашкаджаць сістэме "
+"апрацоўваць закрыццё крышкі ноўтбука."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr ""
+"Дазволіць карыстальнікам, якія яшчэ не ўвайшлі ў сістэму, выконваць праграмы"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid "Authentication is required to run programs as a non-logged-in user."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для выканання праграм карыстальніка, які яшчэ не "
+"ўвайшоў у сістэму."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "Дазволіць далучаць прылады да працоўных месцаў"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr "Неабходна аўтэнтыфікацыя для далучэння прылад да працоўных месцаў."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "Адключаць прылады ад працоўных месцаў"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr "Неабходна аўтэнтыфікацыя для адключэння прылад ад працоўных месцаў."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "Выключыць сістэму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "Неабходна аўтэнтыфікацыя для выключэння сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "Выключыць сістэму пры прысутнасці іншых карыстальнікаў"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для выключэння сістэмы пры прысутнасці іншых "
+"карыстальнікаў."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "Выключыць сістэму, калі праграмы перашкаджаюць гэтаму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для выключэння сістэмы, калі праграмы перашкаджаюць "
+"гэтаму."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "Перазагрузіць сістэму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "Неабходна аўтэнтыфікацыя для перазагрузкі сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "Перазагрузіць сістэму пры прысутнасці іншых карыстальнікаў"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для перазагрузкі сістэмы пры прысутнасці іншых "
+"карыстальнікаў."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "Перазагрузіць сістэму, калі праграмы перашкаджаюць гэтаму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для перазагрузкі сістэмы, калі праграмы "
+"перашкаджаюць гэтаму."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "Прыпыніць сістэму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "Неабходна аўтэнтыфікацыя для прыпынення сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "Прыпыніць сістэму пры прысутнасці іншых карыстальнікаў"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для прыпынення сістэмы пры прысутнасці іншых "
+"карыстальнікаў."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "Прыпыніць сістэму, калі праграмы перашкаджаюць гэтаму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для прыпынення сістэмы, калі праграмы перашкаджаюць "
+"гэтаму."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "Гіберніраваць сістэму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "Неабходна аўтэнтыфікацыя для гібернацыі сістэмы."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "Гіберніраваць сістэму пры прысутнасці іншых карыстальнікаў"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для гібернацыі сістэмы пры прысутнасці іншых "
+"карыстальнікаў."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr "Гіберніраваць сістэму, калі праграмы перашкаджаюць гэтаму"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для гібернацыі сістэмы, калі праграмы перашкаджаюць "
+"гэтаму."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:49
+msgid "Manage active sessions, users and seats"
+msgstr "Кіраваць актыўнымі сесіямі, карыстальнікамі і працоўнымі месцамі"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:50
+msgid ""
+"Authentication is required for managing active sessions, users and seats."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для кіравання актыўнымі сесіямі, карыстальнікамі і "
+"месцамі."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:51
+msgid "Lock or unlock active sessions"
+msgstr "Блакіраваць або разблакіраваць актыўную сесію"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:52
+msgid "Authentication is required to lock or unlock active sessions."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для блакіроўкі або разблакіроўкі актыўнай сесіі."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr "Дазволіць указанне прашыўцы на загрузку інтэрфейсу налад"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для ўказання прашыўцы на загрузку інтэрфейсу налад."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
+msgid "Log into a local container"
+msgstr "Увайсці ў лакальны кантэйнер"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
+msgid "Authentication is required to log into a local container."
+msgstr "Неабходна аўтэнтыфікацыя для ўваходу ў лакальны кантэйнер."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Manage local virtual machines and containers"
+msgstr "Кіраваць лакальнымі віртуальнымі машынамі або кантэйнерамі"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid ""
+"Authentication is required to manage local virtual machines and containers."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для кіравання лакальнымі віртуальнымі машынамі і "
+"кантэйнерамі."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Manage local virtual machine and container images"
+msgstr "Кіраваць вобразамі лакальных віртуальных машын і кантэйнераў"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid ""
+"Authentication is required to manage local virtual machine and container "
+"images."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для кіравання вобразамі лакальных віртуальных машын "
+"і кантэйнераў."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "Усталяваць сістэмны час"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "Неабходна аўтэнтыфікацыя для ўсталявання сістэмнага часу."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "Усталяваць сістэмны часавы пояс"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr "Неабходна аўтэнтыфікацыя для ўсталявання сістэмнага часавога поясу."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "Усталяваць часавы пояс (мясцовы або UTC), у якім RTC захоўвае час"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для ўсталявання часавога поясу (мясцовы або UTC), у "
+"якім захоўваецца час у RTC."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "Уключыць або выключыць сінхранізацыю часу па сетцы"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr ""
+"Неабходна аўтэнтыфікацыя для ўключэння або выключэння сінхранізацыі часу па "
+"сетцы."
diff --git a/po/be@latin.po b/po/be@latin.po
new file mode 100644
index 0000000000..16c003b506
--- /dev/null
+++ b/po/be@latin.po
@@ -0,0 +1,502 @@
+# Belarusian Latin translation for systemd.
+# Copyright (C) 2015 systemd's COPYRIGHT HOLDER
+# This file is distributed under the same license as the systemd package.
+#
+# Viktar Vaŭčkievič <victorenator@gmail.com>, 2015.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: systemd master\n"
+"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
+"POT-Creation-Date: 2015-06-08 23:20+0300\n"
+"PO-Revision-Date: 2015-06-14 11:17+0300\n"
+"Last-Translator: Viktar Vaŭčkievič <victorenator@gmail.com>\n"
+"Language: be\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
+"X-Generator: Lokalize 1.5\n"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "Adpravić paroĺ nazad sistemie"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr "Nieabchodna aŭtentyfikacyja dlia adpraŭki parolia nazad sistemie."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Manage system services or other units"
+msgstr "Kiravać servisami i inšymi sistemnymi adzinkami"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to manage system services or other units."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia kiravannia servisami i inšymi sistemnymi "
+"adzinkami."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
+msgid "Manage system service or unit files"
+msgstr "Kiravać fajlami servisaŭ i inšych sistemnych adzinak"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:6
+msgid "Authentication is required to manage system service or unit files."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia kiravannia fajlami servisaŭ i inšych sistemnych "
+"adzinak."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
+msgid "Set or unset system and service manager environment variables"
+msgstr "Ustaliavać abo skinuć zmiennyja asiaroddzia sistemnaha menedžera"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
+msgid ""
+"Authentication is required to set or unset system and service manager "
+"environment variables."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia abo skidu zmiennych asiaroddzia "
+"sistemnaha menedžera."
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
+msgid "Reload the systemd state"
+msgstr "Pieračytać stan systemd"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:10
+msgid "Authentication is required to reload the systemd state."
+msgstr "Nieabchodna aŭtentyfikacyja dlia pieračytannia stanu systemd."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "Ustaliavać imia vuzla"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia imia vuzla."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "Ustaliavać statyčnaje imia vuzla"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia jak statyčnaha tak i pryhožaha imia "
+"vuzla."
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "Ustaliavać infarmacyju ab mašynie"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia infarmacyi ab lakaĺnaj mašynie."
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:1
+msgid "Import a VM or container image"
+msgstr "Impartavać vobraz VM abo kantejniera"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:2
+msgid "Authentication is required to import a VM or container image"
+msgstr "Nieabchodna aŭtentyfikacyja dlia impartu vobraza VM abo kantejniera"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:3
+msgid "Export a VM or container image"
+msgstr "Ekspartavać vobraz VM abo kantejniera"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:4
+msgid "Authentication is required to export a VM or container image"
+msgstr "Nieabchodna aŭtentyfikacyja dlia ekspartu vobraza VM abo kantejniera"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:5
+msgid "Download a VM or container image"
+msgstr "Spampavać vobraz VM abo kantejniera"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:6
+msgid "Authentication is required to download a VM or container image"
+msgstr "Nieabchodna aŭtentyfikacyja dlia spampoŭki vobraza VM abo kantejniera"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "Ustaliavać sistemnuju lakaĺ"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr "Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia sistemnaj lakali."
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "Ustaliavać sistemnyja nalady klavijatury"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr "Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia sistemnych nalad klavijatury."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "Dazvolić prahramam pieraškadžać vykliučenniu sistemy"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required for an application to inhibit system shutdown."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam pieraškadžać vykliučenniu "
+"sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "Dazvolić prahramam zatrymlivać vykliučennie sistemy"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid "Authentication is required for an application to delay system shutdown."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam zatrymlivać vykliučennie "
+"sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "Dazvolić prahramam pieraškadžać zasypanniu sistemy"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid "Authentication is required for an application to inhibit system sleep."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam pieraškadžać zasypanniu "
+"sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "Dazvolić prahramam zatrymlivać zasypannie sistemy"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid "Authentication is required for an application to delay system sleep."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam zatrymlivać zasypannie "
+"sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr "Dazvolić prahramam pieraškadžać aŭtamatyčnamu prypynienniu sistemy"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required for an application to inhibit automatic system "
+"suspend."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam pieraškadžać "
+"aŭtamatyčnamu prypynienniu sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr ""
+"Dazvolić prahramam pieraškadžać sistemie apracoŭvać klavišu vykliučennia"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the power key."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam pieraškadžać sistemie "
+"apracoŭvać klavišu vykliučennia."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr ""
+"Dazvolić prahramam pieraškadžać sistemie apracoŭvać klavišu prypyniennia"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the suspend key."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam pieraškadžać sistemie "
+"apracoŭvać klavišu prypyniennia."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr ""
+"Dazvolić prahramam pieraškadžać sistemie apracoŭvać klavišu hibiernacyi"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the hibernate key."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam pieraškadžać sistemie "
+"apracoŭvać klavišu hibiernacyi."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr ""
+"Dazvolić prahramam pieraškadžać sistemie apracoŭvać zakryccio kryški noŭtbuka"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the lid switch."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia dazvolu prahramam pieraškadžać sistemie "
+"apracoŭvać zakryccio kryški noŭtbuka."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr ""
+"Dazvolić karystaĺnikam, jakija jašče nie ŭvajšli ŭ sistemu, vykonvać prahramy"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid "Authentication is required to run programs as a non-logged-in user."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia vykanannia prahram karystaĺnika, jaki jašče nie "
+"ŭvajšoŭ u sistemu."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "Dazvolić dalučać prylady da pracoŭnych miescaŭ"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr "Nieabchodna aŭtentyfikacyja dlia dalučennia prylad da pracoŭnych miescaŭ."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "Adkliučać prylady ad pracoŭnych miescaŭ"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr "Nieabchodna aŭtentyfikacyja dlia adkliučennia prylad ad pracoŭnych miescaŭ."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "Vykliučyć sistemu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "Nieabchodna aŭtentyfikacyja dlia vykliučennia sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "Vykliučyć sistemu pry prysutnasci inšych karystaĺnikaŭ"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia vykliučennia sistemy pry prysutnasci inšych "
+"karystaĺnikaŭ."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "Vykliučyć sistemu, kali prahramy pieraškadžajuć hetamu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia vykliučennia sistemy, kali prahramy pieraškadžajuć "
+"hetamu."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "Pierazahruzić sistemu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "Nieabchodna aŭtentyfikacyja dlia pierazahruzki sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "Pierazahruzić sistemu pry prysutnasci inšych karystaĺnikaŭ"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia pierazahruzki sistemy pry prysutnasci inšych "
+"karystaĺnikaŭ."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "Pierazahruzić sistemu, kali prahramy pieraškadžajuć hetamu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia pierazahruzki sistemy, kali prahramy "
+"pieraškadžajuć hetamu."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "Prypynić sistemu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "Nieabchodna aŭtentyfikacyja dlia prypyniennia sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "Prypynić sistemu pry prysutnasci inšych karystaĺnikaŭ"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia prypyniennia sistemy pry prysutnasci inšych "
+"karystaĺnikaŭ."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "Prypynić sistemu, kali prahramy pieraškadžajuć hetamu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia prypyniennia sistemy, kali prahramy pieraškadžajuć "
+"hetamu."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "Hibierniravać sistemu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "Nieabchodna aŭtentyfikacyja dlia hibiernacyi sistemy."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "Hibierniravać sistemu pry prysutnasci inšych karystaĺnikaŭ"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia hibiernacyi sistemy pry prysutnasci inšych "
+"karystaĺnikaŭ."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr "Hibierniravać sistemu, kali prahramy pieraškadžajuć hetamu"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia hibiernacyi sistemy, kali prahramy pieraškadžajuć "
+"hetamu."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:49
+msgid "Manage active sessions, users and seats"
+msgstr "Kiravać aktyŭnymi siesijami, karystaĺnikami i pracoŭnymi miescami"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:50
+msgid ""
+"Authentication is required for managing active sessions, users and seats."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia kiravannia aktyŭnymi siesijami, karystaĺnikami i "
+"miescami."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:51
+msgid "Lock or unlock active sessions"
+msgstr "Blakiravać abo razblakiravać aktyŭnuju siesiju"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:52
+msgid "Authentication is required to lock or unlock active sessions."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia blakiroŭki abo razblakiroŭki aktyŭnaj siesii."
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr "Dazvolić ukazannie prašyŭcy na zahruzku interfiejsu nalad"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia ŭkazannia prašyŭcy na zahruzku interfiejsu nalad."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
+msgid "Log into a local container"
+msgstr "Uvajsci ŭ lakaĺny kantejnier"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
+msgid "Authentication is required to log into a local container."
+msgstr "Nieabchodna aŭtentyfikacyja dlia ŭvachodu ŭ lakaĺny kantejnier."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Manage local virtual machines and containers"
+msgstr "Kiravać lakaĺnymi virtuaĺnymi mašynami abo kantejnierami"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid ""
+"Authentication is required to manage local virtual machines and containers."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia kiravannia lakaĺnymi virtuaĺnymi mašynami i "
+"kantejnierami."
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Manage local virtual machine and container images"
+msgstr "Kiravać vobrazami lakaĺnych virtuaĺnych mašyn i kantejnieraŭ"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid ""
+"Authentication is required to manage local virtual machine and container "
+"images."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia kiravannia vobrazami lakaĺnych virtuaĺnych mašyn "
+"i kantejnieraŭ."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "Ustaliavać sistemny čas"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia sistemnaha času."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "Ustaliavać sistemny časavy pojas"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr "Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia sistemnaha časavoha pojasu."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "Ustaliavać časavy pojas (miascovy abo UTC), u jakim RTC zachoŭvaje čas"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia ŭstaliavannia časavoha pojasu (miascovy abo UTC), u "
+"jakim zachoŭvajecca čas u RTC."
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "Ukliučyć abo vykliučyć sinchranizacyju času pa sietcy"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr ""
+"Nieabchodna aŭtentyfikacyja dlia ŭkliučennia abo vykliučennia sinchranizacyi času pa "
+"sietcy."
diff --git a/po/zh_TW.po b/po/zh_TW.po
new file mode 100644
index 0000000000..77be569d1a
--- /dev/null
+++ b/po/zh_TW.po
@@ -0,0 +1,477 @@
+# Traditional Chinese translation for systemd.
+# Copyright (C) 2015 systemd's COPYRIGHT HOLDER
+# This file is distributed under the same license as the systemd package.
+# Jeff Huang <s8321414@gmail.com>, 2015.
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: https://github.com/systemd/systemd/issues\n"
+"POT-Creation-Date: 2015-06-10 11:41+0000\n"
+"PO-Revision-Date: 2015-06-11 12:44+0800\n"
+"Last-Translator: Jeff Huang <s8321414@gmail.com>\n"
+"Language-Team: chinese-l10n <chinese-l10n@googlegroups.com>\n"
+"Language: zh_TW\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Lokalize 1.5\n"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:1
+msgid "Send passphrase back to system"
+msgstr "傳回密碼片語到系統"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:2
+msgid ""
+"Authentication is required to send the entered passphrase back to the system."
+msgstr "傳回已輸入的密碼片語到系統需要驗證。"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:3
+msgid "Manage system services or other units"
+msgstr "管理系統服務或其他單位"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:4
+msgid "Authentication is required to manage system services or other units."
+msgstr "管理系統服務或其他單位需要驗證。"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:5
+msgid "Manage system service or unit files"
+msgstr "管理系統服務或單位檔案"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:6
+msgid "Authentication is required to manage system service or unit files."
+msgstr "管理系統服務或單位檔案需要驗證。"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:7
+msgid "Set or unset system and service manager environment variables"
+msgstr "設定或取消設定系統及服務管理員環境變量"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:8
+msgid ""
+"Authentication is required to set or unset system and service manager "
+"environment variables."
+msgstr ""
+"設定或取消設定系統及服務管理員環境變量時"
+"需要驗證"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:9
+msgid "Reload the systemd state"
+msgstr "重新載入 systemd 狀態"
+
+#: ../src/core/org.freedesktop.systemd1.policy.in.in.h:10
+msgid "Authentication is required to reload the systemd state."
+msgstr "重新載入 systemd 狀態需要驗證。"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
+msgid "Set host name"
+msgstr "設定主機名稱"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
+msgid "Authentication is required to set the local host name."
+msgstr "設定主機名稱需要驗證。"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
+msgid "Set static host name"
+msgstr "設定靜態主機名稱"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
+msgid ""
+"Authentication is required to set the statically configured local host name, "
+"as well as the pretty host name."
+msgstr ""
+"設定靜態設定的本機主機名稱時需要驗證,"
+"同時也需要漂亮的主機名稱"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
+msgid "Set machine information"
+msgstr "設定機器資訊"
+
+#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
+msgid "Authentication is required to set local machine information."
+msgstr "設定機器資訊需要驗證"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:1
+msgid "Import a VM or container image"
+msgstr "匯入虛擬機器或容器映像"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:2
+msgid "Authentication is required to import a VM or container image"
+msgstr "匯入虛擬機器或容器映像需要驗證"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:3
+msgid "Export a VM or container image"
+msgstr "匯出虛擬機器或容器映像"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:4
+msgid "Authentication is required to export a VM or container image"
+msgstr "匯出虛擬機器或容器映像需要驗證"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:5
+msgid "Download a VM or container image"
+msgstr "下載虛擬機器或容器映像"
+
+#: ../src/import/org.freedesktop.import1.policy.in.h:6
+msgid "Authentication is required to download a VM or container image"
+msgstr "下載虛擬機器或容器映像需要驗證"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
+msgid "Set system locale"
+msgstr "設定系統語系"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
+msgid "Authentication is required to set the system locale."
+msgstr "設定系統語系需要驗證。"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
+msgid "Set system keyboard settings"
+msgstr "設定系統鍵盤設定"
+
+#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
+msgid "Authentication is required to set the system keyboard settings."
+msgstr "設定系統鍵盤設定需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:1
+msgid "Allow applications to inhibit system shutdown"
+msgstr "允許應用程式阻止系統關機"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:2
+msgid ""
+"Authentication is required for an application to inhibit system shutdown."
+msgstr "要讓應用程式阻止系統關機需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:3
+msgid "Allow applications to delay system shutdown"
+msgstr "允許應用程式延遲系統關機"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:4
+msgid "Authentication is required for an application to delay system shutdown."
+msgstr "要讓應用程式延遲系統關機需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:5
+msgid "Allow applications to inhibit system sleep"
+msgstr "允許應用程式阻止系統睡眠"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:6
+msgid "Authentication is required for an application to inhibit system sleep."
+msgstr "要讓應用程式阻止系統睡眠需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:7
+msgid "Allow applications to delay system sleep"
+msgstr "允許應用程式延遲系統睡眠"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:8
+msgid "Authentication is required for an application to delay system sleep."
+msgstr "要讓應用程式延遲系統睡眠需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:9
+msgid "Allow applications to inhibit automatic system suspend"
+msgstr "允許應用程式阻止自動系統暫停"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:10
+msgid ""
+"Authentication is required for an application to inhibit automatic system "
+"suspend."
+msgstr ""
+"要讓應用程式阻止自動系統暫停"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:11
+msgid "Allow applications to inhibit system handling of the power key"
+msgstr "允許應用程式阻止系統處理電源鍵"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:12
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the power key."
+msgstr ""
+"要讓應用程式阻止系統處理電源鍵"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:13
+msgid "Allow applications to inhibit system handling of the suspend key"
+msgstr "允許應用程式阻止系統處理暫停鍵"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:14
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the suspend key."
+msgstr ""
+"要讓應用程式阻止系統處理暫停鍵"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:15
+msgid "Allow applications to inhibit system handling of the hibernate key"
+msgstr "允許應用程式阻止系統處理冬眠鍵"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:16
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the hibernate key."
+msgstr ""
+"要讓應用程式阻止系統處理冬眠鍵"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:17
+msgid "Allow applications to inhibit system handling of the lid switch"
+msgstr "允許應用程式阻止系統處理上蓋開關"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:18
+msgid ""
+"Authentication is required for an application to inhibit system handling of "
+"the lid switch."
+msgstr ""
+"要讓應用程式阻止系統處理上蓋開關"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:19
+msgid "Allow non-logged-in users to run programs"
+msgstr "允許未登入的使用者執行程式"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:20
+msgid "Authentication is required to run programs as a non-logged-in user."
+msgstr "要讓未登入的使用者執行程式需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:21
+msgid "Allow attaching devices to seats"
+msgstr "允許將設備連接到座位"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:22
+msgid "Authentication is required for attaching a device to a seat."
+msgstr "將設備連接到座位需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:23
+msgid "Flush device to seat attachments"
+msgstr "暴露裝置以安裝附件"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:24
+msgid ""
+"Authentication is required for resetting how devices are attached to seats."
+msgstr "要重置裝置如何連接到座位需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:25
+msgid "Power off the system"
+msgstr "關閉系統電源"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:26
+msgid "Authentication is required for powering off the system."
+msgstr "關閉系統電源需要驗證"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:27
+msgid "Power off the system while other users are logged in"
+msgstr "在有其他使用者登入時關閉系統電源"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:28
+msgid ""
+"Authentication is required for powering off the system while other users are "
+"logged in."
+msgstr ""
+"在有其他使用者登入時關閉系統電源"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:29
+msgid "Power off the system while an application asked to inhibit it"
+msgstr "當應用程式阻止系統電源關閉時將其關閉"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:30
+msgid ""
+"Authentication is required for powering off the system while an application "
+"asked to inhibit it."
+msgstr ""
+"當應用程式阻止系統電源關閉時將系統電源關閉"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:31
+msgid "Reboot the system"
+msgstr "重新啟動系統"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:32
+msgid "Authentication is required for rebooting the system."
+msgstr "重新啟動系統需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:33
+msgid "Reboot the system while other users are logged in"
+msgstr "在有其他使用者登入時重新啟動系統"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:34
+msgid ""
+"Authentication is required for rebooting the system while other users are "
+"logged in."
+msgstr ""
+"在有其他使用者登入時重新啟動系統"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:35
+msgid "Reboot the system while an application asked to inhibit it"
+msgstr "當應用程式阻止重新啟動系統時將系統重新啟動"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:36
+msgid ""
+"Authentication is required for rebooting the system while an application "
+"asked to inhibit it."
+msgstr ""
+"當應用程式阻止系統重新啟動時將系統重新啟動"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:37
+msgid "Suspend the system"
+msgstr "暫停系統"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:38
+msgid "Authentication is required for suspending the system."
+msgstr "暫停系統需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:39
+msgid "Suspend the system while other users are logged in"
+msgstr "在有其他使用者登入時暫停系統"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:40
+msgid ""
+"Authentication is required for suspending the system while other users are "
+"logged in."
+msgstr ""
+"在有其他使用者登入時暫停系統"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:41
+msgid "Suspend the system while an application asked to inhibit it"
+msgstr "當應用程式阻止暫停系統時將系統暫停"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:42
+msgid ""
+"Authentication is required for suspending the system while an application "
+"asked to inhibit it."
+msgstr ""
+"當應用程式阻止系統暫停時將系統暫停"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:43
+msgid "Hibernate the system"
+msgstr "系統冬眠"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:44
+msgid "Authentication is required for hibernating the system."
+msgstr "系統冬眠需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:45
+msgid "Hibernate the system while other users are logged in"
+msgstr "在有其他使用者登入時冬眠系統"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:46
+msgid ""
+"Authentication is required for hibernating the system while other users are "
+"logged in."
+msgstr ""
+"在有其他使用者登入時冬眠系統"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:47
+msgid "Hibernate the system while an application asked to inhibit it"
+msgstr "當應用程式阻止冬眠系統時將系統冬眠"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:48
+msgid ""
+"Authentication is required for hibernating the system while an application "
+"asked to inhibit it."
+msgstr ""
+"當應用程式阻止系統冬眠時將系統冬眠"
+"需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:49
+msgid "Manage active sessions, users and seats"
+msgstr "管理活躍的工作階段、使用者與座位"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:50
+msgid ""
+"Authentication is required for managing active sessions, users and seats."
+msgstr "管理活躍的工作階段、使用者與座位需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:51
+msgid "Lock or unlock active sessions"
+msgstr "鎖定或解鎖活躍的工作階段"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:52
+msgid "Authentication is required to lock or unlock active sessions."
+msgstr "鎖定或解鎖活躍的工作階段需要驗證。"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr "允許對韌體的指示以開始設定介面"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr ""
+"對韌體的指示以開始設定介面"
+"需要驗證。"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
+msgid "Log into a local container"
+msgstr "登入到本機容器"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:2
+msgid "Authentication is required to log into a local container."
+msgstr "登入到本機容器需要驗證。"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:3
+msgid "Manage local virtual machines and containers"
+msgstr "管理本機虛擬機器及容器"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:4
+msgid ""
+"Authentication is required to manage local virtual machines and containers."
+msgstr "管理本機虛擬機器及容器需要驗證。"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:5
+msgid "Manage local virtual machine and container images"
+msgstr "管理本機虛擬機器及容器映像"
+
+#: ../src/machine/org.freedesktop.machine1.policy.in.h:6
+msgid ""
+"Authentication is required to manage local virtual machine and container "
+"images."
+msgstr ""
+"管理本機虛擬機器及容器映像"
+"需要驗證。"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:1
+msgid "Set system time"
+msgstr "設定系統時間"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:2
+msgid "Authentication is required to set the system time."
+msgstr "設定系統時間需要驗證。"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:3
+msgid "Set system timezone"
+msgstr "設定系統時區"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:4
+msgid "Authentication is required to set the system timezone."
+msgstr "設定系統時區需要驗證。"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:5
+msgid "Set RTC to local timezone or UTC"
+msgstr "將 RTC 設定為本地時區或 UTC"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:6
+msgid ""
+"Authentication is required to control whether the RTC stores the local or "
+"UTC time."
+msgstr ""
+"控制 RTC 儲存本地或 UTC 時間"
+"需要驗證。"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:7
+msgid "Turn network time synchronization on or off"
+msgstr "打開或關閉網路時間同步"
+
+#: ../src/timedate/org.freedesktop.timedate1.policy.in.h:8
+msgid ""
+"Authentication is required to control whether network time synchronization "
+"shall be enabled."
+msgstr ""
+"控制網路時間同步是否啟用"
+"需要驗證。"
+
+
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index 2daeb6db42..71b8e46ae8 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -32,8 +32,9 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin
# SCSI devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi"
-KERNEL=="sd*|sr*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
-KERNEL=="sd*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss"
+KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
# FireWire
KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}"
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
index 17736de01c..4bf306aacb 100644
--- a/shell-completion/zsh/_systemctl.in
+++ b/shell-completion/zsh/_systemctl.in
@@ -127,16 +127,11 @@ _systemctl_really_all_units()
_filter_units_by_property() {
local property=$1 value=$2 ; shift ; shift
local -a units ; units=($*)
- local prop unit
- for ((i=1; $i <= ${#units[*]}; i++)); do
- # FIXME: "Failed to issue method call: Unknown unit" errors are ignored for
- # now (related to DBUS_ERROR_UNKNOWN_OBJECT). in the future, we need to
- # revert to calling 'systemctl show' once for all units, which is way
- # faster
- unit=${units[i]}
- prop=${(f)"$(_call_program units "$service show --no-pager --property="$property" ${unit} 2>/dev/null")"}
- if [[ "${prop}" = "$property=$value" ]]; then
- echo -E - " ${unit}"
+ local props
+ for props in ${(ps:\n\n:)"$(_call_program units "$service show --no-pager --property="Id,$property" -- ${units} 2>/dev/null")"}; do
+ props=(${(f)props})
+ if [[ "${props[2]}" = "$property=$value" ]]; then
+ echo -E - " ${props[1]#Id=}"
fi
done
}
diff --git a/src/shared/.gitignore b/src/basic/.gitignore
index e22411e484..e22411e484 100644
--- a/src/shared/.gitignore
+++ b/src/basic/.gitignore
diff --git a/src/shared/Makefile b/src/basic/Makefile
index d0b0e8e008..d0b0e8e008 120000
--- a/src/shared/Makefile
+++ b/src/basic/Makefile
diff --git a/src/shared/MurmurHash2.c b/src/basic/MurmurHash2.c
index 2f4149dbe9..2f4149dbe9 100644
--- a/src/shared/MurmurHash2.c
+++ b/src/basic/MurmurHash2.c
diff --git a/src/shared/MurmurHash2.h b/src/basic/MurmurHash2.h
index 93362dd485..93362dd485 100644
--- a/src/shared/MurmurHash2.h
+++ b/src/basic/MurmurHash2.h
diff --git a/src/shared/af-list.c b/src/basic/af-list.c
index f396115a34..f396115a34 100644
--- a/src/shared/af-list.c
+++ b/src/basic/af-list.c
diff --git a/src/shared/af-list.h b/src/basic/af-list.h
index e346ab87f5..e346ab87f5 100644
--- a/src/shared/af-list.h
+++ b/src/basic/af-list.h
diff --git a/src/shared/arphrd-list.c b/src/basic/arphrd-list.c
index 284043cd90..284043cd90 100644
--- a/src/shared/arphrd-list.c
+++ b/src/basic/arphrd-list.c
diff --git a/src/shared/arphrd-list.h b/src/basic/arphrd-list.h
index 5ca182c9e8..5ca182c9e8 100644
--- a/src/shared/arphrd-list.h
+++ b/src/basic/arphrd-list.h
diff --git a/src/shared/async.c b/src/basic/async.c
index 7725e6d7d3..7725e6d7d3 100644
--- a/src/shared/async.c
+++ b/src/basic/async.c
diff --git a/src/shared/async.h b/src/basic/async.h
index 7f1ef79532..7f1ef79532 100644
--- a/src/shared/async.h
+++ b/src/basic/async.h
diff --git a/src/shared/audit.c b/src/basic/audit.c
index 54148fcf18..54148fcf18 100644
--- a/src/shared/audit.c
+++ b/src/basic/audit.c
diff --git a/src/shared/audit.h b/src/basic/audit.h
index 6de331c73e..6de331c73e 100644
--- a/src/shared/audit.h
+++ b/src/basic/audit.h
diff --git a/src/shared/barrier.c b/src/basic/barrier.c
index 436ba95989..436ba95989 100644
--- a/src/shared/barrier.c
+++ b/src/basic/barrier.c
diff --git a/src/shared/barrier.h b/src/basic/barrier.h
index b8954694d3..b8954694d3 100644
--- a/src/shared/barrier.h
+++ b/src/basic/barrier.h
diff --git a/src/shared/blkid-util.h b/src/basic/blkid-util.h
index c689310324..c689310324 100644
--- a/src/shared/blkid-util.h
+++ b/src/basic/blkid-util.h
diff --git a/src/shared/btrfs-ctree.h b/src/basic/btrfs-ctree.h
index d3ae57331c..d3ae57331c 100644
--- a/src/shared/btrfs-ctree.h
+++ b/src/basic/btrfs-ctree.h
diff --git a/src/shared/btrfs-util.c b/src/basic/btrfs-util.c
index 49528dbf01..49528dbf01 100644
--- a/src/shared/btrfs-util.c
+++ b/src/basic/btrfs-util.c
diff --git a/src/shared/btrfs-util.h b/src/basic/btrfs-util.h
index a7eb895c93..a7eb895c93 100644
--- a/src/shared/btrfs-util.h
+++ b/src/basic/btrfs-util.h
diff --git a/src/shared/build.h b/src/basic/build.h
index 24873ab9d7..24873ab9d7 100644
--- a/src/shared/build.h
+++ b/src/basic/build.h
diff --git a/src/shared/bus-label.c b/src/basic/bus-label.c
index ccc9f2bf8e..ccc9f2bf8e 100644
--- a/src/shared/bus-label.c
+++ b/src/basic/bus-label.c
diff --git a/src/shared/bus-label.h b/src/basic/bus-label.h
index ed1dc4e0a7..ed1dc4e0a7 100644
--- a/src/shared/bus-label.h
+++ b/src/basic/bus-label.h
diff --git a/src/shared/calendarspec.c b/src/basic/calendarspec.c
index 2fde3e107e..2fde3e107e 100644
--- a/src/shared/calendarspec.c
+++ b/src/basic/calendarspec.c
diff --git a/src/shared/calendarspec.h b/src/basic/calendarspec.h
index 7baf318249..7baf318249 100644
--- a/src/shared/calendarspec.h
+++ b/src/basic/calendarspec.h
diff --git a/src/shared/cap-list.c b/src/basic/cap-list.c
index bd5bffbfa5..bd5bffbfa5 100644
--- a/src/shared/cap-list.c
+++ b/src/basic/cap-list.c
diff --git a/src/shared/cap-list.h b/src/basic/cap-list.h
index 9824fad70f..9824fad70f 100644
--- a/src/shared/cap-list.h
+++ b/src/basic/cap-list.h
diff --git a/src/shared/capability.c b/src/basic/capability.c
index 58f00e6dae..58f00e6dae 100644
--- a/src/shared/capability.c
+++ b/src/basic/capability.c
diff --git a/src/shared/capability.h b/src/basic/capability.h
index 4eb5c2a835..4eb5c2a835 100644
--- a/src/shared/capability.h
+++ b/src/basic/capability.h
diff --git a/src/shared/cgroup-util.c b/src/basic/cgroup-util.c
index 9988e5c574..66857f118f 100644
--- a/src/shared/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -40,7 +40,7 @@
#include "fileio.h"
#include "special.h"
#include "mkdir.h"
-#include "login-shared.h"
+#include "login-util.h"
int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) {
_cleanup_free_ char *fs = NULL;
@@ -441,9 +441,7 @@ static const char *normalize_controller(const char *controller) {
assert(controller);
- if (streq(controller, SYSTEMD_CGROUP_CONTROLLER))
- return "systemd";
- else if (startswith(controller, "name="))
+ if (startswith(controller, "name="))
return controller + 5;
else
return controller;
@@ -483,7 +481,7 @@ int cg_get_path(const char *controller, const char *path, const char *suffix, ch
assert(fs);
- if (controller && !cg_controller_is_valid(controller, true))
+ if (controller && !cg_controller_is_valid(controller))
return -EINVAL;
if (_unlikely_(!good)) {
@@ -526,7 +524,7 @@ int cg_get_path_and_check(const char *controller, const char *path, const char *
assert(fs);
- if (!cg_controller_is_valid(controller, true))
+ if (!cg_controller_is_valid(controller))
return -EINVAL;
/* Normalize the controller syntax */
@@ -742,7 +740,7 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) {
assert(pid >= 0);
if (controller) {
- if (!cg_controller_is_valid(controller, true))
+ if (!cg_controller_is_valid(controller))
return -EINVAL;
controller = normalize_controller(controller);
@@ -971,7 +969,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) {
e = strchr(spec, ':');
if (!e) {
- if (!cg_controller_is_valid(spec, true))
+ if (!cg_controller_is_valid(spec))
return -EINVAL;
if (controller) {
@@ -994,7 +992,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) {
t = strdup(normalize_controller(v));
if (!t)
return -ENOMEM;
- if (!cg_controller_is_valid(t, true)) {
+ if (!cg_controller_is_valid(t)) {
free(t);
return -EINVAL;
}
@@ -1610,17 +1608,15 @@ char *cg_unescape(const char *p) {
DIGITS LETTERS \
"_"
-bool cg_controller_is_valid(const char *p, bool allow_named) {
+bool cg_controller_is_valid(const char *p) {
const char *t, *s;
if (!p)
return false;
- if (allow_named) {
- s = startswith(p, "name=");
- if (s)
- p = s;
- }
+ s = startswith(p, "name=");
+ if (s)
+ p = s;
if (*p == 0 || *p == '_')
return false;
diff --git a/src/shared/cgroup-util.h b/src/basic/cgroup-util.h
index cbf7201370..fd72e9e5c5 100644
--- a/src/shared/cgroup-util.h
+++ b/src/basic/cgroup-util.h
@@ -122,7 +122,7 @@ int cg_path_decode_unit(const char *cgroup, char **unit);
char *cg_escape(const char *p);
char *cg_unescape(const char *p) _pure_;
-bool cg_controller_is_valid(const char *p, bool allow_named);
+bool cg_controller_is_valid(const char *p);
int cg_slice_to_path(const char *unit, char **ret);
diff --git a/src/shared/clock-util.c b/src/basic/clock-util.c
index e4e03df1e4..e4e03df1e4 100644
--- a/src/shared/clock-util.c
+++ b/src/basic/clock-util.c
diff --git a/src/shared/clock-util.h b/src/basic/clock-util.h
index 8c2d235430..8c2d235430 100644
--- a/src/shared/clock-util.h
+++ b/src/basic/clock-util.h
diff --git a/src/shared/conf-files.c b/src/basic/conf-files.c
index da8745b284..da8745b284 100644
--- a/src/shared/conf-files.c
+++ b/src/basic/conf-files.c
diff --git a/src/shared/conf-files.h b/src/basic/conf-files.h
index 3169a907f1..3169a907f1 100644
--- a/src/shared/conf-files.h
+++ b/src/basic/conf-files.h
diff --git a/src/shared/copy.c b/src/basic/copy.c
index 1282cb88be..1282cb88be 100644
--- a/src/shared/copy.c
+++ b/src/basic/copy.c
diff --git a/src/shared/copy.h b/src/basic/copy.h
index 8de0cfba32..8de0cfba32 100644
--- a/src/shared/copy.h
+++ b/src/basic/copy.h
diff --git a/src/shared/def.h b/src/basic/def.h
index a3d9fcf388..011c7c667e 100644
--- a/src/shared/def.h
+++ b/src/basic/def.h
@@ -35,7 +35,7 @@
* the watchdog pings will keep the loop busy. */
#define DEFAULT_EXIT_USEC (30*USEC_PER_SEC)
-#define SYSTEMD_CGROUP_CONTROLLER "name=systemd"
+#define SYSTEMD_CGROUP_CONTROLLER "systemd"
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGPIPE
diff --git a/src/shared/device-nodes.c b/src/basic/device-nodes.c
index 9d5af72d27..9d5af72d27 100644
--- a/src/shared/device-nodes.c
+++ b/src/basic/device-nodes.c
diff --git a/src/shared/device-nodes.h b/src/basic/device-nodes.h
index 04ba4897e5..04ba4897e5 100644
--- a/src/shared/device-nodes.h
+++ b/src/basic/device-nodes.h
diff --git a/src/shared/env-util.c b/src/basic/env-util.c
index ac7bbdc711..ac7bbdc711 100644
--- a/src/shared/env-util.c
+++ b/src/basic/env-util.c
diff --git a/src/shared/env-util.h b/src/basic/env-util.h
index 803aa61cad..803aa61cad 100644
--- a/src/shared/env-util.h
+++ b/src/basic/env-util.h
diff --git a/src/shared/errno-list.c b/src/basic/errno-list.c
index 34d1331486..34d1331486 100644
--- a/src/shared/errno-list.c
+++ b/src/basic/errno-list.c
diff --git a/src/shared/errno-list.h b/src/basic/errno-list.h
index ba533294e6..ba533294e6 100644
--- a/src/shared/errno-list.h
+++ b/src/basic/errno-list.h
diff --git a/src/shared/ether-addr-util.h b/src/basic/ether-addr-util.h
index 7033138788..7033138788 100644
--- a/src/shared/ether-addr-util.h
+++ b/src/basic/ether-addr-util.h
diff --git a/src/shared/exit-status.c b/src/basic/exit-status.c
index c09efdd2cb..c09efdd2cb 100644
--- a/src/shared/exit-status.c
+++ b/src/basic/exit-status.c
diff --git a/src/shared/exit-status.h b/src/basic/exit-status.h
index 7259cd1d18..7259cd1d18 100644
--- a/src/shared/exit-status.h
+++ b/src/basic/exit-status.h
diff --git a/src/shared/fdset.c b/src/basic/fdset.c
index 6101b628ec..6101b628ec 100644
--- a/src/shared/fdset.c
+++ b/src/basic/fdset.c
diff --git a/src/shared/fdset.h b/src/basic/fdset.h
index 340438d7c4..340438d7c4 100644
--- a/src/shared/fdset.h
+++ b/src/basic/fdset.h
diff --git a/src/shared/fileio-label.c b/src/basic/fileio-label.c
index bec988ca78..bec988ca78 100644
--- a/src/shared/fileio-label.c
+++ b/src/basic/fileio-label.c
diff --git a/src/shared/fileio-label.h b/src/basic/fileio-label.h
index 25fa351be2..25fa351be2 100644
--- a/src/shared/fileio-label.h
+++ b/src/basic/fileio-label.h
diff --git a/src/shared/fileio.c b/src/basic/fileio.c
index ff6b1a7ed7..ff6b1a7ed7 100644
--- a/src/shared/fileio.c
+++ b/src/basic/fileio.c
diff --git a/src/shared/fileio.h b/src/basic/fileio.h
index 5ae51c1e28..5ae51c1e28 100644
--- a/src/shared/fileio.h
+++ b/src/basic/fileio.h
diff --git a/src/shared/gunicode.c b/src/basic/gunicode.c
index d89a2f3ed9..d89a2f3ed9 100644
--- a/src/shared/gunicode.c
+++ b/src/basic/gunicode.c
diff --git a/src/shared/gunicode.h b/src/basic/gunicode.h
index e70818fdd7..e70818fdd7 100644
--- a/src/shared/gunicode.h
+++ b/src/basic/gunicode.h
diff --git a/src/shared/hashmap.c b/src/basic/hashmap.c
index 20d599d04b..20d599d04b 100644
--- a/src/shared/hashmap.c
+++ b/src/basic/hashmap.c
diff --git a/src/shared/hashmap.h b/src/basic/hashmap.h
index a03ee5812a..a03ee5812a 100644
--- a/src/shared/hashmap.h
+++ b/src/basic/hashmap.h
diff --git a/src/shared/hostname-util.c b/src/basic/hostname-util.c
index e336f269fa..e336f269fa 100644
--- a/src/shared/hostname-util.c
+++ b/src/basic/hostname-util.c
diff --git a/src/shared/hostname-util.h b/src/basic/hostname-util.h
index 0c4763cf5a..0c4763cf5a 100644
--- a/src/shared/hostname-util.h
+++ b/src/basic/hostname-util.h
diff --git a/src/shared/in-addr-util.c b/src/basic/in-addr-util.c
index d88864b598..d88864b598 100644
--- a/src/shared/in-addr-util.c
+++ b/src/basic/in-addr-util.c
diff --git a/src/shared/in-addr-util.h b/src/basic/in-addr-util.h
index 51af08868c..51af08868c 100644
--- a/src/shared/in-addr-util.h
+++ b/src/basic/in-addr-util.h
diff --git a/src/shared/ioprio.h b/src/basic/ioprio.h
index e5c71d0043..e5c71d0043 100644
--- a/src/shared/ioprio.h
+++ b/src/basic/ioprio.h
diff --git a/src/shared/json.c b/src/basic/json.c
index be40a0d203..be40a0d203 100644
--- a/src/shared/json.c
+++ b/src/basic/json.c
diff --git a/src/shared/json.h b/src/basic/json.h
index e0b4d810b5..e0b4d810b5 100644
--- a/src/shared/json.h
+++ b/src/basic/json.h
diff --git a/src/shared/label.c b/src/basic/label.c
index 82f10b21bd..82f10b21bd 100644
--- a/src/shared/label.c
+++ b/src/basic/label.c
diff --git a/src/shared/label.h b/src/basic/label.h
index 8070bcb021..8070bcb021 100644
--- a/src/shared/label.h
+++ b/src/basic/label.h
diff --git a/src/shared/linux/Makefile b/src/basic/linux/Makefile
index d0b0e8e008..d0b0e8e008 120000
--- a/src/shared/linux/Makefile
+++ b/src/basic/linux/Makefile
diff --git a/src/shared/list.h b/src/basic/list.h
index 2939216adb..2939216adb 100644
--- a/src/shared/list.h
+++ b/src/basic/list.h
diff --git a/src/shared/locale-util.c b/src/basic/locale-util.c
index 61db9a8125..61db9a8125 100644
--- a/src/shared/locale-util.c
+++ b/src/basic/locale-util.c
diff --git a/src/shared/locale-util.h b/src/basic/locale-util.h
index e48aa3d9af..e48aa3d9af 100644
--- a/src/shared/locale-util.h
+++ b/src/basic/locale-util.h
diff --git a/src/shared/lockfile-util.c b/src/basic/lockfile-util.c
index 05e16d1caa..05e16d1caa 100644
--- a/src/shared/lockfile-util.c
+++ b/src/basic/lockfile-util.c
diff --git a/src/shared/lockfile-util.h b/src/basic/lockfile-util.h
index 38d47094bd..38d47094bd 100644
--- a/src/shared/lockfile-util.h
+++ b/src/basic/lockfile-util.h
diff --git a/src/shared/log.c b/src/basic/log.c
index b96afc4de4..b96afc4de4 100644
--- a/src/shared/log.c
+++ b/src/basic/log.c
diff --git a/src/shared/log.h b/src/basic/log.h
index 569762d083..569762d083 100644
--- a/src/shared/log.h
+++ b/src/basic/log.h
diff --git a/src/shared/login-shared.c b/src/basic/login-util.c
index 64650a9134..e25437f0f4 100644
--- a/src/shared/login-shared.c
+++ b/src/basic/login-util.c
@@ -19,7 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "login-shared.h"
+#include "login-util.h"
#include "def.h"
bool session_id_valid(const char *id) {
diff --git a/src/shared/login-shared.h b/src/basic/login-util.h
index a79f20c1b1..a79f20c1b1 100644
--- a/src/shared/login-shared.h
+++ b/src/basic/login-util.h
diff --git a/src/shared/macro.h b/src/basic/macro.h
index cc1c9e73c0..cc1c9e73c0 100644
--- a/src/shared/macro.h
+++ b/src/basic/macro.h
diff --git a/src/shared/memfd-util.c b/src/basic/memfd-util.c
index e99a738e1f..e99a738e1f 100644
--- a/src/shared/memfd-util.c
+++ b/src/basic/memfd-util.c
diff --git a/src/shared/memfd-util.h b/src/basic/memfd-util.h
index 3ed551fb37..3ed551fb37 100644
--- a/src/shared/memfd-util.h
+++ b/src/basic/memfd-util.h
diff --git a/src/shared/mempool.c b/src/basic/mempool.c
index d5d98d8829..d5d98d8829 100644
--- a/src/shared/mempool.c
+++ b/src/basic/mempool.c
diff --git a/src/shared/mempool.h b/src/basic/mempool.h
index 42f473bee1..42f473bee1 100644
--- a/src/shared/mempool.h
+++ b/src/basic/mempool.h
diff --git a/src/shared/missing.h b/src/basic/missing.h
index be7f6186fc..be7f6186fc 100644
--- a/src/shared/missing.h
+++ b/src/basic/missing.h
diff --git a/src/shared/mkdir-label.c b/src/basic/mkdir-label.c
index 76bbc1edda..76bbc1edda 100644
--- a/src/shared/mkdir-label.c
+++ b/src/basic/mkdir-label.c
diff --git a/src/shared/mkdir.c b/src/basic/mkdir.c
index 7ee4546988..7ee4546988 100644
--- a/src/shared/mkdir.c
+++ b/src/basic/mkdir.c
diff --git a/src/shared/mkdir.h b/src/basic/mkdir.h
index 2392d1fd1b..2392d1fd1b 100644
--- a/src/shared/mkdir.h
+++ b/src/basic/mkdir.h
diff --git a/src/shared/ordered-set.h b/src/basic/ordered-set.h
index 766a1f2e83..766a1f2e83 100644
--- a/src/shared/ordered-set.h
+++ b/src/basic/ordered-set.h
diff --git a/src/shared/path-util.c b/src/basic/path-util.c
index 537705446a..537705446a 100644
--- a/src/shared/path-util.c
+++ b/src/basic/path-util.c
diff --git a/src/shared/path-util.h b/src/basic/path-util.h
index 1eac89c51b..1eac89c51b 100644
--- a/src/shared/path-util.h
+++ b/src/basic/path-util.h
diff --git a/src/shared/prioq.c b/src/basic/prioq.c
index b89888be0e..b89888be0e 100644
--- a/src/shared/prioq.c
+++ b/src/basic/prioq.c
diff --git a/src/shared/prioq.h b/src/basic/prioq.h
index 1c044b135c..1c044b135c 100644
--- a/src/shared/prioq.h
+++ b/src/basic/prioq.h
diff --git a/src/shared/process-util.c b/src/basic/process-util.c
index cfc876567d..cfc876567d 100644
--- a/src/shared/process-util.c
+++ b/src/basic/process-util.c
diff --git a/src/shared/process-util.h b/src/basic/process-util.h
index 07431d043b..07431d043b 100644
--- a/src/shared/process-util.h
+++ b/src/basic/process-util.h
diff --git a/src/shared/random-util.c b/src/basic/random-util.c
index b230044f50..b230044f50 100644
--- a/src/shared/random-util.c
+++ b/src/basic/random-util.c
diff --git a/src/shared/random-util.h b/src/basic/random-util.h
index f7862c8c8b..f7862c8c8b 100644
--- a/src/shared/random-util.h
+++ b/src/basic/random-util.h
diff --git a/src/shared/ratelimit.c b/src/basic/ratelimit.c
index 81fc9c19ff..81fc9c19ff 100644
--- a/src/shared/ratelimit.c
+++ b/src/basic/ratelimit.c
diff --git a/src/shared/ratelimit.h b/src/basic/ratelimit.h
index 58efca7df1..58efca7df1 100644
--- a/src/shared/ratelimit.h
+++ b/src/basic/ratelimit.h
diff --git a/src/shared/refcnt.h b/src/basic/refcnt.h
index 0502c20a2e..0502c20a2e 100644
--- a/src/shared/refcnt.h
+++ b/src/basic/refcnt.h
diff --git a/src/shared/replace-var.c b/src/basic/replace-var.c
index 478fc43a38..478fc43a38 100644
--- a/src/shared/replace-var.c
+++ b/src/basic/replace-var.c
diff --git a/src/shared/replace-var.h b/src/basic/replace-var.h
index 7eaee93a3e..7eaee93a3e 100644
--- a/src/shared/replace-var.h
+++ b/src/basic/replace-var.h
diff --git a/src/shared/ring.c b/src/basic/ring.c
index 6814918464..6814918464 100644
--- a/src/shared/ring.c
+++ b/src/basic/ring.c
diff --git a/src/shared/ring.h b/src/basic/ring.h
index a7c44d1b56..a7c44d1b56 100644
--- a/src/shared/ring.h
+++ b/src/basic/ring.h
diff --git a/src/shared/rm-rf.c b/src/basic/rm-rf.c
index bafd483be2..bafd483be2 100644
--- a/src/shared/rm-rf.c
+++ b/src/basic/rm-rf.c
diff --git a/src/shared/rm-rf.h b/src/basic/rm-rf.h
index 96579eb182..96579eb182 100644
--- a/src/shared/rm-rf.h
+++ b/src/basic/rm-rf.h
diff --git a/src/shared/securebits.h b/src/basic/securebits.h
index 98fbe0d433..98fbe0d433 100644
--- a/src/shared/securebits.h
+++ b/src/basic/securebits.h
diff --git a/src/shared/selinux-util.c b/src/basic/selinux-util.c
index 7c58985cd2..7c58985cd2 100644
--- a/src/shared/selinux-util.c
+++ b/src/basic/selinux-util.c
diff --git a/src/shared/selinux-util.h b/src/basic/selinux-util.h
index 8467185291..8467185291 100644
--- a/src/shared/selinux-util.h
+++ b/src/basic/selinux-util.h
diff --git a/src/shared/set.h b/src/basic/set.h
index 4dffecd39d..4dffecd39d 100644
--- a/src/shared/set.h
+++ b/src/basic/set.h
diff --git a/src/shared/sigbus.c b/src/basic/sigbus.c
index 0108603fe8..0108603fe8 100644
--- a/src/shared/sigbus.c
+++ b/src/basic/sigbus.c
diff --git a/src/shared/sigbus.h b/src/basic/sigbus.h
index 23edc6d9cb..23edc6d9cb 100644
--- a/src/shared/sigbus.h
+++ b/src/basic/sigbus.h
diff --git a/src/shared/signal-util.c b/src/basic/signal-util.c
index 84cf42b285..84cf42b285 100644
--- a/src/shared/signal-util.c
+++ b/src/basic/signal-util.c
diff --git a/src/shared/signal-util.h b/src/basic/signal-util.h
index 9dc8a28726..9dc8a28726 100644
--- a/src/shared/signal-util.h
+++ b/src/basic/signal-util.h
diff --git a/src/shared/siphash24.c b/src/basic/siphash24.c
index f68bd283a1..f68bd283a1 100644
--- a/src/shared/siphash24.c
+++ b/src/basic/siphash24.c
diff --git a/src/shared/siphash24.h b/src/basic/siphash24.h
index 62e1168a79..62e1168a79 100644
--- a/src/shared/siphash24.h
+++ b/src/basic/siphash24.h
diff --git a/src/shared/smack-util.c b/src/basic/smack-util.c
index 2e24b1ea99..2e24b1ea99 100644
--- a/src/shared/smack-util.c
+++ b/src/basic/smack-util.c
diff --git a/src/shared/smack-util.h b/src/basic/smack-util.h
index 50f55b1f4b..50f55b1f4b 100644
--- a/src/shared/smack-util.h
+++ b/src/basic/smack-util.h
diff --git a/src/shared/socket-label.c b/src/basic/socket-label.c
index cbe3ff216e..cbe3ff216e 100644
--- a/src/shared/socket-label.c
+++ b/src/basic/socket-label.c
diff --git a/src/shared/socket-util.c b/src/basic/socket-util.c
index e8bb10dc9b..e8bb10dc9b 100644
--- a/src/shared/socket-util.c
+++ b/src/basic/socket-util.c
diff --git a/src/shared/socket-util.h b/src/basic/socket-util.h
index 538cf59174..538cf59174 100644
--- a/src/shared/socket-util.h
+++ b/src/basic/socket-util.h
diff --git a/src/shared/sparse-endian.h b/src/basic/sparse-endian.h
index c913fda8c5..c913fda8c5 100644
--- a/src/shared/sparse-endian.h
+++ b/src/basic/sparse-endian.h
diff --git a/src/shared/special.h b/src/basic/special.h
index e51310eb6d..e51310eb6d 100644
--- a/src/shared/special.h
+++ b/src/basic/special.h
diff --git a/src/shared/strbuf.c b/src/basic/strbuf.c
index 01a076c2ba..01a076c2ba 100644
--- a/src/shared/strbuf.c
+++ b/src/basic/strbuf.c
diff --git a/src/shared/strbuf.h b/src/basic/strbuf.h
index fbc4e5f2a1..fbc4e5f2a1 100644
--- a/src/shared/strbuf.h
+++ b/src/basic/strbuf.h
diff --git a/src/shared/strv.c b/src/basic/strv.c
index d44a72fc48..d44a72fc48 100644
--- a/src/shared/strv.c
+++ b/src/basic/strv.c
diff --git a/src/shared/strv.h b/src/basic/strv.h
index 22f8f98fda..22f8f98fda 100644
--- a/src/shared/strv.h
+++ b/src/basic/strv.h
diff --git a/src/shared/strxcpyx.c b/src/basic/strxcpyx.c
index 6542c0abf5..6542c0abf5 100644
--- a/src/shared/strxcpyx.c
+++ b/src/basic/strxcpyx.c
diff --git a/src/shared/strxcpyx.h b/src/basic/strxcpyx.h
index ccc7e52f37..ccc7e52f37 100644
--- a/src/shared/strxcpyx.h
+++ b/src/basic/strxcpyx.h
diff --git a/src/shared/terminal-util.c b/src/basic/terminal-util.c
index 042b88f222..042b88f222 100644
--- a/src/shared/terminal-util.c
+++ b/src/basic/terminal-util.c
diff --git a/src/shared/terminal-util.h b/src/basic/terminal-util.h
index 188714f228..188714f228 100644
--- a/src/shared/terminal-util.h
+++ b/src/basic/terminal-util.h
diff --git a/src/shared/time-util.c b/src/basic/time-util.c
index 12f1b193be..12f1b193be 100644
--- a/src/shared/time-util.c
+++ b/src/basic/time-util.c
diff --git a/src/shared/time-util.h b/src/basic/time-util.h
index 7a64d454a0..7a64d454a0 100644
--- a/src/shared/time-util.h
+++ b/src/basic/time-util.h
diff --git a/src/shared/unaligned.h b/src/basic/unaligned.h
index d6181dd9a9..d6181dd9a9 100644
--- a/src/shared/unaligned.h
+++ b/src/basic/unaligned.h
diff --git a/src/shared/unit-name.c b/src/basic/unit-name.c
index bf52463d81..bf52463d81 100644
--- a/src/shared/unit-name.c
+++ b/src/basic/unit-name.c
diff --git a/src/shared/unit-name.h b/src/basic/unit-name.h
index b2043d0870..b2043d0870 100644
--- a/src/shared/unit-name.h
+++ b/src/basic/unit-name.h
diff --git a/src/shared/utf8.c b/src/basic/utf8.c
index 800884ffee..800884ffee 100644
--- a/src/shared/utf8.c
+++ b/src/basic/utf8.c
diff --git a/src/shared/utf8.h b/src/basic/utf8.h
index e745649f06..e745649f06 100644
--- a/src/shared/utf8.h
+++ b/src/basic/utf8.h
diff --git a/src/shared/util.c b/src/basic/util.c
index 6f6906f877..6f6906f877 100644
--- a/src/shared/util.c
+++ b/src/basic/util.c
diff --git a/src/shared/util.h b/src/basic/util.h
index 467ae234a0..467ae234a0 100644
--- a/src/shared/util.h
+++ b/src/basic/util.h
diff --git a/src/shared/verbs.c b/src/basic/verbs.c
index c7beccc2dc..c7beccc2dc 100644
--- a/src/shared/verbs.c
+++ b/src/basic/verbs.c
diff --git a/src/shared/verbs.h b/src/basic/verbs.h
index d59e4d59b8..d59e4d59b8 100644
--- a/src/shared/verbs.h
+++ b/src/basic/verbs.h
diff --git a/src/shared/virt.c b/src/basic/virt.c
index 1299a75ed5..1299a75ed5 100644
--- a/src/shared/virt.c
+++ b/src/basic/virt.c
diff --git a/src/shared/virt.h b/src/basic/virt.h
index 7194ab2bf7..7194ab2bf7 100644
--- a/src/shared/virt.h
+++ b/src/basic/virt.h
diff --git a/src/shared/xml.c b/src/basic/xml.c
index 15c629b188..15c629b188 100644
--- a/src/shared/xml.c
+++ b/src/basic/xml.c
diff --git a/src/shared/xml.h b/src/basic/xml.h
index b256b0ba10..b256b0ba10 100644
--- a/src/shared/xml.h
+++ b/src/basic/xml.h
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index a390cf3256..d630e35882 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -60,8 +60,9 @@ typedef struct Group {
} Group;
static unsigned arg_depth = 3;
-static unsigned arg_iterations = 0;
+static unsigned arg_iterations = (unsigned)-1;
static bool arg_batch = false;
+static bool arg_raw = false;
static usec_t arg_delay = 1*USEC_PER_SEC;
static enum {
@@ -96,6 +97,16 @@ static void group_hashmap_free(Hashmap *h) {
hashmap_free(h);
}
+static const char *maybe_format_bytes(char *buf, size_t l, bool is_valid, off_t t) {
+ if (!is_valid)
+ return "-";
+ if (arg_raw) {
+ snprintf(buf, l, "%jd", t);
+ return buf;
+ }
+ return format_bytes(buf, l, t);
+}
+
static int process(const char *controller, const char *path, Hashmap *a, Hashmap *b, unsigned iteration) {
Group *g;
int r;
@@ -270,11 +281,10 @@ static int process(const char *controller, const char *path, Hashmap *a, Hashmap
yr = rd - g->io_input;
yw = wr - g->io_output;
- if (yr > 0 || yw > 0) {
+ if (g->io_input > 0 || g->io_output > 0) {
g->io_input_bps = (yr * 1000000000ULL) / x;
g->io_output_bps = (yw * 1000000000ULL) / x;
g->io_valid = true;
-
}
}
@@ -532,18 +542,9 @@ static int display(Hashmap *a) {
} else
printf(" %*s", maxtcpu, format_timespan(buffer, sizeof(buffer), (nsec_t) (g->cpu_usage / NSEC_PER_USEC), 0));
- if (g->memory_valid)
- printf(" %8s", format_bytes(buffer, sizeof(buffer), g->memory));
- else
- fputs(" -", stdout);
-
- if (g->io_valid) {
- printf(" %8s",
- format_bytes(buffer, sizeof(buffer), g->io_input_bps));
- printf(" %8s",
- format_bytes(buffer, sizeof(buffer), g->io_output_bps));
- } else
- fputs(" - -", stdout);
+ printf(" %8s", maybe_format_bytes(buffer, sizeof(buffer), g->memory_valid, g->memory));
+ printf(" %8s", maybe_format_bytes(buffer, sizeof(buffer), g->io_valid, g->io_input_bps));
+ printf(" %8s", maybe_format_bytes(buffer, sizeof(buffer), g->io_valid, g->io_output_bps));
putchar('\n');
}
@@ -561,6 +562,7 @@ static void help(void) {
" -c Order by CPU load\n"
" -m Order by memory load\n"
" -i Order by IO load\n"
+ " -r --raw Provide raw (not human-readable) numbers\n"
" --cpu[=TYPE] Show CPU usage as time or percentage (default)\n"
" -d --delay=DELAY Delay between updates\n"
" -n --iterations=N Run for N iterations before exiting\n"
@@ -583,6 +585,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "delay", required_argument, NULL, 'd' },
{ "iterations", required_argument, NULL, 'n' },
{ "batch", no_argument, NULL, 'b' },
+ { "raw", no_argument, NULL, 'r' },
{ "depth", required_argument, NULL, ARG_DEPTH },
{ "cpu", optional_argument, NULL, ARG_CPU_TYPE},
{}
@@ -594,7 +597,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 1);
assert(argv);
- while ((c = getopt_long(argc, argv, "hptcmin:bd:", options, NULL)) >= 0)
+ while ((c = getopt_long(argc, argv, "hptcmin:brd:", options, NULL)) >= 0)
switch (c) {
@@ -649,6 +652,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_batch = true;
break;
+ case 'r':
+ arg_raw = true;
+ break;
+
case 'p':
arg_order = ORDER_PATH;
break;
@@ -707,8 +714,8 @@ int main(int argc, char *argv[]) {
signal(SIGWINCH, columns_lines_cache_reset);
- if (!on_tty())
- arg_iterations = 1;
+ if (arg_iterations == (unsigned)-1)
+ arg_iterations = on_tty() ? 0 : 1;
while (!quit) {
Hashmap *c;
@@ -741,6 +748,10 @@ int main(int argc, char *argv[]) {
if (arg_iterations && iteration >= arg_iterations)
break;
+ if (!on_tty()) /* non-TTY: Empty newline as delimiter between polls */
+ fputs("\n", stdout);
+ fflush(stdout);
+
if (arg_batch) {
usleep(last_refresh + arg_delay - t);
} else {
@@ -754,8 +765,10 @@ int main(int argc, char *argv[]) {
}
}
- fputs("\r \r", stdout);
- fflush(stdout);
+ if (on_tty()) { /* TTY: Clear any user keystroke */
+ fputs("\r \r", stdout);
+ fflush(stdout);
+ }
if (arg_batch)
continue;
diff --git a/src/core/ima-setup.c b/src/core/ima-setup.c
index 4d8b638115..42a3e97459 100644
--- a/src/core/ima-setup.c
+++ b/src/core/ima-setup.c
@@ -23,9 +23,6 @@
#include <unistd.h>
#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
#include "ima-setup.h"
#include "util.h"
@@ -36,20 +33,19 @@
#define IMA_POLICY_PATH "/etc/ima/ima-policy"
int ima_setup(void) {
- int r = 0;
-
#ifdef HAVE_IMA
- _cleanup_close_ int policyfd = -1, imafd = -1;
- struct stat st;
- char *policy;
+ _cleanup_fclose_ FILE *input = NULL;
+ _cleanup_close_ int imafd = -1;
+ unsigned lineno = 0;
+ char line[page_size()];
if (access(IMA_SECFS_DIR, F_OK) < 0) {
log_debug("IMA support is disabled in the kernel, ignoring.");
return 0;
}
- policyfd = open(IMA_POLICY_PATH, O_RDONLY|O_CLOEXEC);
- if (policyfd < 0) {
+ input = fopen(IMA_POLICY_PATH, "re");
+ if (!input) {
log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, errno,
"Failed to open the IMA custom policy file "IMA_POLICY_PATH", ignoring: %m");
return 0;
@@ -66,20 +62,19 @@ int ima_setup(void) {
return 0;
}
- if (fstat(policyfd, &st) < 0)
- return log_error_errno(errno, "Failed to fstat "IMA_POLICY_PATH": %m");
+ FOREACH_LINE(line, input,
+ return log_error_errno(errno, "Failed to read the IMA custom policy file "IMA_POLICY_PATH": %m")) {
+ size_t len;
- policy = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, policyfd, 0);
- if (policy == MAP_FAILED)
- return log_error_errno(errno, "Failed to mmap "IMA_POLICY_PATH": %m");
+ len = strlen(line);
+ lineno++;
- r = loop_write(imafd, policy, (size_t) st.st_size, false);
- if (r < 0)
- log_error_errno(r, "Failed to load the IMA custom policy file "IMA_POLICY_PATH": %m");
- else
- log_info("Successfully loaded the IMA custom policy "IMA_POLICY_PATH".");
+ if (len > 0 && write(imafd, line, len) < 0)
+ return log_error_errno(errno, "Failed to load the IMA custom policy file "IMA_POLICY_PATH"%u: %m",
+ lineno);
+ }
- munmap(policy, st.st_size);
+ log_info("Successfully loaded the IMA custom policy "IMA_POLICY_PATH".");
#endif /* HAVE_IMA */
- return r;
+ return 0;
}
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index cf543c81a3..f5584b6b14 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -117,9 +117,12 @@ int kmod_setup(void) {
log_info("Inserted module '%s'", kmod_module_get_name(mod));
else if (r == KMOD_PROBE_APPLY_BLACKLIST)
log_info("Module '%s' is blacklisted", kmod_module_get_name(mod));
- else
- log_full((kmod_table[i].warn_if_unavailable || (r < 0 && r != -ENOENT)) ? LOG_ERR : LOG_DEBUG,
- "Failed to insert module '%s'", kmod_module_get_name(mod));
+ else {
+ bool print_warning = kmod_table[i].warn_if_unavailable || (r < 0 && r != -ENOSYS);
+
+ log_full_errno(print_warning ? LOG_WARNING : LOG_DEBUG, r,
+ "Failed to insert module '%s': %m", kmod_module_get_name(mod));
+ }
kmod_module_unref(mod);
}
diff --git a/src/core/loopback-setup.c b/src/core/loopback-setup.c
index 63b15c1200..4503fc9dcc 100644
--- a/src/core/loopback-setup.c
+++ b/src/core/loopback-setup.c
@@ -22,13 +22,13 @@
#include <net/if.h>
#include <stdlib.h>
-#include "sd-rtnl.h"
-#include "rtnl-util.h"
+#include "sd-netlink.h"
+#include "netlink-util.h"
#include "missing.h"
#include "loopback-setup.h"
-static int start_loopback(sd_rtnl *rtnl) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+static int start_loopback(sd_netlink *rtnl) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
r = sd_rtnl_message_new_link(rtnl, &req, RTM_SETLINK, LOOPBACK_IFINDEX);
@@ -39,15 +39,15 @@ static int start_loopback(sd_rtnl *rtnl) {
if (r < 0)
return r;
- r = sd_rtnl_call(rtnl, req, 0, NULL);
+ r = sd_netlink_call(rtnl, req, 0, NULL);
if (r < 0)
return r;
return 0;
}
-static bool check_loopback(sd_rtnl *rtnl) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
+static bool check_loopback(sd_netlink *rtnl) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
unsigned flags;
int r;
@@ -55,7 +55,7 @@ static bool check_loopback(sd_rtnl *rtnl) {
if (r < 0)
return false;
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return false;
@@ -67,10 +67,10 @@ static bool check_loopback(sd_rtnl *rtnl) {
}
int loopback_setup(void) {
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
int r;
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return r;
diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
index decd42f95a..e9a9a020de 100644
--- a/src/core/selinux-access.c
+++ b/src/core/selinux-access.c
@@ -82,11 +82,19 @@ static int audit_callback(
static int callback_type_to_priority(int type) {
switch(type) {
- case SELINUX_ERROR: return LOG_ERR;
- case SELINUX_WARNING: return LOG_WARNING;
- case SELINUX_INFO: return LOG_INFO;
+
+ case SELINUX_ERROR:
+ return LOG_ERR;
+
+ case SELINUX_WARNING:
+ return LOG_WARNING;
+
+ case SELINUX_INFO:
+ return LOG_INFO;
+
case SELINUX_AVC:
- default: return LOG_NOTICE;
+ default:
+ return LOG_NOTICE;
}
}
@@ -281,11 +289,13 @@ finish:
#endif
}
-int mac_selinux_unit_access_check_strv(char **units,
- sd_bus_message *message,
- Manager *m,
- const char *permission,
- sd_bus_error *error) {
+int mac_selinux_unit_access_check_strv(
+ char **units,
+ sd_bus_message *message,
+ Manager *m,
+ const char *permission,
+ sd_bus_error *error) {
+
#ifdef HAVE_SELINUX
char **i;
Unit *u;
diff --git a/src/core/service.c b/src/core/service.c
index c7e65772ea..71252e29e2 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2008,6 +2008,7 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
unit_serialize_item_format(u, f, "main-pid", PID_FMT, s->main_pid);
unit_serialize_item(u, f, "main-pid-known", yes_no(s->main_pid_known));
+ unit_serialize_item(u, f, "bus-name-good", yes_no(s->bus_name_good));
if (s->status_text) {
_cleanup_free_ char *c = NULL;
@@ -2131,6 +2132,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
log_unit_debug(u, "Failed to parse main-pid-known value: %s", value);
else
s->main_pid_known = b;
+ } else if (streq(key, "bus-name-good")) {
+ int b;
+
+ b = parse_boolean(value);
+ if (b < 0)
+ log_unit_debug(u, "Failed to parse bus-name-good value: %s", value);
+ else
+ s->bus_name_good = b;
} else if (streq(key, "status-text")) {
char *t;
diff --git a/src/core/umount.c b/src/core/umount.c
index bee267a5ad..d59b5d0ffb 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -385,7 +385,7 @@ static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_e
* alias read-only we hence should be
* relatively safe regarding keeping the fs we
* can otherwise not see dirty. */
- mount(NULL, m->path, NULL, MS_REMOUNT|MS_RDONLY, NULL);
+ (void) mount(NULL, m->path, NULL, MS_REMOUNT|MS_RDONLY, NULL);
}
/* Skip / and /usr since we cannot unmount that
diff --git a/src/core/unit.c b/src/core/unit.c
index e380276d49..7bb2afc9f2 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2596,6 +2596,7 @@ int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
if (u->cgroup_path)
unit_serialize_item(u, f, "cgroup", u->cgroup_path);
+ unit_serialize_item(u, f, "cgroup-realized", yes_no(u->cgroup_realized));
if (serialize_jobs) {
if (u->job) {
@@ -2806,6 +2807,16 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
log_unit_debug_errno(u, r, "Failed to set cgroup path %s, ignoring: %m", v);
continue;
+ } else if (streq(l, "cgroup-realized")) {
+ int b;
+
+ b = parse_boolean(v);
+ if (b < 0)
+ log_unit_debug(u, "Failed to parse cgroup-realized bool %s, ignoring.", v);
+ else
+ u->cgroup_realized = b;
+
+ continue;
}
if (unit_can_serialize(u)) {
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 32da8d61fc..d0d670f36e 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -1104,6 +1104,42 @@ finish:
int server_process_datagram(sd_event_source *es, int fd, uint32_t revents, void *userdata) {
Server *s = userdata;
+ struct ucred *ucred = NULL;
+ struct timeval *tv = NULL;
+ struct cmsghdr *cmsg;
+ char *label = NULL;
+ size_t label_len = 0, m;
+ struct iovec iovec;
+ ssize_t n;
+ int *fds = NULL, v = 0;
+ unsigned n_fds = 0;
+
+ union {
+ struct cmsghdr cmsghdr;
+
+ /* We use NAME_MAX space for the SELinux label
+ * here. The kernel currently enforces no
+ * limit, but according to suggestions from
+ * the SELinux people this will change and it
+ * will probably be identical to NAME_MAX. For
+ * now we use that, but this should be updated
+ * one day when the final limit is known. */
+ uint8_t buf[CMSG_SPACE(sizeof(struct ucred)) +
+ CMSG_SPACE(sizeof(struct timeval)) +
+ CMSG_SPACE(sizeof(int)) + /* fd */
+ CMSG_SPACE(NAME_MAX)]; /* selinux label */
+ } control = {};
+
+ union sockaddr_union sa = {};
+
+ struct msghdr msghdr = {
+ .msg_iov = &iovec,
+ .msg_iovlen = 1,
+ .msg_control = &control,
+ .msg_controllen = sizeof(control),
+ .msg_name = &sa,
+ .msg_namelen = sizeof(sa),
+ };
assert(s);
assert(fd == s->native_fd || fd == s->syslog_fd || fd == s->audit_fd);
@@ -1113,119 +1149,79 @@ int server_process_datagram(sd_event_source *es, int fd, uint32_t revents, void
return -EIO;
}
- for (;;) {
- struct ucred *ucred = NULL;
- struct timeval *tv = NULL;
- struct cmsghdr *cmsg;
- char *label = NULL;
- size_t label_len = 0;
- struct iovec iovec;
-
- union {
- struct cmsghdr cmsghdr;
-
- /* We use NAME_MAX space for the SELinux label
- * here. The kernel currently enforces no
- * limit, but according to suggestions from
- * the SELinux people this will change and it
- * will probably be identical to NAME_MAX. For
- * now we use that, but this should be updated
- * one day when the final limit is known. */
- uint8_t buf[CMSG_SPACE(sizeof(struct ucred)) +
- CMSG_SPACE(sizeof(struct timeval)) +
- CMSG_SPACE(sizeof(int)) + /* fd */
- CMSG_SPACE(NAME_MAX)]; /* selinux label */
- } control = {};
- union sockaddr_union sa = {};
- struct msghdr msghdr = {
- .msg_iov = &iovec,
- .msg_iovlen = 1,
- .msg_control = &control,
- .msg_controllen = sizeof(control),
- .msg_name = &sa,
- .msg_namelen = sizeof(sa),
- };
-
- ssize_t n;
- int *fds = NULL;
- unsigned n_fds = 0;
- int v = 0;
- size_t m;
-
- /* Try to get the right size, if we can. (Not all
- * sockets support SIOCINQ, hence we just try, but
- * don't rely on it. */
- (void) ioctl(fd, SIOCINQ, &v);
-
- /* Fix it up, if it is too small. We use the same fixed value as auditd here. Awful! */
- m = PAGE_ALIGN(MAX3((size_t) v + 1,
- (size_t) LINE_MAX,
- ALIGN(sizeof(struct nlmsghdr)) + ALIGN((size_t) MAX_AUDIT_MESSAGE_LENGTH)) + 1);
-
- if (!GREEDY_REALLOC(s->buffer, s->buffer_size, m))
- return log_oom();
-
- iovec.iov_base = s->buffer;
- iovec.iov_len = s->buffer_size - 1; /* Leave room for trailing NUL we add later */
-
- n = recvmsg(fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
- if (n < 0) {
- if (errno == EINTR || errno == EAGAIN)
- return 0;
-
- log_error_errno(errno, "recvmsg() failed: %m");
- return -errno;
- }
+ /* Try to get the right size, if we can. (Not all
+ * sockets support SIOCINQ, hence we just try, but
+ * don't rely on it. */
+ (void) ioctl(fd, SIOCINQ, &v);
- CMSG_FOREACH(cmsg, &msghdr) {
-
- if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_CREDENTIALS &&
- cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred)))
- ucred = (struct ucred*) CMSG_DATA(cmsg);
- else if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_SECURITY) {
- label = (char*) CMSG_DATA(cmsg);
- label_len = cmsg->cmsg_len - CMSG_LEN(0);
- } else if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SO_TIMESTAMP &&
- cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval)))
- tv = (struct timeval*) CMSG_DATA(cmsg);
- else if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_RIGHTS) {
- fds = (int*) CMSG_DATA(cmsg);
- n_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
- }
- }
+ /* Fix it up, if it is too small. We use the same fixed value as auditd here. Awful! */
+ m = PAGE_ALIGN(MAX3((size_t) v + 1,
+ (size_t) LINE_MAX,
+ ALIGN(sizeof(struct nlmsghdr)) + ALIGN((size_t) MAX_AUDIT_MESSAGE_LENGTH)) + 1);
- /* And a trailing NUL, just in case */
- s->buffer[n] = 0;
+ if (!GREEDY_REALLOC(s->buffer, s->buffer_size, m))
+ return log_oom();
- if (fd == s->syslog_fd) {
- if (n > 0 && n_fds == 0)
- server_process_syslog_message(s, strstrip(s->buffer), ucred, tv, label, label_len);
- else if (n_fds > 0)
- log_warning("Got file descriptors via syslog socket. Ignoring.");
+ iovec.iov_base = s->buffer;
+ iovec.iov_len = s->buffer_size - 1; /* Leave room for trailing NUL we add later */
- } else if (fd == s->native_fd) {
- if (n > 0 && n_fds == 0)
- server_process_native_message(s, s->buffer, n, ucred, tv, label, label_len);
- else if (n == 0 && n_fds == 1)
- server_process_native_file(s, fds[0], ucred, tv, label, label_len);
- else if (n_fds > 0)
- log_warning("Got too many file descriptors via native socket. Ignoring.");
+ n = recvmsg(fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
+ if (n < 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ return 0;
- } else {
- assert(fd == s->audit_fd);
+ return log_error_errno(errno, "recvmsg() failed: %m");
+ }
- if (n > 0 && n_fds == 0)
- server_process_audit_message(s, s->buffer, n, ucred, &sa, msghdr.msg_namelen);
- else if (n_fds > 0)
- log_warning("Got file descriptors via audit socket. Ignoring.");
+ CMSG_FOREACH(cmsg, &msghdr) {
+
+ if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_CREDENTIALS &&
+ cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred)))
+ ucred = (struct ucred*) CMSG_DATA(cmsg);
+ else if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_SECURITY) {
+ label = (char*) CMSG_DATA(cmsg);
+ label_len = cmsg->cmsg_len - CMSG_LEN(0);
+ } else if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SO_TIMESTAMP &&
+ cmsg->cmsg_len == CMSG_LEN(sizeof(struct timeval)))
+ tv = (struct timeval*) CMSG_DATA(cmsg);
+ else if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_RIGHTS) {
+ fds = (int*) CMSG_DATA(cmsg);
+ n_fds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
}
+ }
+
+ /* And a trailing NUL, just in case */
+ s->buffer[n] = 0;
+
+ if (fd == s->syslog_fd) {
+ if (n > 0 && n_fds == 0)
+ server_process_syslog_message(s, strstrip(s->buffer), ucred, tv, label, label_len);
+ else if (n_fds > 0)
+ log_warning("Got file descriptors via syslog socket. Ignoring.");
+
+ } else if (fd == s->native_fd) {
+ if (n > 0 && n_fds == 0)
+ server_process_native_message(s, s->buffer, n, ucred, tv, label, label_len);
+ else if (n == 0 && n_fds == 1)
+ server_process_native_file(s, fds[0], ucred, tv, label, label_len);
+ else if (n_fds > 0)
+ log_warning("Got too many file descriptors via native socket. Ignoring.");
- close_many(fds, n_fds);
+ } else {
+ assert(fd == s->audit_fd);
+
+ if (n > 0 && n_fds == 0)
+ server_process_audit_message(s, s->buffer, n, ucred, &sa, msghdr.msg_namelen);
+ else if (n_fds > 0)
+ log_warning("Got file descriptors via audit socket. Ignoring.");
}
+
+ close_many(fds, n_fds);
+ return 0;
}
static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index 90b7530946..ffba451955 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -234,7 +234,8 @@ size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid)
if (t)
*identifier = t;
- e += strspn(p + e, WHITESPACE);
+ if (strchr(WHITESPACE, p[e]))
+ e++;
*buf = p + e;
return e;
}
diff --git a/src/libsystemd-network/test-pppoe.c b/src/libsystemd-network/test-pppoe.c
index 9c8d6f7779..72878f4b51 100644
--- a/src/libsystemd-network/test-pppoe.c
+++ b/src/libsystemd-network/test-pppoe.c
@@ -29,7 +29,7 @@
#include "util.h"
#include "sd-event.h"
#include "event-util.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-pppoe.h"
#include "process-util.h"
@@ -83,8 +83,8 @@ static int client_run(const char *client_name, sd_event *e) {
}
static int test_pppoe_server(sd_event *e) {
- sd_rtnl *rtnl;
- sd_rtnl_message *m;
+ sd_netlink *rtnl;
+ sd_netlink_message *m;
pid_t pid;
int r, client_ifindex, server_ifindex;
@@ -94,34 +94,34 @@ static int test_pppoe_server(sd_event *e) {
assert_se(r >= 0);
- assert_se(sd_rtnl_open(&rtnl, 0) >= 0);
- assert_se(sd_rtnl_attach_event(rtnl, e, 0) >= 0);
+ assert_se(sd_netlink_open(&rtnl) >= 0);
+ assert_se(sd_netlink_attach_event(rtnl, e, 0) >= 0);
assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0) >= 0);
- assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, "pppoe-server") >= 0);
- assert_se(sd_rtnl_message_open_container(m, IFLA_LINKINFO) >= 0);
- assert_se(sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "veth") >= 0);
- assert_se(sd_rtnl_message_open_container(m, VETH_INFO_PEER) >= 0);
- assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, "pppoe-client") >= 0);
- assert_se(sd_rtnl_message_close_container(m) >= 0);
- assert_se(sd_rtnl_message_close_container(m) >= 0);
- assert_se(sd_rtnl_message_close_container(m) >= 0);
- assert_se(sd_rtnl_call(rtnl, m, 0, NULL) >= 0);
+ assert_se(sd_netlink_message_append_string(m, IFLA_IFNAME, "pppoe-server") >= 0);
+ assert_se(sd_netlink_message_open_container(m, IFLA_LINKINFO) >= 0);
+ assert_se(sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, "veth") >= 0);
+ assert_se(sd_netlink_message_open_container(m, VETH_INFO_PEER) >= 0);
+ assert_se(sd_netlink_message_append_string(m, IFLA_IFNAME, "pppoe-client") >= 0);
+ assert_se(sd_netlink_message_close_container(m) >= 0);
+ assert_se(sd_netlink_message_close_container(m) >= 0);
+ assert_se(sd_netlink_message_close_container(m) >= 0);
+ assert_se(sd_netlink_call(rtnl, m, 0, NULL) >= 0);
client_ifindex = (int) if_nametoindex("pppoe-client");
assert_se(client_ifindex > 0);
server_ifindex = (int) if_nametoindex("pppoe-server");
assert_se(server_ifindex > 0);
- m = sd_rtnl_message_unref(m);
+ m = sd_netlink_message_unref(m);
assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, client_ifindex) >= 0);
assert_se(sd_rtnl_message_link_set_flags(m, IFF_UP, IFF_UP) >= 0);
- assert_se(sd_rtnl_call(rtnl, m, 0, NULL) >= 0);
+ assert_se(sd_netlink_call(rtnl, m, 0, NULL) >= 0);
- m = sd_rtnl_message_unref(m);
+ m = sd_netlink_message_unref(m);
assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_SETLINK, server_ifindex) >= 0);
assert_se(sd_rtnl_message_link_set_flags(m, IFF_UP, IFF_UP) >= 0);
- assert_se(sd_rtnl_call(rtnl, m, 0, NULL) >= 0);
+ assert_se(sd_netlink_call(rtnl, m, 0, NULL) >= 0);
pid = fork();
assert_se(pid >= 0);
@@ -145,8 +145,8 @@ static int test_pppoe_server(sd_event *e) {
assert_se(kill(pid, SIGTERM) >= 0);
assert_se(wait_for_terminate(pid, NULL) >= 0);
- assert_se(!sd_rtnl_message_unref(m));
- assert_se(!sd_rtnl_unref(rtnl));
+ assert_se(!sd_netlink_message_unref(m));
+ assert_se(!sd_netlink_unref(rtnl));
return EXIT_SUCCESS;
}
diff --git a/src/libsystemd-terminal/grdev-drm.c b/src/libsystemd-terminal/grdev-drm.c
index 4cee95f469..30c1a726eb 100644
--- a/src/libsystemd-terminal/grdev-drm.c
+++ b/src/libsystemd-terminal/grdev-drm.c
@@ -30,7 +30,7 @@
#include <unistd.h>
/* Yuck! DRM headers need system headers included first.. but we have to
- * include it before shared/missing.h to avoid redefining ioctl bits */
+ * include it before util/missing.h to avoid redefining ioctl bits */
#include <drm.h>
#include <drm_fourcc.h>
#include <drm_mode.h>
diff --git a/src/libsystemd-terminal/grdev.c b/src/libsystemd-terminal/grdev.c
index c386e65982..71f0bd31e7 100644
--- a/src/libsystemd-terminal/grdev.c
+++ b/src/libsystemd-terminal/grdev.c
@@ -25,7 +25,7 @@
#include "sd-bus.h"
#include "sd-event.h"
#include "hashmap.h"
-#include "login-shared.h"
+#include "login-util.h"
#include "macro.h"
#include "util.h"
#include "grdev.h"
diff --git a/src/libsystemd-terminal/idev.c b/src/libsystemd-terminal/idev.c
index b187934977..b92a393b69 100644
--- a/src/libsystemd-terminal/idev.c
+++ b/src/libsystemd-terminal/idev.c
@@ -25,7 +25,7 @@
#include "sd-bus.h"
#include "sd-event.h"
#include "hashmap.h"
-#include "login-shared.h"
+#include "login-util.h"
#include "macro.h"
#include "util.h"
#include "idev.h"
diff --git a/src/libsystemd/sd-bus/bus-internal.c b/src/libsystemd/sd-bus/bus-internal.c
index 37793e48ed..fea796cd30 100644
--- a/src/libsystemd/sd-bus/bus-internal.c
+++ b/src/libsystemd/sd-bus/bus-internal.c
@@ -19,6 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "bus-message.h"
#include "bus-internal.h"
bool object_path_is_valid(const char *p) {
@@ -345,3 +346,28 @@ char *bus_address_escape(const char *v) {
*b = 0;
return r;
}
+
+int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error) {
+ assert(m);
+
+ if (r < 0) {
+ if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL)
+ sd_bus_reply_method_errno(m, r, error);
+
+ } else if (sd_bus_error_is_set(error)) {
+ if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL)
+ sd_bus_reply_method_error(m, error);
+ } else
+ return r;
+
+ log_debug("Failed to process message [type=%s sender=%s path=%s interface=%s member=%s signature=%s]: %s",
+ bus_message_type_to_string(m->header->type),
+ strna(m->sender),
+ strna(m->path),
+ strna(m->interface),
+ strna(m->member),
+ strna(m->root_container.signature),
+ bus_error_message(error, r));
+
+ return 1;
+}
diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
index 2ee0eabc02..88c058889a 100644
--- a/src/libsystemd/sd-bus/bus-internal.h
+++ b/src/libsystemd/sd-bus/bus-internal.h
@@ -390,3 +390,5 @@ int bus_set_address_system_machine(sd_bus *b, const char *machine);
int bus_remove_match_by_string(sd_bus *bus, const char *match, sd_bus_message_handler_t callback, void *userdata);
int bus_get_root_path(sd_bus *bus);
+
+int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index ed8aa0952a..e3885ecba6 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -30,7 +30,7 @@
#include "macro.h"
#include "strv.h"
#include "fileio.h"
-#include "login-shared.h"
+#include "login-util.h"
#include "formats-util.h"
#include "sd-login.h"
diff --git a/src/libsystemd/sd-rtnl/Makefile b/src/libsystemd/sd-netlink/Makefile
index 94aaae2c4d..94aaae2c4d 120000
--- a/src/libsystemd/sd-rtnl/Makefile
+++ b/src/libsystemd/sd-netlink/Makefile
diff --git a/src/libsystemd/sd-rtnl/local-addresses.c b/src/libsystemd/sd-netlink/local-addresses.c
index 31bfa06066..e2f637f7f9 100644
--- a/src/libsystemd/sd-rtnl/local-addresses.c
+++ b/src/libsystemd/sd-netlink/local-addresses.c
@@ -20,8 +20,8 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "sd-rtnl.h"
-#include "rtnl-util.h"
+#include "sd-netlink.h"
+#include "netlink-util.h"
#include "macro.h"
#include "local-addresses.h"
@@ -53,20 +53,20 @@ static int address_compare(const void *_a, const void *_b) {
return memcmp(&a->address, &b->address, FAMILY_ADDRESS_SIZE(a->family));
}
-int local_addresses(sd_rtnl *context, int ifindex, int af, struct local_address **ret) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+int local_addresses(sd_netlink *context, int ifindex, int af, struct local_address **ret) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
_cleanup_free_ struct local_address *list = NULL;
size_t n_list = 0, n_allocated = 0;
- sd_rtnl_message *m;
+ sd_netlink_message *m;
int r;
assert(ret);
if (context)
- rtnl = sd_rtnl_ref(context);
+ rtnl = sd_netlink_ref(context);
else {
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return r;
}
@@ -75,21 +75,21 @@ int local_addresses(sd_rtnl *context, int ifindex, int af, struct local_address
if (r < 0)
return r;
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (m = reply; m; m = sd_rtnl_message_next(m)) {
+ for (m = reply; m; m = sd_netlink_message_next(m)) {
struct local_address *a;
unsigned char flags;
uint16_t type;
int ifi, family;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
return r;
- r = sd_rtnl_message_get_type(m, &type);
+ r = sd_netlink_message_get_type(m, &type);
if (r < 0)
return r;
if (type != RTM_NEWADDR)
@@ -128,18 +128,18 @@ int local_addresses(sd_rtnl *context, int ifindex, int af, struct local_address
switch (family) {
case AF_INET:
- r = sd_rtnl_message_read_in_addr(m, IFA_LOCAL, &a->address.in);
+ r = sd_netlink_message_read_in_addr(m, IFA_LOCAL, &a->address.in);
if (r < 0) {
- r = sd_rtnl_message_read_in_addr(m, IFA_ADDRESS, &a->address.in);
+ r = sd_netlink_message_read_in_addr(m, IFA_ADDRESS, &a->address.in);
if (r < 0)
continue;
}
break;
case AF_INET6:
- r = sd_rtnl_message_read_in6_addr(m, IFA_LOCAL, &a->address.in6);
+ r = sd_netlink_message_read_in6_addr(m, IFA_LOCAL, &a->address.in6);
if (r < 0) {
- r = sd_rtnl_message_read_in6_addr(m, IFA_ADDRESS, &a->address.in6);
+ r = sd_netlink_message_read_in6_addr(m, IFA_ADDRESS, &a->address.in6);
if (r < 0)
continue;
}
@@ -164,20 +164,20 @@ int local_addresses(sd_rtnl *context, int ifindex, int af, struct local_address
return (int) n_list;
}
-int local_gateways(sd_rtnl *context, int ifindex, int af, struct local_address **ret) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+int local_gateways(sd_netlink *context, int ifindex, int af, struct local_address **ret) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
_cleanup_free_ struct local_address *list = NULL;
- sd_rtnl_message *m = NULL;
+ sd_netlink_message *m = NULL;
size_t n_list = 0, n_allocated = 0;
int r;
assert(ret);
if (context)
- rtnl = sd_rtnl_ref(context);
+ rtnl = sd_netlink_ref(context);
else {
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return r;
}
@@ -186,26 +186,26 @@ int local_gateways(sd_rtnl *context, int ifindex, int af, struct local_address *
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (m = reply; m; m = sd_rtnl_message_next(m)) {
+ for (m = reply; m; m = sd_netlink_message_next(m)) {
struct local_address *a;
uint16_t type;
unsigned char dst_len, src_len;
uint32_t ifi;
int family;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
return r;
- r = sd_rtnl_message_get_type(m, &type);
+ r = sd_netlink_message_get_type(m, &type);
if (r < 0)
return r;
if (type != RTM_NEWROUTE)
@@ -224,7 +224,7 @@ int local_gateways(sd_rtnl *context, int ifindex, int af, struct local_address *
if (src_len != 0)
continue;
- r = sd_rtnl_message_read_u32(m, RTA_OIF, &ifi);
+ r = sd_netlink_message_read_u32(m, RTA_OIF, &ifi);
if (r < 0)
return r;
if (ifindex > 0 && (int) ifi != ifindex)
@@ -243,13 +243,13 @@ int local_gateways(sd_rtnl *context, int ifindex, int af, struct local_address *
switch (family) {
case AF_INET:
- r = sd_rtnl_message_read_in_addr(m, RTA_GATEWAY, &a->address.in);
+ r = sd_netlink_message_read_in_addr(m, RTA_GATEWAY, &a->address.in);
if (r < 0)
continue;
break;
case AF_INET6:
- r = sd_rtnl_message_read_in6_addr(m, RTA_GATEWAY, &a->address.in6);
+ r = sd_netlink_message_read_in6_addr(m, RTA_GATEWAY, &a->address.in6);
if (r < 0)
continue;
@@ -258,7 +258,7 @@ int local_gateways(sd_rtnl *context, int ifindex, int af, struct local_address *
continue;
}
- sd_rtnl_message_read_u32(m, RTA_PRIORITY, &a->metric);
+ sd_netlink_message_read_u32(m, RTA_PRIORITY, &a->metric);
a->ifindex = ifi;
a->family = family;
diff --git a/src/libsystemd/sd-rtnl/local-addresses.h b/src/libsystemd/sd-netlink/local-addresses.h
index bdc28d3510..5d0f11a2c1 100644
--- a/src/libsystemd/sd-rtnl/local-addresses.h
+++ b/src/libsystemd/sd-netlink/local-addresses.h
@@ -22,7 +22,7 @@
***/
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "in-addr-util.h"
struct local_address {
@@ -32,6 +32,6 @@ struct local_address {
union in_addr_union address;
};
-int local_addresses(sd_rtnl *rtnl, int ifindex, int af, struct local_address **ret);
+int local_addresses(sd_netlink *rtnl, int ifindex, int af, struct local_address **ret);
-int local_gateways(sd_rtnl *rtnl, int ifindex, int af, struct local_address **ret);
+int local_gateways(sd_netlink *rtnl, int ifindex, int af, struct local_address **ret);
diff --git a/src/libsystemd/sd-rtnl/rtnl-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h
index 05b88b1ad8..7290f4e875 100644
--- a/src/libsystemd/sd-rtnl/rtnl-internal.h
+++ b/src/libsystemd/sd-netlink/netlink-internal.h
@@ -27,9 +27,9 @@
#include "prioq.h"
#include "list.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
-#include "rtnl-types.h"
+#include "netlink-types.h"
#define RTNL_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC))
@@ -39,7 +39,7 @@
#define RTNL_CONTAINER_DEPTH 32
struct reply_callback {
- sd_rtnl_message_handler_t callback;
+ sd_netlink_message_handler_t callback;
void *userdata;
usec_t timeout;
uint64_t serial;
@@ -47,14 +47,14 @@ struct reply_callback {
};
struct match_callback {
- sd_rtnl_message_handler_t callback;
+ sd_netlink_message_handler_t callback;
uint16_t type;
void *userdata;
LIST_FIELDS(struct match_callback, match_callbacks);
};
-struct sd_rtnl {
+struct sd_netlink {
RefCount n_ref;
int fd;
@@ -64,18 +64,14 @@ struct sd_rtnl {
struct sockaddr_nl nl;
} sockaddr;
- sd_rtnl_message **rqueue;
+ sd_netlink_message **rqueue;
unsigned rqueue_size;
size_t rqueue_allocated;
- sd_rtnl_message **rqueue_partial;
+ sd_netlink_message **rqueue_partial;
unsigned rqueue_partial_size;
size_t rqueue_partial_allocated;
- sd_rtnl_message **wqueue;
- unsigned wqueue_size;
- size_t wqueue_allocated;
-
struct nlmsghdr *rbuffer;
size_t rbuffer_allocated;
@@ -96,10 +92,10 @@ struct sd_rtnl {
sd_event *event;
};
-struct sd_rtnl_message {
+struct sd_netlink_message {
RefCount n_ref;
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
struct nlmsghdr *hdr;
const struct NLTypeSystem *(container_type_system[RTNL_CONTAINER_DEPTH]); /* the type of the container and all its parents */
@@ -111,19 +107,23 @@ struct sd_rtnl_message {
bool sealed:1;
bool broadcast:1;
- sd_rtnl_message *next; /* next in a chain of multi-part messages */
+ sd_netlink_message *next; /* next in a chain of multi-part messages */
};
-int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t type);
+int message_new(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t type);
+int message_new_empty(sd_netlink *rtnl, sd_netlink_message **ret);
-int socket_write_message(sd_rtnl *nl, sd_rtnl_message *m);
-int socket_read_message(sd_rtnl *nl);
+int socket_open(int family);
+int socket_bind(sd_netlink *nl);
+int socket_join_broadcast_group(sd_netlink *nl, unsigned group);
+int socket_write_message(sd_netlink *nl, sd_netlink_message *m);
+int socket_read_message(sd_netlink *nl);
-int rtnl_rqueue_make_room(sd_rtnl *rtnl);
-int rtnl_rqueue_partial_make_room(sd_rtnl *rtnl);
+int rtnl_rqueue_make_room(sd_netlink *rtnl);
+int rtnl_rqueue_partial_make_room(sd_netlink *rtnl);
-int rtnl_message_read_internal(sd_rtnl_message *m, unsigned short type, void **data);
-int rtnl_message_parse(sd_rtnl_message *m,
+int rtnl_message_read_internal(sd_netlink_message *m, unsigned short type, void **data);
+int rtnl_message_parse(sd_netlink_message *m,
size_t **rta_offset_tb,
unsigned short *rta_tb_size,
int max,
@@ -132,4 +132,4 @@ int rtnl_message_parse(sd_rtnl_message *m,
/* Make sure callbacks don't destroy the rtnl connection */
#define RTNL_DONT_DESTROY(rtnl) \
- _cleanup_rtnl_unref_ _unused_ sd_rtnl *_dont_destroy_##rtnl = sd_rtnl_ref(rtnl)
+ _cleanup_netlink_unref_ _unused_ sd_netlink *_dont_destroy_##rtnl = sd_netlink_ref(rtnl)
diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c
new file mode 100644
index 0000000000..87324fc2f7
--- /dev/null
+++ b/src/libsystemd/sd-netlink/netlink-message.c
@@ -0,0 +1,906 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Tom Gundersen <teg@jklm.no>
+
+ systemd 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.1 of the License, or
+ (at your option) any later version.
+
+ systemd 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <netinet/in.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#include "util.h"
+#include "socket-util.h"
+#include "formats-util.h"
+#include "refcnt.h"
+#include "missing.h"
+
+#include "sd-netlink.h"
+#include "netlink-util.h"
+#include "netlink-internal.h"
+#include "netlink-types.h"
+
+#define GET_CONTAINER(m, i) ((i) < (m)->n_containers ? (struct rtattr*)((uint8_t*)(m)->hdr + (m)->container_offsets[i]) : NULL)
+#define PUSH_CONTAINER(m, new) (m)->container_offsets[(m)->n_containers ++] = (uint8_t*)(new) - (uint8_t*)(m)->hdr;
+
+#define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
+
+int message_new_empty(sd_netlink *rtnl, sd_netlink_message **ret) {
+ sd_netlink_message *m;
+
+ assert_return(ret, -EINVAL);
+
+ /* Note that 'rtnl' is currently unused, if we start using it internally
+ we must take care to avoid problems due to mutual references between
+ buses and their queued messages. See sd-bus.
+ */
+
+ m = new0(sd_netlink_message, 1);
+ if (!m)
+ return -ENOMEM;
+
+ m->n_ref = REFCNT_INIT;
+
+ m->sealed = false;
+
+ *ret = m;
+
+ return 0;
+}
+
+int message_new(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t type) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+ const NLType *nl_type;
+ size_t size;
+ int r;
+
+ r = type_system_get_type(NULL, &nl_type, type);
+ if (r < 0)
+ return r;
+
+ r = message_new_empty(rtnl, &m);
+ if (r < 0)
+ return r;
+
+ size = NLMSG_SPACE(nl_type->size);
+
+ assert(size >= sizeof(struct nlmsghdr));
+ m->hdr = malloc0(size);
+ if (!m->hdr)
+ return -ENOMEM;
+
+ m->hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
+
+ m->container_type_system[0] = nl_type->type_system;
+ m->hdr->nlmsg_len = size;
+ m->hdr->nlmsg_type = type;
+
+ *ret = m;
+ m = NULL;
+
+ return 0;
+}
+
+int sd_netlink_message_request_dump(sd_netlink_message *m, int dump) {
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(m->hdr->nlmsg_type == RTM_GETLINK ||
+ m->hdr->nlmsg_type == RTM_GETADDR ||
+ m->hdr->nlmsg_type == RTM_GETROUTE ||
+ m->hdr->nlmsg_type == RTM_GETNEIGH,
+ -EINVAL);
+
+ if (dump)
+ m->hdr->nlmsg_flags |= NLM_F_DUMP;
+ else
+ m->hdr->nlmsg_flags &= ~NLM_F_DUMP;
+
+ return 0;
+}
+
+sd_netlink_message *sd_netlink_message_ref(sd_netlink_message *m) {
+ if (m)
+ assert_se(REFCNT_INC(m->n_ref) >= 2);
+
+ return m;
+}
+
+sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m) {
+ if (m && REFCNT_DEC(m->n_ref) == 0) {
+ unsigned i;
+
+ free(m->hdr);
+
+ for (i = 0; i <= m->n_containers; i++)
+ free(m->rta_offset_tb[i]);
+
+ sd_netlink_message_unref(m->next);
+
+ free(m);
+ }
+
+ return NULL;
+}
+
+int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type) {
+ assert_return(m, -EINVAL);
+ assert_return(type, -EINVAL);
+
+ *type = m->hdr->nlmsg_type;
+
+ return 0;
+}
+
+int sd_netlink_message_is_broadcast(sd_netlink_message *m) {
+ assert_return(m, -EINVAL);
+
+ return m->broadcast;
+}
+
+/* If successful the updated message will be correctly aligned, if
+ unsuccessful the old message is untouched. */
+static int add_rtattr(sd_netlink_message *m, unsigned short type, const void *data, size_t data_length) {
+ uint32_t rta_length;
+ size_t message_length, padding_length;
+ struct nlmsghdr *new_hdr;
+ struct rtattr *rta;
+ char *padding;
+ unsigned i;
+ int offset;
+
+ assert(m);
+ assert(m->hdr);
+ assert(!m->sealed);
+ assert(NLMSG_ALIGN(m->hdr->nlmsg_len) == m->hdr->nlmsg_len);
+ assert(!data || data_length);
+
+ /* get offset of the new attribute */
+ offset = m->hdr->nlmsg_len;
+
+ /* get the size of the new rta attribute (with padding at the end) */
+ rta_length = RTA_LENGTH(data_length);
+
+ /* get the new message size (with padding at the end) */
+ message_length = offset + RTA_ALIGN(rta_length);
+
+ /* realloc to fit the new attribute */
+ new_hdr = realloc(m->hdr, message_length);
+ if (!new_hdr)
+ return -ENOMEM;
+ m->hdr = new_hdr;
+
+ /* get pointer to the attribute we are about to add */
+ rta = (struct rtattr *) ((uint8_t *) m->hdr + offset);
+
+ /* if we are inside containers, extend them */
+ for (i = 0; i < m->n_containers; i++)
+ GET_CONTAINER(m, i)->rta_len += message_length - offset;
+
+ /* fill in the attribute */
+ rta->rta_type = type;
+ rta->rta_len = rta_length;
+ if (data)
+ /* we don't deal with the case where the user lies about the type
+ * and gives us too little data (so don't do that)
+ */
+ padding = mempcpy(RTA_DATA(rta), data, data_length);
+ else {
+ /* if no data was passed, make sure we still initialize the padding
+ note that we can have data_length > 0 (used by some containers) */
+ padding = RTA_DATA(rta);
+ }
+
+ /* make sure also the padding at the end of the message is initialized */
+ padding_length = (uint8_t*)m->hdr + message_length - (uint8_t*)padding;
+ memzero(padding, padding_length);
+
+ /* update message size */
+ m->hdr->nlmsg_len = message_length;
+
+ return offset;
+}
+
+static int message_attribute_has_type(sd_netlink_message *m, uint16_t attribute_type, uint16_t data_type) {
+ const NLType *type;
+ int r;
+
+ r = type_system_get_type(m->container_type_system[m->n_containers], &type, attribute_type);
+ if (r < 0)
+ return r;
+
+ if (type->type != data_type)
+ return -EINVAL;
+
+ return type->size;
+}
+
+int sd_netlink_message_append_string(sd_netlink_message *m, unsigned short type, const char *data) {
+ size_t length, size;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(data, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_STRING);
+ if (r < 0)
+ return r;
+ else
+ size = (size_t)r;
+
+ if (size) {
+ length = strnlen(data, size+1);
+ if (length > size)
+ return -EINVAL;
+ } else
+ length = strlen(data);
+
+ r = add_rtattr(m, type, data, length + 1);
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_netlink_message_append_u8(sd_netlink_message *m, unsigned short type, uint8_t data) {
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+
+ r = message_attribute_has_type(m, type, NLA_U8);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type, &data, sizeof(uint8_t));
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+
+int sd_netlink_message_append_u16(sd_netlink_message *m, unsigned short type, uint16_t data) {
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+
+ r = message_attribute_has_type(m, type, NLA_U16);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type, &data, sizeof(uint16_t));
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_netlink_message_append_u32(sd_netlink_message *m, unsigned short type, uint32_t data) {
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+
+ r = message_attribute_has_type(m, type, NLA_U32);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type, &data, sizeof(uint32_t));
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_netlink_message_append_in_addr(sd_netlink_message *m, unsigned short type, const struct in_addr *data) {
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(data, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_IN_ADDR);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type, data, sizeof(struct in_addr));
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_netlink_message_append_in6_addr(sd_netlink_message *m, unsigned short type, const struct in6_addr *data) {
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(data, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_IN_ADDR);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type, data, sizeof(struct in6_addr));
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_netlink_message_append_ether_addr(sd_netlink_message *m, unsigned short type, const struct ether_addr *data) {
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(data, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_ETHER_ADDR);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type, data, ETH_ALEN);
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_netlink_message_append_cache_info(sd_netlink_message *m, unsigned short type, const struct ifa_cacheinfo *info) {
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(info, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_CACHE_INFO);
+ if (r < 0)
+ return r;
+
+ r = add_rtattr(m, type, info, sizeof(struct ifa_cacheinfo));
+ if (r < 0)
+ return r;
+
+ return 0;
+}
+
+int sd_netlink_message_open_container(sd_netlink_message *m, unsigned short type) {
+ size_t size;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -ERANGE);
+
+ r = message_attribute_has_type(m, type, NLA_NESTED);
+ if (r < 0) {
+ const NLTypeSystemUnion *type_system_union;
+ int family;
+
+ r = message_attribute_has_type(m, type, NLA_UNION);
+ if (r < 0)
+ return r;
+ size = (size_t) r;
+
+ r = sd_rtnl_message_get_family(m, &family);
+ if (r < 0)
+ return r;
+
+ r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
+ if (r < 0)
+ return r;
+
+ r = type_system_union_protocol_get_type_system(type_system_union,
+ &m->container_type_system[m->n_containers + 1],
+ family);
+ if (r < 0)
+ return r;
+ } else {
+ size = (size_t)r;
+
+ r = type_system_get_type_system(m->container_type_system[m->n_containers],
+ &m->container_type_system[m->n_containers + 1],
+ type);
+ if (r < 0)
+ return r;
+ }
+
+ r = add_rtattr(m, type | NLA_F_NESTED, NULL, size);
+ if (r < 0)
+ return r;
+
+ m->container_offsets[m->n_containers ++] = r;
+
+ return 0;
+}
+
+int sd_netlink_message_open_container_union(sd_netlink_message *m, unsigned short type, const char *key) {
+ const NLTypeSystemUnion *type_system_union;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+
+ r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
+ if (r < 0)
+ return r;
+
+ r = type_system_union_get_type_system(type_system_union,
+ &m->container_type_system[m->n_containers + 1],
+ key);
+ if (r < 0)
+ return r;
+
+ r = sd_netlink_message_append_string(m, type_system_union->match, key);
+ if (r < 0)
+ return r;
+
+ /* do we evere need non-null size */
+ r = add_rtattr(m, type, NULL, 0);
+ if (r < 0)
+ return r;
+
+ m->container_offsets[m->n_containers ++] = r;
+
+ return 0;
+}
+
+
+int sd_netlink_message_close_container(sd_netlink_message *m) {
+ assert_return(m, -EINVAL);
+ assert_return(!m->sealed, -EPERM);
+ assert_return(m->n_containers > 0, -EINVAL);
+
+ m->container_type_system[m->n_containers] = NULL;
+ m->n_containers --;
+
+ return 0;
+}
+
+int rtnl_message_read_internal(sd_netlink_message *m, unsigned short type, void **data) {
+ struct rtattr *rta;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->sealed, -EPERM);
+ assert_return(data, -EINVAL);
+ assert(m->n_containers <= RTNL_CONTAINER_DEPTH);
+ assert(m->rta_offset_tb[m->n_containers]);
+ assert(type < m->rta_tb_size[m->n_containers]);
+
+ if(!m->rta_offset_tb[m->n_containers][type])
+ return -ENODATA;
+
+ rta = (struct rtattr*)((uint8_t *) m->hdr + m->rta_offset_tb[m->n_containers][type]);
+
+ *data = RTA_DATA(rta);
+
+ return RTA_PAYLOAD(rta);
+}
+
+int sd_netlink_message_read_string(sd_netlink_message *m, unsigned short type, const char **data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_STRING);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if (strnlen(attr_data, r) >= (size_t) r)
+ return -EIO;
+
+ if (data)
+ *data = (const char *) attr_data;
+
+ return 0;
+}
+
+int sd_netlink_message_read_u8(sd_netlink_message *m, unsigned short type, uint8_t *data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_U8);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if ((size_t) r < sizeof(uint8_t))
+ return -EIO;
+
+ if (data)
+ *data = *(uint8_t *) attr_data;
+
+ return 0;
+}
+
+int sd_netlink_message_read_u16(sd_netlink_message *m, unsigned short type, uint16_t *data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_U16);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if ((size_t) r < sizeof(uint16_t))
+ return -EIO;
+
+ if (data)
+ *data = *(uint16_t *) attr_data;
+
+ return 0;
+}
+
+int sd_netlink_message_read_u32(sd_netlink_message *m, unsigned short type, uint32_t *data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_U32);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if ((size_t)r < sizeof(uint32_t))
+ return -EIO;
+
+ if (data)
+ *data = *(uint32_t *) attr_data;
+
+ return 0;
+}
+
+int sd_netlink_message_read_ether_addr(sd_netlink_message *m, unsigned short type, struct ether_addr *data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_ETHER_ADDR);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if ((size_t)r < sizeof(struct ether_addr))
+ return -EIO;
+
+ if (data)
+ memcpy(data, attr_data, sizeof(struct ether_addr));
+
+ return 0;
+}
+
+int sd_netlink_message_read_cache_info(sd_netlink_message *m, unsigned short type, struct ifa_cacheinfo *info) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_CACHE_INFO);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if ((size_t)r < sizeof(struct ifa_cacheinfo))
+ return -EIO;
+
+ if (info)
+ memcpy(info, attr_data, sizeof(struct ifa_cacheinfo));
+
+ return 0;
+}
+
+int sd_netlink_message_read_in_addr(sd_netlink_message *m, unsigned short type, struct in_addr *data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_IN_ADDR);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if ((size_t)r < sizeof(struct in_addr))
+ return -EIO;
+
+ if (data)
+ memcpy(data, attr_data, sizeof(struct in_addr));
+
+ return 0;
+}
+
+int sd_netlink_message_read_in6_addr(sd_netlink_message *m, unsigned short type, struct in6_addr *data) {
+ int r;
+ void *attr_data;
+
+ assert_return(m, -EINVAL);
+
+ r = message_attribute_has_type(m, type, NLA_IN_ADDR);
+ if (r < 0)
+ return r;
+
+ r = rtnl_message_read_internal(m, type, &attr_data);
+ if (r < 0)
+ return r;
+ else if ((size_t)r < sizeof(struct in6_addr))
+ return -EIO;
+
+ if (data)
+ memcpy(data, attr_data, sizeof(struct in6_addr));
+
+ return 0;
+}
+
+int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short type) {
+ const NLType *nl_type;
+ const NLTypeSystem *type_system;
+ void *container;
+ size_t size;
+ int r;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -EINVAL);
+
+ r = type_system_get_type(m->container_type_system[m->n_containers],
+ &nl_type,
+ type);
+ if (r < 0)
+ return r;
+
+ if (nl_type->type == NLA_NESTED) {
+ r = type_system_get_type_system(m->container_type_system[m->n_containers],
+ &type_system,
+ type);
+ if (r < 0)
+ return r;
+ } else if (nl_type->type == NLA_UNION) {
+ const NLTypeSystemUnion *type_system_union;
+
+ r = type_system_get_type_system_union(m->container_type_system[m->n_containers],
+ &type_system_union,
+ type);
+ if (r < 0)
+ return r;
+
+ switch (type_system_union->match_type) {
+ case NL_MATCH_SIBLING:
+ {
+ const char *key;
+
+ r = sd_netlink_message_read_string(m, type_system_union->match, &key);
+ if (r < 0)
+ return r;
+
+ r = type_system_union_get_type_system(type_system_union,
+ &type_system,
+ key);
+ if (r < 0)
+ return r;
+
+ break;
+ }
+ case NL_MATCH_PROTOCOL:
+ {
+ int family;
+
+ r = sd_rtnl_message_get_family(m, &family);
+ if (r < 0)
+ return r;
+
+ r = type_system_union_protocol_get_type_system(type_system_union,
+ &type_system,
+ family);
+ if (r < 0)
+ return r;
+
+ break;
+ }
+ default:
+ assert_not_reached("sd-netlink: invalid type system union type");
+ }
+ } else
+ return -EINVAL;
+
+ r = rtnl_message_read_internal(m, type, &container);
+ if (r < 0)
+ return r;
+ else
+ size = (size_t)r;
+
+ m->n_containers ++;
+
+ r = rtnl_message_parse(m,
+ &m->rta_offset_tb[m->n_containers],
+ &m->rta_tb_size[m->n_containers],
+ type_system->max,
+ container,
+ size);
+ if (r < 0) {
+ m->n_containers --;
+ return r;
+ }
+
+ m->container_type_system[m->n_containers] = type_system;
+
+ return 0;
+}
+
+int sd_netlink_message_exit_container(sd_netlink_message *m) {
+ assert_return(m, -EINVAL);
+ assert_return(m->sealed, -EINVAL);
+ assert_return(m->n_containers > 0, -EINVAL);
+
+ free(m->rta_offset_tb[m->n_containers]);
+ m->rta_offset_tb[m->n_containers] = NULL;
+ m->container_type_system[m->n_containers] = NULL;
+
+ m->n_containers --;
+
+ return 0;
+}
+
+uint32_t rtnl_message_get_serial(sd_netlink_message *m) {
+ assert(m);
+ assert(m->hdr);
+
+ return m->hdr->nlmsg_seq;
+}
+
+int sd_netlink_message_is_error(sd_netlink_message *m) {
+ assert_return(m, 0);
+ assert_return(m->hdr, 0);
+
+ return m->hdr->nlmsg_type == NLMSG_ERROR;
+}
+
+int sd_netlink_message_get_errno(sd_netlink_message *m) {
+ struct nlmsgerr *err;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+
+ if (!sd_netlink_message_is_error(m))
+ return 0;
+
+ err = NLMSG_DATA(m->hdr);
+
+ return err->error;
+}
+
+int rtnl_message_parse(sd_netlink_message *m,
+ size_t **rta_offset_tb,
+ unsigned short *rta_tb_size,
+ int max,
+ struct rtattr *rta,
+ unsigned int rt_len) {
+ unsigned short type;
+ size_t *tb;
+
+ tb = new0(size_t, max + 1);
+ if(!tb)
+ return -ENOMEM;
+
+ *rta_tb_size = max + 1;
+
+ for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
+ type = RTA_TYPE(rta);
+
+ /* if the kernel is newer than the headers we used
+ when building, we ignore out-of-range attributes
+ */
+ if (type > max)
+ continue;
+
+ if (tb[type])
+ log_debug("rtnl: message parse - overwriting repeated attribute");
+
+ tb[type] = (uint8_t *) rta - (uint8_t *) m->hdr;
+ }
+
+ *rta_offset_tb = tb;
+
+ return 0;
+}
+
+int sd_netlink_message_rewind(sd_netlink_message *m) {
+ const NLType *type;
+ unsigned i;
+ int r;
+
+ assert_return(m, -EINVAL);
+
+ /* don't allow appending to message once parsed */
+ if (!m->sealed)
+ rtnl_message_seal(m);
+
+ for (i = 1; i <= m->n_containers; i++) {
+ free(m->rta_offset_tb[i]);
+ m->rta_offset_tb[i] = NULL;
+ m->rta_tb_size[i] = 0;
+ m->container_type_system[i] = NULL;
+ }
+
+ m->n_containers = 0;
+
+ if (m->rta_offset_tb[0]) {
+ /* top-level attributes have already been parsed */
+ return 0;
+ }
+
+ assert(m->hdr);
+
+ r = type_system_get_type(NULL, &type, m->hdr->nlmsg_type);
+ if (r < 0)
+ return r;
+
+ if (type->type == NLA_NESTED) {
+ const NLTypeSystem *type_system = type->type_system;
+
+ assert(type_system);
+
+ m->container_type_system[0] = type_system;
+
+ r = rtnl_message_parse(m,
+ &m->rta_offset_tb[m->n_containers],
+ &m->rta_tb_size[m->n_containers],
+ type_system->max,
+ (struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) +
+ NLMSG_ALIGN(type->size)),
+ NLMSG_PAYLOAD(m->hdr, type->size));
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
+}
+
+void rtnl_message_seal(sd_netlink_message *m) {
+ assert(m);
+ assert(!m->sealed);
+
+ m->sealed = true;
+}
+
+sd_netlink_message *sd_netlink_message_next(sd_netlink_message *m) {
+ assert_return(m, NULL);
+
+ return m->next;
+}
diff --git a/src/libsystemd/sd-netlink/netlink-socket.c b/src/libsystemd/sd-netlink/netlink-socket.c
new file mode 100644
index 0000000000..8136cf36ae
--- /dev/null
+++ b/src/libsystemd/sd-netlink/netlink-socket.c
@@ -0,0 +1,322 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Tom Gundersen <teg@jklm.no>
+
+ systemd 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.1 of the License, or
+ (at your option) any later version.
+
+ systemd 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <netinet/in.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#include "util.h"
+#include "socket-util.h"
+#include "formats-util.h"
+#include "refcnt.h"
+#include "missing.h"
+
+#include "sd-netlink.h"
+#include "netlink-util.h"
+#include "netlink-internal.h"
+#include "netlink-types.h"
+
+int socket_open(int family) {
+ int fd;
+
+ fd = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, family);
+ if (fd < 0)
+ return -errno;
+
+ return fd;
+}
+
+int socket_bind(sd_netlink *nl) {
+ socklen_t addrlen;
+ int r, one = 1;
+
+ r = setsockopt(nl->fd, SOL_NETLINK, NETLINK_PKTINFO, &one, sizeof(one));
+ if (r < 0)
+ return -errno;
+
+ addrlen = sizeof(nl->sockaddr);
+
+ r = bind(nl->fd, &nl->sockaddr.sa, addrlen);
+ /* ignore EINVAL to allow opening an already bound socket */
+ if (r < 0 && errno != EINVAL)
+ return -errno;
+
+ r = getsockname(nl->fd, &nl->sockaddr.sa, &addrlen);
+ if (r < 0)
+ return -errno;
+
+ return 0;
+}
+
+
+int socket_join_broadcast_group(sd_netlink *nl, unsigned group) {
+ int r;
+
+ assert(nl);
+ assert(nl->fd >= 0);
+ assert(group > 0);
+
+ r = setsockopt(nl->fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &group, sizeof(group));
+ if (r < 0)
+ return -errno;
+
+ return 0;
+}
+
+/* returns the number of bytes sent, or a negative error code */
+int socket_write_message(sd_netlink *nl, sd_netlink_message *m) {
+ union {
+ struct sockaddr sa;
+ struct sockaddr_nl nl;
+ } addr = {
+ .nl.nl_family = AF_NETLINK,
+ };
+ ssize_t k;
+
+ assert(nl);
+ assert(m);
+ assert(m->hdr);
+
+ k = sendto(nl->fd, m->hdr, m->hdr->nlmsg_len,
+ 0, &addr.sa, sizeof(addr));
+ if (k < 0)
+ return -errno;
+
+ return k;
+}
+
+static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool peek) {
+ union sockaddr_union sender;
+ uint8_t cmsg_buffer[CMSG_SPACE(sizeof(struct nl_pktinfo))];
+ struct msghdr msg = {
+ .msg_iov = iov,
+ .msg_iovlen = 1,
+ .msg_name = &sender,
+ .msg_namelen = sizeof(sender),
+ .msg_control = cmsg_buffer,
+ .msg_controllen = sizeof(cmsg_buffer),
+ };
+ struct cmsghdr *cmsg;
+ uint32_t group = 0;
+ int r;
+
+ assert(fd >= 0);
+ assert(iov);
+
+ r = recvmsg(fd, &msg, MSG_TRUNC | (peek ? MSG_PEEK : 0));
+ if (r < 0) {
+ /* no data */
+ if (errno == ENOBUFS)
+ log_debug("rtnl: kernel receive buffer overrun");
+ else if (errno == EAGAIN)
+ log_debug("rtnl: no data in socket");
+
+ return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
+ }
+
+ if (sender.nl.nl_pid != 0) {
+ /* not from the kernel, ignore */
+ log_debug("rtnl: ignoring message from portid %"PRIu32, sender.nl.nl_pid);
+
+ if (peek) {
+ /* drop the message */
+ r = recvmsg(fd, &msg, 0);
+ if (r < 0)
+ return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
+ }
+
+ return 0;
+ }
+
+ CMSG_FOREACH(cmsg, &msg) {
+ if (cmsg->cmsg_level == SOL_NETLINK &&
+ cmsg->cmsg_type == NETLINK_PKTINFO &&
+ cmsg->cmsg_len == CMSG_LEN(sizeof(struct nl_pktinfo))) {
+ struct nl_pktinfo *pktinfo = (void *)CMSG_DATA(cmsg);
+
+ /* multi-cast group */
+ group = pktinfo->group;
+ }
+ }
+
+ if (_group)
+ *_group = group;
+
+ return r;
+}
+
+/* On success, the number of bytes received is returned and *ret points to the received message
+ * which has a valid header and the correct size.
+ * If nothing useful was received 0 is returned.
+ * On failure, a negative error code is returned.
+ */
+int socket_read_message(sd_netlink *rtnl) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *first = NULL;
+ struct iovec iov = {};
+ uint32_t group = 0;
+ bool multi_part = false, done = false;
+ struct nlmsghdr *new_msg;
+ size_t len;
+ int r;
+ unsigned i = 0;
+
+ assert(rtnl);
+ assert(rtnl->rbuffer);
+ assert(rtnl->rbuffer_allocated >= sizeof(struct nlmsghdr));
+
+ /* read nothing, just get the pending message size */
+ r = socket_recv_message(rtnl->fd, &iov, NULL, true);
+ if (r <= 0)
+ return r;
+ else
+ len = (size_t)r;
+
+ /* make room for the pending message */
+ if (!greedy_realloc((void **)&rtnl->rbuffer,
+ &rtnl->rbuffer_allocated,
+ len, sizeof(uint8_t)))
+ return -ENOMEM;
+
+ iov.iov_base = rtnl->rbuffer;
+ iov.iov_len = rtnl->rbuffer_allocated;
+
+ /* read the pending message */
+ r = socket_recv_message(rtnl->fd, &iov, &group, false);
+ if (r <= 0)
+ return r;
+ else
+ len = (size_t)r;
+
+ if (len > rtnl->rbuffer_allocated)
+ /* message did not fit in read buffer */
+ return -EIO;
+
+ if (NLMSG_OK(rtnl->rbuffer, len) && rtnl->rbuffer->nlmsg_flags & NLM_F_MULTI) {
+ multi_part = true;
+
+ for (i = 0; i < rtnl->rqueue_partial_size; i++) {
+ if (rtnl_message_get_serial(rtnl->rqueue_partial[i]) ==
+ rtnl->rbuffer->nlmsg_seq) {
+ first = rtnl->rqueue_partial[i];
+ break;
+ }
+ }
+ }
+
+ for (new_msg = rtnl->rbuffer; NLMSG_OK(new_msg, len) && !done; new_msg = NLMSG_NEXT(new_msg, len)) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+ const NLType *nl_type;
+
+ if (!group && new_msg->nlmsg_pid != rtnl->sockaddr.nl.nl_pid)
+ /* not broadcast and not for us */
+ continue;
+
+ if (new_msg->nlmsg_type == NLMSG_NOOP)
+ /* silently drop noop messages */
+ continue;
+
+ if (new_msg->nlmsg_type == NLMSG_DONE) {
+ /* finished reading multi-part message */
+ done = true;
+
+ /* if first is not defined, put NLMSG_DONE into the receive queue. */
+ if (first)
+ continue;
+ }
+
+ /* check that we support this message type */
+ r = type_system_get_type(NULL, &nl_type, new_msg->nlmsg_type);
+ if (r < 0) {
+ if (r == -EOPNOTSUPP)
+ log_debug("sd-netlink: ignored message with unknown type: %i",
+ new_msg->nlmsg_type);
+
+ continue;
+ }
+
+ /* check that the size matches the message type */
+ if (new_msg->nlmsg_len < NLMSG_LENGTH(nl_type->size)) {
+ log_debug("sd-netlink: message larger than expected, dropping");
+ continue;
+ }
+
+ r = message_new_empty(rtnl, &m);
+ if (r < 0)
+ return r;
+
+ m->broadcast = !!group;
+
+ m->hdr = memdup(new_msg, new_msg->nlmsg_len);
+ if (!m->hdr)
+ return -ENOMEM;
+
+ /* seal and parse the top-level message */
+ r = sd_netlink_message_rewind(m);
+ if (r < 0)
+ return r;
+
+ /* push the message onto the multi-part message stack */
+ if (first)
+ m->next = first;
+ first = m;
+ m = NULL;
+ }
+
+ if (len)
+ log_debug("sd-netlink: discarding %zu bytes of incoming message", len);
+
+ if (!first)
+ return 0;
+
+ if (!multi_part || done) {
+ /* we got a complete message, push it on the read queue */
+ r = rtnl_rqueue_make_room(rtnl);
+ if (r < 0)
+ return r;
+
+ rtnl->rqueue[rtnl->rqueue_size ++] = first;
+ first = NULL;
+
+ if (multi_part && (i < rtnl->rqueue_partial_size)) {
+ /* remove the message form the partial read queue */
+ memmove(rtnl->rqueue_partial + i,rtnl->rqueue_partial + i + 1,
+ sizeof(sd_netlink_message*) * (rtnl->rqueue_partial_size - i - 1));
+ rtnl->rqueue_partial_size --;
+ }
+
+ return 1;
+ } else {
+ /* we only got a partial multi-part message, push it on the
+ partial read queue */
+ if (i < rtnl->rqueue_partial_size) {
+ rtnl->rqueue_partial[i] = first;
+ } else {
+ r = rtnl_rqueue_partial_make_room(rtnl);
+ if (r < 0)
+ return r;
+
+ rtnl->rqueue_partial[rtnl->rqueue_partial_size ++] = first;
+ }
+ first = NULL;
+
+ return 0;
+ }
+}
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c b/src/libsystemd/sd-netlink/netlink-types.c
index d211684ff1..273033770f 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-netlink/netlink-types.c
@@ -36,7 +36,7 @@
#include "macro.h"
#include "util.h"
-#include "rtnl-types.h"
+#include "netlink-types.h"
#include "missing.h"
static const NLTypeSystem rtnl_link_type_system;
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.h b/src/libsystemd/sd-netlink/netlink-types.h
index de1544bf36..de1544bf36 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.h
+++ b/src/libsystemd/sd-netlink/netlink-types.h
diff --git a/src/libsystemd/sd-rtnl/rtnl-util.c b/src/libsystemd/sd-netlink/netlink-util.c
index 9ddf074c24..482ff6b1c2 100644
--- a/src/libsystemd/sd-rtnl/rtnl-util.c
+++ b/src/libsystemd/sd-netlink/netlink-util.c
@@ -20,13 +20,13 @@
***/
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
-#include "rtnl-util.h"
-#include "rtnl-internal.h"
+#include "netlink-util.h"
+#include "netlink-internal.h"
-int rtnl_set_link_name(sd_rtnl **rtnl, int ifindex, const char *name) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *message = NULL;
+int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *message = NULL;
int r;
assert(rtnl);
@@ -34,7 +34,7 @@ int rtnl_set_link_name(sd_rtnl **rtnl, int ifindex, const char *name) {
assert(name);
if (!*rtnl) {
- r = sd_rtnl_open(rtnl, 0);
+ r = sd_netlink_open(rtnl);
if (r < 0)
return r;
}
@@ -43,20 +43,20 @@ int rtnl_set_link_name(sd_rtnl **rtnl, int ifindex, const char *name) {
if (r < 0)
return r;
- r = sd_rtnl_message_append_string(message, IFLA_IFNAME, name);
+ r = sd_netlink_message_append_string(message, IFLA_IFNAME, name);
if (r < 0)
return r;
- r = sd_rtnl_call(*rtnl, message, 0, NULL);
+ r = sd_netlink_call(*rtnl, message, 0, NULL);
if (r < 0)
return r;
return 0;
}
-int rtnl_set_link_properties(sd_rtnl **rtnl, int ifindex, const char *alias,
+int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias,
const struct ether_addr *mac, unsigned mtu) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *message = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *message = NULL;
int r;
assert(rtnl);
@@ -66,7 +66,7 @@ int rtnl_set_link_properties(sd_rtnl **rtnl, int ifindex, const char *alias,
return 0;
if (!*rtnl) {
- r = sd_rtnl_open(rtnl, 0);
+ r = sd_netlink_open(rtnl);
if (r < 0)
return r;
}
@@ -76,31 +76,31 @@ int rtnl_set_link_properties(sd_rtnl **rtnl, int ifindex, const char *alias,
return r;
if (alias) {
- r = sd_rtnl_message_append_string(message, IFLA_IFALIAS, alias);
+ r = sd_netlink_message_append_string(message, IFLA_IFALIAS, alias);
if (r < 0)
return r;
}
if (mac) {
- r = sd_rtnl_message_append_ether_addr(message, IFLA_ADDRESS, mac);
+ r = sd_netlink_message_append_ether_addr(message, IFLA_ADDRESS, mac);
if (r < 0)
return r;
}
if (mtu > 0) {
- r = sd_rtnl_message_append_u32(message, IFLA_MTU, mtu);
+ r = sd_netlink_message_append_u32(message, IFLA_MTU, mtu);
if (r < 0)
return r;
}
- r = sd_rtnl_call(*rtnl, message, 0, NULL);
+ r = sd_netlink_call(*rtnl, message, 0, NULL);
if (r < 0)
return r;
return 0;
}
-int rtnl_message_new_synthetic_error(int error, uint32_t serial, sd_rtnl_message **ret) {
+int rtnl_message_new_synthetic_error(int error, uint32_t serial, sd_netlink_message **ret) {
struct nlmsgerr *err;
int r;
diff --git a/src/libsystemd/sd-rtnl/rtnl-util.h b/src/libsystemd/sd-netlink/netlink-util.h
index 9e4bdb867e..9df0aa28bf 100644
--- a/src/libsystemd/sd-rtnl/rtnl-util.h
+++ b/src/libsystemd/sd-netlink/netlink-util.h
@@ -23,25 +23,25 @@
#include "util.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
-int rtnl_message_new_synthetic_error(int error, uint32_t serial, sd_rtnl_message **ret);
-uint32_t rtnl_message_get_serial(sd_rtnl_message *m);
-void rtnl_message_seal(sd_rtnl_message *m);
+int rtnl_message_new_synthetic_error(int error, uint32_t serial, sd_netlink_message **ret);
+uint32_t rtnl_message_get_serial(sd_netlink_message *m);
+void rtnl_message_seal(sd_netlink_message *m);
bool rtnl_message_type_is_link(uint16_t type);
bool rtnl_message_type_is_addr(uint16_t type);
bool rtnl_message_type_is_route(uint16_t type);
bool rtnl_message_type_is_neigh(uint16_t type);
-int rtnl_set_link_name(sd_rtnl **rtnl, int ifindex, const char *name);
-int rtnl_set_link_properties(sd_rtnl **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, unsigned mtu);
+int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
+int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, unsigned mtu);
int rtnl_log_parse_error(int r);
int rtnl_log_create_error(int r);
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl*, sd_rtnl_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_rtnl_message*, sd_rtnl_message_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_netlink*, sd_netlink_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_netlink_message*, sd_netlink_message_unref);
-#define _cleanup_rtnl_unref_ _cleanup_(sd_rtnl_unrefp)
-#define _cleanup_rtnl_message_unref_ _cleanup_(sd_rtnl_message_unrefp)
+#define _cleanup_netlink_unref_ _cleanup_(sd_netlink_unrefp)
+#define _cleanup_netlink_message_unref_ _cleanup_(sd_netlink_message_unrefp)
diff --git a/src/libsystemd/sd-netlink/rtnl-message.c b/src/libsystemd/sd-netlink/rtnl-message.c
new file mode 100644
index 0000000000..2f31f4ee69
--- /dev/null
+++ b/src/libsystemd/sd-netlink/rtnl-message.c
@@ -0,0 +1,588 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Tom Gundersen <teg@jklm.no>
+
+ systemd 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.1 of the License, or
+ (at your option) any later version.
+
+ systemd 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <netinet/in.h>
+#include <stdbool.h>
+#include <unistd.h>
+
+#include "util.h"
+#include "socket-util.h"
+#include "formats-util.h"
+#include "refcnt.h"
+#include "missing.h"
+
+#include "sd-netlink.h"
+#include "netlink-util.h"
+#include "netlink-internal.h"
+#include "netlink-types.h"
+
+int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen) {
+ struct rtmsg *rtm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ if ((rtm->rtm_family == AF_INET && prefixlen > 32) ||
+ (rtm->rtm_family == AF_INET6 && prefixlen > 128))
+ return -ERANGE;
+
+ rtm->rtm_dst_len = prefixlen;
+
+ return 0;
+}
+
+int sd_rtnl_message_route_set_src_prefixlen(sd_netlink_message *m, unsigned char prefixlen) {
+ struct rtmsg *rtm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ if ((rtm->rtm_family == AF_INET && prefixlen > 32) ||
+ (rtm->rtm_family == AF_INET6 && prefixlen > 128))
+ return -ERANGE;
+
+ rtm->rtm_src_len = prefixlen;
+
+ return 0;
+}
+
+int sd_rtnl_message_route_set_scope(sd_netlink_message *m, unsigned char scope) {
+ struct rtmsg *rtm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ rtm->rtm_scope = scope;
+
+ return 0;
+}
+
+int sd_rtnl_message_route_get_family(sd_netlink_message *m, int *family) {
+ struct rtmsg *rtm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(family, -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ *family = rtm->rtm_family;
+
+ return 0;
+}
+
+int sd_rtnl_message_route_get_dst_prefixlen(sd_netlink_message *m, unsigned char *dst_len) {
+ struct rtmsg *rtm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(dst_len, -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ *dst_len = rtm->rtm_dst_len;
+
+ return 0;
+}
+
+int sd_rtnl_message_route_get_src_prefixlen(sd_netlink_message *m, unsigned char *src_len) {
+ struct rtmsg *rtm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(src_len, -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ *src_len = rtm->rtm_src_len;
+
+ return 0;
+}
+
+int sd_rtnl_message_new_route(sd_netlink *rtnl, sd_netlink_message **ret,
+ uint16_t nlmsg_type, int rtm_family,
+ unsigned char rtm_protocol) {
+ struct rtmsg *rtm;
+ int r;
+
+ assert_return(rtnl_message_type_is_route(nlmsg_type), -EINVAL);
+ assert_return((nlmsg_type == RTM_GETROUTE && rtm_family == AF_UNSPEC) ||
+ rtm_family == AF_INET || rtm_family == AF_INET6, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ r = message_new(rtnl, ret, nlmsg_type);
+ if (r < 0)
+ return r;
+
+ if (nlmsg_type == RTM_NEWROUTE)
+ (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_APPEND;
+
+ rtm = NLMSG_DATA((*ret)->hdr);
+
+ rtm->rtm_family = rtm_family;
+ rtm->rtm_scope = RT_SCOPE_UNIVERSE;
+ rtm->rtm_type = RTN_UNICAST;
+ rtm->rtm_table = RT_TABLE_MAIN;
+ rtm->rtm_protocol = rtm_protocol;
+
+ return 0;
+}
+
+int sd_rtnl_message_neigh_set_flags(sd_netlink_message *m, uint8_t flags) {
+ struct ndmsg *ndm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
+
+ ndm = NLMSG_DATA(m->hdr);
+ ndm->ndm_flags |= flags;
+
+ return 0;
+}
+
+int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state) {
+ struct ndmsg *ndm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
+
+ ndm = NLMSG_DATA(m->hdr);
+ ndm->ndm_state |= state;
+
+ return 0;
+}
+
+int sd_rtnl_message_neigh_get_flags(sd_netlink_message *m, uint8_t *flags) {
+ struct ndmsg *ndm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
+
+ ndm = NLMSG_DATA(m->hdr);
+ *flags = ndm->ndm_flags;
+
+ return 0;
+}
+
+int sd_rtnl_message_neigh_get_state(sd_netlink_message *m, uint16_t *state) {
+ struct ndmsg *ndm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
+
+ ndm = NLMSG_DATA(m->hdr);
+ *state = ndm->ndm_state;
+
+ return 0;
+}
+
+int sd_rtnl_message_neigh_get_family(sd_netlink_message *m, int *family) {
+ struct ndmsg *ndm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(family, -EINVAL);
+
+ ndm = NLMSG_DATA(m->hdr);
+
+ *family = ndm->ndm_family;
+
+ return 0;
+}
+
+int sd_rtnl_message_neigh_get_ifindex(sd_netlink_message *m, int *index) {
+ struct ndmsg *ndm;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(index, -EINVAL);
+
+ ndm = NLMSG_DATA(m->hdr);
+
+ *index = ndm->ndm_ifindex;
+
+ return 0;
+}
+
+int sd_rtnl_message_new_neigh(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int index, int ndm_family) {
+ struct ndmsg *ndm;
+ int r;
+
+ assert_return(rtnl_message_type_is_neigh(nlmsg_type), -EINVAL);
+ assert_return(ndm_family == AF_INET ||
+ ndm_family == AF_INET6 ||
+ ndm_family == PF_BRIDGE, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ r = message_new(rtnl, ret, nlmsg_type);
+ if (r < 0)
+ return r;
+
+ if (nlmsg_type == RTM_NEWNEIGH)
+ (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_APPEND;
+
+ ndm = NLMSG_DATA((*ret)->hdr);
+
+ ndm->ndm_family = ndm_family;
+ ndm->ndm_ifindex = index;
+
+ return 0;
+}
+
+int sd_rtnl_message_link_set_flags(sd_netlink_message *m, unsigned flags, unsigned change) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(change, -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ ifi->ifi_flags = flags;
+ ifi->ifi_change = change;
+
+ return 0;
+}
+
+int sd_rtnl_message_link_set_type(sd_netlink_message *m, unsigned type) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ ifi->ifi_type = type;
+
+ return 0;
+}
+
+int sd_rtnl_message_link_set_family(sd_netlink_message *m, unsigned family) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ ifi->ifi_family = family;
+
+ return 0;
+}
+
+int sd_rtnl_message_new_link(sd_netlink *rtnl, sd_netlink_message **ret,
+ uint16_t nlmsg_type, int index) {
+ struct ifinfomsg *ifi;
+ int r;
+
+ assert_return(rtnl_message_type_is_link(nlmsg_type), -EINVAL);
+ assert_return(nlmsg_type != RTM_DELLINK || index > 0, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ r = message_new(rtnl, ret, nlmsg_type);
+ if (r < 0)
+ return r;
+
+ if (nlmsg_type == RTM_NEWLINK)
+ (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
+
+ ifi = NLMSG_DATA((*ret)->hdr);
+
+ ifi->ifi_family = AF_UNSPEC;
+ ifi->ifi_index = index;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ if ((ifa->ifa_family == AF_INET && prefixlen > 32) ||
+ (ifa->ifa_family == AF_INET6 && prefixlen > 128))
+ return -ERANGE;
+
+ ifa->ifa_prefixlen = prefixlen;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_set_flags(sd_netlink_message *m, unsigned char flags) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ ifa->ifa_flags = flags;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ ifa->ifa_scope = scope;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_get_family(sd_netlink_message *m, int *family) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(family, -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ *family = ifa->ifa_family;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(prefixlen, -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ *prefixlen = ifa->ifa_prefixlen;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_get_scope(sd_netlink_message *m, unsigned char *scope) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(scope, -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ *scope = ifa->ifa_scope;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_get_flags(sd_netlink_message *m, unsigned char *flags) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(flags, -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ *flags = ifa->ifa_flags;
+
+ return 0;
+}
+
+int sd_rtnl_message_addr_get_ifindex(sd_netlink_message *m, int *ifindex) {
+ struct ifaddrmsg *ifa;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(ifindex, -EINVAL);
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ *ifindex = ifa->ifa_index;
+
+ return 0;
+}
+
+int sd_rtnl_message_new_addr(sd_netlink *rtnl, sd_netlink_message **ret,
+ uint16_t nlmsg_type, int index,
+ int family) {
+ struct ifaddrmsg *ifa;
+ int r;
+
+ assert_return(rtnl_message_type_is_addr(nlmsg_type), -EINVAL);
+ assert_return((nlmsg_type == RTM_GETADDR && index == 0) ||
+ index > 0, -EINVAL);
+ assert_return((nlmsg_type == RTM_GETADDR && family == AF_UNSPEC) ||
+ family == AF_INET || family == AF_INET6, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ r = message_new(rtnl, ret, nlmsg_type);
+ if (r < 0)
+ return r;
+
+ if (nlmsg_type == RTM_GETADDR)
+ (*ret)->hdr->nlmsg_flags |= NLM_F_DUMP;
+
+ ifa = NLMSG_DATA((*ret)->hdr);
+
+ ifa->ifa_index = index;
+ ifa->ifa_family = family;
+ if (family == AF_INET)
+ ifa->ifa_prefixlen = 32;
+ else if (family == AF_INET6)
+ ifa->ifa_prefixlen = 128;
+
+ return 0;
+}
+
+int sd_rtnl_message_new_addr_update(sd_netlink *rtnl, sd_netlink_message **ret,
+ int index, int family) {
+ int r;
+
+ r = sd_rtnl_message_new_addr(rtnl, ret, RTM_NEWADDR, index, family);
+ if (r < 0)
+ return r;
+
+ (*ret)->hdr->nlmsg_flags |= NLM_F_REPLACE;
+
+ return 0;
+}
+
+int sd_rtnl_message_link_get_ifindex(sd_netlink_message *m, int *ifindex) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(ifindex, -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ *ifindex = ifi->ifi_index;
+
+ return 0;
+}
+
+int sd_rtnl_message_link_get_flags(sd_netlink_message *m, unsigned *flags) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(flags, -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ *flags = ifi->ifi_flags;
+
+ return 0;
+}
+
+int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned *type) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(m->hdr, -EINVAL);
+ assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
+ assert_return(type, -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ *type = ifi->ifi_type;
+
+ return 0;
+}
+
+int sd_rtnl_message_get_family(sd_netlink_message *m, int *family) {
+ assert_return(m, -EINVAL);
+ assert_return(family, -EINVAL);
+
+ assert(m->hdr);
+
+ if (rtnl_message_type_is_link(m->hdr->nlmsg_type)) {
+ struct ifinfomsg *ifi;
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ *family = ifi->ifi_family;
+
+ return 0;
+ } else if (rtnl_message_type_is_route(m->hdr->nlmsg_type)) {
+ struct rtmsg *rtm;
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ *family = rtm->rtm_family;
+
+ return 0;
+ } else if (rtnl_message_type_is_neigh(m->hdr->nlmsg_type)) {
+ struct ndmsg *ndm;
+
+ ndm = NLMSG_DATA(m->hdr);
+
+ *family = ndm->ndm_family;
+
+ return 0;
+ } else if (rtnl_message_type_is_addr(m->hdr->nlmsg_type)) {
+ struct ifaddrmsg *ifa;
+
+ ifa = NLMSG_DATA(m->hdr);
+
+ *family = ifa->ifa_family;
+
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
+}
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-netlink/sd-netlink.c
index 40dea1252f..c413b1c266 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-netlink/sd-netlink.c
@@ -27,16 +27,16 @@
#include "util.h"
#include "hashmap.h"
-#include "sd-rtnl.h"
-#include "rtnl-internal.h"
-#include "rtnl-util.h"
+#include "sd-netlink.h"
+#include "netlink-internal.h"
+#include "netlink-util.h"
-static int sd_rtnl_new(sd_rtnl **ret) {
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+static int sd_netlink_new(sd_netlink **ret) {
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
assert_return(ret, -EINVAL);
- rtnl = new0(sd_rtnl, 1);
+ rtnl = new0(sd_netlink, 1);
if (!rtnl)
return -ENOMEM;
@@ -50,11 +50,6 @@ static int sd_rtnl_new(sd_rtnl **ret) {
LIST_HEAD_INIT(rtnl->match_callbacks);
- /* We guarantee that wqueue always has space for at least
- * one entry */
- if (!GREEDY_REALLOC(rtnl->wqueue, rtnl->wqueue_allocated, 1))
- return -ENOMEM;
-
/* We guarantee that the read buffer has at least space for
* a message header */
if (!greedy_realloc((void**)&rtnl->rbuffer, &rtnl->rbuffer_allocated,
@@ -72,14 +67,14 @@ static int sd_rtnl_new(sd_rtnl **ret) {
return 0;
}
-int sd_rtnl_new_from_netlink(sd_rtnl **ret, int fd) {
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+int sd_netlink_new_from_netlink(sd_netlink **ret, int fd) {
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
socklen_t addrlen;
int r;
assert_return(ret, -EINVAL);
- r = sd_rtnl_new(&rtnl);
+ r = sd_netlink_new(&rtnl);
if (r < 0)
return r;
@@ -97,7 +92,7 @@ int sd_rtnl_new_from_netlink(sd_rtnl **ret, int fd) {
return 0;
}
-static bool rtnl_pid_changed(sd_rtnl *rtnl) {
+static bool rtnl_pid_changed(sd_netlink *rtnl) {
assert(rtnl);
/* We don't support people creating an rtnl connection and
@@ -106,103 +101,51 @@ static bool rtnl_pid_changed(sd_rtnl *rtnl) {
return rtnl->original_pid != getpid();
}
-static int rtnl_compute_groups_ap(uint32_t *_groups, unsigned n_groups, va_list ap) {
- uint32_t groups = 0;
- unsigned i;
-
- for (i = 0; i < n_groups; i++) {
- unsigned group;
-
- group = va_arg(ap, unsigned);
- assert_return(group < 32, -EINVAL);
-
- groups |= group ? (1 << (group - 1)) : 0;
- }
-
- *_groups = groups;
-
- return 0;
-}
-
-static int rtnl_open_fd_ap(sd_rtnl **ret, int fd, unsigned n_groups, va_list ap) {
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
- socklen_t addrlen;
- int r, one = 1;
+int sd_netlink_open_fd(sd_netlink **ret, int fd) {
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
+ int r;
assert_return(ret, -EINVAL);
assert_return(fd >= 0, -EINVAL);
- r = sd_rtnl_new(&rtnl);
+ r = sd_netlink_new(&rtnl);
if (r < 0)
return r;
- r = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one));
- if (r < 0)
- return -errno;
-
- r = setsockopt(fd, SOL_NETLINK, NETLINK_PKTINFO, &one, sizeof(one));
- if (r < 0)
- return -errno;
+ rtnl->fd = fd;
- r = rtnl_compute_groups_ap(&rtnl->sockaddr.nl.nl_groups, n_groups, ap);
+ r = socket_bind(rtnl);
if (r < 0)
return r;
- addrlen = sizeof(rtnl->sockaddr);
-
- r = bind(fd, &rtnl->sockaddr.sa, addrlen);
- /* ignore EINVAL to allow opening an already bound socket */
- if (r < 0 && errno != EINVAL)
- return -errno;
-
- r = getsockname(fd, &rtnl->sockaddr.sa, &addrlen);
- if (r < 0)
- return -errno;
-
- rtnl->fd = fd;
-
*ret = rtnl;
rtnl = NULL;
return 0;
}
-int sd_rtnl_open_fd(sd_rtnl **ret, int fd, unsigned n_groups, ...) {
- va_list ap;
+int sd_netlink_open(sd_netlink **ret) {
+ _cleanup_close_ int fd = -1;
int r;
- va_start(ap, n_groups);
- r = rtnl_open_fd_ap(ret, fd, n_groups, ap);
- va_end(ap);
-
- return r;
-}
-
-int sd_rtnl_open(sd_rtnl **ret, unsigned n_groups, ...) {
- va_list ap;
- int fd, r;
-
- fd = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_ROUTE);
+ fd = socket_open(NETLINK_ROUTE);
if (fd < 0)
- return -errno;
-
- va_start(ap, n_groups);
- r = rtnl_open_fd_ap(ret, fd, n_groups, ap);
- va_end(ap);
+ return fd;
- if (r < 0) {
- safe_close(fd);
+ r = sd_netlink_open_fd(ret, fd);
+ if (r < 0)
return r;
- }
+
+ fd = -1;
return 0;
}
-int sd_rtnl_inc_rcvbuf(const sd_rtnl *const rtnl, const int size) {
+int sd_netlink_inc_rcvbuf(const sd_netlink *const rtnl, const int size) {
return fd_inc_rcvbuf(rtnl->fd, size);
}
-sd_rtnl *sd_rtnl_ref(sd_rtnl *rtnl) {
+sd_netlink *sd_netlink_ref(sd_netlink *rtnl) {
assert_return(rtnl, NULL);
assert_return(!rtnl_pid_changed(rtnl), NULL);
@@ -212,7 +155,7 @@ sd_rtnl *sd_rtnl_ref(sd_rtnl *rtnl) {
return rtnl;
}
-sd_rtnl *sd_rtnl_unref(sd_rtnl *rtnl) {
+sd_netlink *sd_netlink_unref(sd_netlink *rtnl) {
if (!rtnl)
return NULL;
@@ -223,17 +166,13 @@ sd_rtnl *sd_rtnl_unref(sd_rtnl *rtnl) {
unsigned i;
for (i = 0; i < rtnl->rqueue_size; i++)
- sd_rtnl_message_unref(rtnl->rqueue[i]);
+ sd_netlink_message_unref(rtnl->rqueue[i]);
free(rtnl->rqueue);
for (i = 0; i < rtnl->rqueue_partial_size; i++)
- sd_rtnl_message_unref(rtnl->rqueue_partial[i]);
+ sd_netlink_message_unref(rtnl->rqueue_partial[i]);
free(rtnl->rqueue_partial);
- for (i = 0; i < rtnl->wqueue_size; i++)
- sd_rtnl_message_unref(rtnl->wqueue[i]);
- free(rtnl->wqueue);
-
free(rtnl->rbuffer);
hashmap_free_free(rtnl->reply_callbacks);
@@ -241,7 +180,6 @@ sd_rtnl *sd_rtnl_unref(sd_rtnl *rtnl) {
sd_event_source_unref(rtnl->io_event_source);
sd_event_source_unref(rtnl->time_event_source);
- sd_event_source_unref(rtnl->exit_event_source);
sd_event_unref(rtnl->event);
while ((f = rtnl->match_callbacks)) {
@@ -256,7 +194,7 @@ sd_rtnl *sd_rtnl_unref(sd_rtnl *rtnl) {
return NULL;
}
-static void rtnl_seal_message(sd_rtnl *rtnl, sd_rtnl_message *m) {
+static void rtnl_seal_message(sd_netlink *rtnl, sd_netlink_message *m) {
assert(rtnl);
assert(!rtnl_pid_changed(rtnl));
assert(m);
@@ -271,8 +209,8 @@ static void rtnl_seal_message(sd_rtnl *rtnl, sd_rtnl_message *m) {
return;
}
-int sd_rtnl_send(sd_rtnl *nl,
- sd_rtnl_message *message,
+int sd_netlink_send(sd_netlink *nl,
+ sd_netlink_message *message,
uint32_t *serial) {
int r;
@@ -283,29 +221,9 @@ int sd_rtnl_send(sd_rtnl *nl,
rtnl_seal_message(nl, message);
- if (nl->wqueue_size <= 0) {
- /* send directly */
- r = socket_write_message(nl, message);
- if (r < 0)
- return r;
- else if (r == 0) {
- /* nothing was sent, so let's put it on
- * the queue */
- nl->wqueue[0] = sd_rtnl_message_ref(message);
- nl->wqueue_size = 1;
- }
- } else {
- /* append to queue */
- if (nl->wqueue_size >= RTNL_WQUEUE_MAX) {
- log_debug("rtnl: exhausted the write queue size (%d)", RTNL_WQUEUE_MAX);
- return -ENOBUFS;
- }
-
- if (!GREEDY_REALLOC(nl->wqueue, nl->wqueue_allocated, nl->wqueue_size + 1))
- return -ENOMEM;
-
- nl->wqueue[nl->wqueue_size ++] = sd_rtnl_message_ref(message);
- }
+ r = socket_write_message(nl, message);
+ if (r < 0)
+ return r;
if (serial)
*serial = rtnl_message_get_serial(message);
@@ -313,7 +231,7 @@ int sd_rtnl_send(sd_rtnl *nl,
return 1;
}
-int rtnl_rqueue_make_room(sd_rtnl *rtnl) {
+int rtnl_rqueue_make_room(sd_netlink *rtnl) {
assert(rtnl);
if (rtnl->rqueue_size >= RTNL_RQUEUE_MAX) {
@@ -327,7 +245,7 @@ int rtnl_rqueue_make_room(sd_rtnl *rtnl) {
return 0;
}
-int rtnl_rqueue_partial_make_room(sd_rtnl *rtnl) {
+int rtnl_rqueue_partial_make_room(sd_netlink *rtnl) {
assert(rtnl);
if (rtnl->rqueue_partial_size >= RTNL_RQUEUE_MAX) {
@@ -342,7 +260,7 @@ int rtnl_rqueue_partial_make_room(sd_rtnl *rtnl) {
return 0;
}
-static int dispatch_rqueue(sd_rtnl *rtnl, sd_rtnl_message **message) {
+static int dispatch_rqueue(sd_netlink *rtnl, sd_netlink_message **message) {
int r;
assert(rtnl);
@@ -358,38 +276,13 @@ static int dispatch_rqueue(sd_rtnl *rtnl, sd_rtnl_message **message) {
/* Dispatch a queued message */
*message = rtnl->rqueue[0];
rtnl->rqueue_size --;
- memmove(rtnl->rqueue, rtnl->rqueue + 1, sizeof(sd_rtnl_message*) * rtnl->rqueue_size);
+ memmove(rtnl->rqueue, rtnl->rqueue + 1, sizeof(sd_netlink_message*) * rtnl->rqueue_size);
return 1;
}
-static int dispatch_wqueue(sd_rtnl *rtnl) {
- int r, ret = 0;
-
- assert(rtnl);
-
- while (rtnl->wqueue_size > 0) {
- r = socket_write_message(rtnl, rtnl->wqueue[0]);
- if (r < 0)
- return r;
- else if (r == 0)
- /* Didn't do anything this time */
- return ret;
- else {
- /* see equivalent in sd-bus.c */
- sd_rtnl_message_unref(rtnl->wqueue[0]);
- rtnl->wqueue_size --;
- memmove(rtnl->wqueue, rtnl->wqueue + 1, sizeof(sd_rtnl_message*) * rtnl->wqueue_size);
-
- ret = 1;
- }
- }
-
- return ret;
-}
-
-static int process_timeout(sd_rtnl *rtnl) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+static int process_timeout(sd_netlink *rtnl) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
struct reply_callback *c;
usec_t n;
int r;
@@ -413,14 +306,14 @@ static int process_timeout(sd_rtnl *rtnl) {
r = c->callback(rtnl, m, c->userdata);
if (r < 0)
- log_debug_errno(r, "sd-rtnl: timedout callback failed: %m");
+ log_debug_errno(r, "sd-netlink: timedout callback failed: %m");
free(c);
return 1;
}
-static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
+static int process_reply(sd_netlink *rtnl, sd_netlink_message *m) {
_cleanup_free_ struct reply_callback *c = NULL;
uint64_t serial;
uint16_t type;
@@ -437,7 +330,7 @@ static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
if (c->timeout != 0)
prioq_remove(rtnl->reply_callbacks_prioq, c, &c->prioq_idx);
- r = sd_rtnl_message_get_type(m, &type);
+ r = sd_netlink_message_get_type(m, &type);
if (r < 0)
return 0;
@@ -446,12 +339,12 @@ static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) {
r = c->callback(rtnl, m, c->userdata);
if (r < 0)
- log_debug_errno(r, "sd-rtnl: callback failed: %m");
+ log_debug_errno(r, "sd-netlink: callback failed: %m");
return 1;
}
-static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
+static int process_match(sd_netlink *rtnl, sd_netlink_message *m) {
struct match_callback *c;
uint16_t type;
int r;
@@ -459,7 +352,7 @@ static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
assert(rtnl);
assert(m);
- r = sd_rtnl_message_get_type(m, &type);
+ r = sd_netlink_message_get_type(m, &type);
if (r < 0)
return r;
@@ -468,7 +361,7 @@ static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
r = c->callback(rtnl, m, c->userdata);
if (r != 0) {
if (r < 0)
- log_debug_errno(r, "sd-rtnl: match callback failed: %m");
+ log_debug_errno(r, "sd-netlink: match callback failed: %m");
break;
}
@@ -478,8 +371,8 @@ static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) {
return 1;
}
-static int process_running(sd_rtnl *rtnl, sd_rtnl_message **ret) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+static int process_running(sd_netlink *rtnl, sd_netlink_message **ret) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
int r;
assert(rtnl);
@@ -488,17 +381,13 @@ static int process_running(sd_rtnl *rtnl, sd_rtnl_message **ret) {
if (r != 0)
goto null_message;
- r = dispatch_wqueue(rtnl);
- if (r != 0)
- goto null_message;
-
r = dispatch_rqueue(rtnl, &m);
if (r < 0)
return r;
if (!m)
goto null_message;
- if (sd_rtnl_message_is_broadcast(m)) {
+ if (sd_netlink_message_is_broadcast(m)) {
r = process_match(rtnl, m);
if (r != 0)
goto null_message;
@@ -524,7 +413,7 @@ null_message:
return r;
}
-int sd_rtnl_process(sd_rtnl *rtnl, sd_rtnl_message **ret) {
+int sd_netlink_process(sd_netlink *rtnl, sd_netlink_message **ret) {
RTNL_DONT_DESTROY(rtnl);
int r;
@@ -549,7 +438,7 @@ static usec_t calc_elapse(uint64_t usec) {
return now(CLOCK_MONOTONIC) + usec;
}
-static int rtnl_poll(sd_rtnl *rtnl, bool need_more, uint64_t timeout_usec) {
+static int rtnl_poll(sd_netlink *rtnl, bool need_more, uint64_t timeout_usec) {
struct pollfd p[1] = {};
struct timespec ts;
usec_t m = USEC_INFINITY;
@@ -557,7 +446,7 @@ static int rtnl_poll(sd_rtnl *rtnl, bool need_more, uint64_t timeout_usec) {
assert(rtnl);
- e = sd_rtnl_get_events(rtnl);
+ e = sd_netlink_get_events(rtnl);
if (e < 0)
return e;
@@ -570,7 +459,7 @@ static int rtnl_poll(sd_rtnl *rtnl, bool need_more, uint64_t timeout_usec) {
/* Caller wants to process if there is something to
* process, but doesn't care otherwise */
- r = sd_rtnl_get_timeout(rtnl, &until);
+ r = sd_netlink_get_timeout(rtnl, &until);
if (r < 0)
return r;
if (r > 0) {
@@ -593,7 +482,7 @@ static int rtnl_poll(sd_rtnl *rtnl, bool need_more, uint64_t timeout_usec) {
return r > 0 ? 1 : 0;
}
-int sd_rtnl_wait(sd_rtnl *nl, uint64_t timeout_usec) {
+int sd_netlink_wait(sd_netlink *nl, uint64_t timeout_usec) {
assert_return(nl, -EINVAL);
assert_return(!rtnl_pid_changed(nl), -ECHILD);
@@ -621,9 +510,9 @@ static int timeout_compare(const void *a, const void *b) {
return 0;
}
-int sd_rtnl_call_async(sd_rtnl *nl,
- sd_rtnl_message *m,
- sd_rtnl_message_handler_t callback,
+int sd_netlink_call_async(sd_netlink *nl,
+ sd_netlink_message *m,
+ sd_netlink_message_handler_t callback,
void *userdata,
uint64_t usec,
uint32_t *serial) {
@@ -654,7 +543,7 @@ int sd_rtnl_call_async(sd_rtnl *nl,
c->userdata = userdata;
c->timeout = calc_elapse(usec);
- k = sd_rtnl_send(nl, m, &s);
+ k = sd_netlink_send(nl, m, &s);
if (k < 0) {
free(c);
return k;
@@ -672,7 +561,7 @@ int sd_rtnl_call_async(sd_rtnl *nl,
r = prioq_put(nl->reply_callbacks_prioq, c, &c->prioq_idx);
if (r > 0) {
c->timeout = 0;
- sd_rtnl_call_async_cancel(nl, c->serial);
+ sd_netlink_call_async_cancel(nl, c->serial);
return r;
}
}
@@ -683,7 +572,7 @@ int sd_rtnl_call_async(sd_rtnl *nl,
return k;
}
-int sd_rtnl_call_async_cancel(sd_rtnl *nl, uint32_t serial) {
+int sd_netlink_call_async_cancel(sd_netlink *nl, uint32_t serial) {
struct reply_callback *c;
uint64_t s = serial;
@@ -702,10 +591,10 @@ int sd_rtnl_call_async_cancel(sd_rtnl *nl, uint32_t serial) {
return 1;
}
-int sd_rtnl_call(sd_rtnl *rtnl,
- sd_rtnl_message *message,
+int sd_netlink_call(sd_netlink *rtnl,
+ sd_netlink_message *message,
uint64_t usec,
- sd_rtnl_message **ret) {
+ sd_netlink_message **ret) {
usec_t timeout;
uint32_t serial;
int r;
@@ -714,7 +603,7 @@ int sd_rtnl_call(sd_rtnl *rtnl,
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
assert_return(message, -EINVAL);
- r = sd_rtnl_send(rtnl, message, &serial);
+ r = sd_netlink_send(rtnl, message, &serial);
if (r < 0)
return r;
@@ -730,21 +619,21 @@ int sd_rtnl_call(sd_rtnl *rtnl,
received_serial = rtnl_message_get_serial(rtnl->rqueue[i]);
if (received_serial == serial) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *incoming = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *incoming = NULL;
uint16_t type;
incoming = rtnl->rqueue[i];
/* found a match, remove from rqueue and return it */
memmove(rtnl->rqueue + i,rtnl->rqueue + i + 1,
- sizeof(sd_rtnl_message*) * (rtnl->rqueue_size - i - 1));
+ sizeof(sd_netlink_message*) * (rtnl->rqueue_size - i - 1));
rtnl->rqueue_size--;
- r = sd_rtnl_message_get_errno(incoming);
+ r = sd_netlink_message_get_errno(incoming);
if (r < 0)
return r;
- r = sd_rtnl_message_get_type(incoming, &type);
+ r = sd_netlink_message_get_type(incoming, &type);
if (r < 0)
return r;
@@ -785,51 +674,20 @@ int sd_rtnl_call(sd_rtnl *rtnl,
return r;
else if (r == 0)
return -ETIMEDOUT;
-
- r = dispatch_wqueue(rtnl);
- if (r < 0)
- return r;
}
}
-int sd_rtnl_flush(sd_rtnl *rtnl) {
- int r;
-
+int sd_netlink_get_events(sd_netlink *rtnl) {
assert_return(rtnl, -EINVAL);
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
- if (rtnl->wqueue_size <= 0)
+ if (rtnl->rqueue_size == 0)
+ return POLLIN;
+ else
return 0;
-
- for (;;) {
- r = dispatch_wqueue(rtnl);
- if (r < 0)
- return r;
-
- if (rtnl->wqueue_size <= 0)
- return 0;
-
- r = rtnl_poll(rtnl, false, (uint64_t) -1);
- if (r < 0)
- return r;
- }
}
-int sd_rtnl_get_events(sd_rtnl *rtnl) {
- int flags = 0;
-
- assert_return(rtnl, -EINVAL);
- assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
-
- if (rtnl->rqueue_size <= 0)
- flags |= POLLIN;
- if (rtnl->wqueue_size > 0)
- flags |= POLLOUT;
-
- return flags;
-}
-
-int sd_rtnl_get_timeout(sd_rtnl *rtnl, uint64_t *timeout_usec) {
+int sd_netlink_get_timeout(sd_netlink *rtnl, uint64_t *timeout_usec) {
struct reply_callback *c;
assert_return(rtnl, -EINVAL);
@@ -853,12 +711,12 @@ int sd_rtnl_get_timeout(sd_rtnl *rtnl, uint64_t *timeout_usec) {
}
static int io_callback(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
- sd_rtnl *rtnl = userdata;
+ sd_netlink *rtnl = userdata;
int r;
assert(rtnl);
- r = sd_rtnl_process(rtnl, NULL);
+ r = sd_netlink_process(rtnl, NULL);
if (r < 0)
return r;
@@ -866,12 +724,12 @@ static int io_callback(sd_event_source *s, int fd, uint32_t revents, void *userd
}
static int time_callback(sd_event_source *s, uint64_t usec, void *userdata) {
- sd_rtnl *rtnl = userdata;
+ sd_netlink *rtnl = userdata;
int r;
assert(rtnl);
- r = sd_rtnl_process(rtnl, NULL);
+ r = sd_netlink_process(rtnl, NULL);
if (r < 0)
return r;
@@ -879,14 +737,14 @@ static int time_callback(sd_event_source *s, uint64_t usec, void *userdata) {
}
static int prepare_callback(sd_event_source *s, void *userdata) {
- sd_rtnl *rtnl = userdata;
+ sd_netlink *rtnl = userdata;
int r, e;
usec_t until;
assert(s);
assert(rtnl);
- e = sd_rtnl_get_events(rtnl);
+ e = sd_netlink_get_events(rtnl);
if (e < 0)
return e;
@@ -894,7 +752,7 @@ static int prepare_callback(sd_event_source *s, void *userdata) {
if (r < 0)
return r;
- r = sd_rtnl_get_timeout(rtnl, &until);
+ r = sd_netlink_get_timeout(rtnl, &until);
if (r < 0)
return r;
if (r > 0) {
@@ -912,17 +770,7 @@ static int prepare_callback(sd_event_source *s, void *userdata) {
return 1;
}
-static int exit_callback(sd_event_source *event, void *userdata) {
- sd_rtnl *rtnl = userdata;
-
- assert(event);
-
- sd_rtnl_flush(rtnl);
-
- return 1;
-}
-
-int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) {
+int sd_netlink_attach_event(sd_netlink *rtnl, sd_event *event, int priority) {
int r;
assert_return(rtnl, -EINVAL);
@@ -967,52 +815,36 @@ int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) {
if (r < 0)
goto fail;
- r = sd_event_add_exit(rtnl->event, &rtnl->exit_event_source, exit_callback, rtnl);
- if (r < 0)
- goto fail;
-
- r = sd_event_source_set_description(rtnl->exit_event_source, "rtnl-exit");
- if (r < 0)
- goto fail;
-
return 0;
fail:
- sd_rtnl_detach_event(rtnl);
+ sd_netlink_detach_event(rtnl);
return r;
}
-int sd_rtnl_detach_event(sd_rtnl *rtnl) {
+int sd_netlink_detach_event(sd_netlink *rtnl) {
assert_return(rtnl, -EINVAL);
assert_return(rtnl->event, -ENXIO);
- if (rtnl->io_event_source)
- rtnl->io_event_source = sd_event_source_unref(rtnl->io_event_source);
+ rtnl->io_event_source = sd_event_source_unref(rtnl->io_event_source);
- if (rtnl->time_event_source)
- rtnl->time_event_source = sd_event_source_unref(rtnl->time_event_source);
+ rtnl->time_event_source = sd_event_source_unref(rtnl->time_event_source);
- if (rtnl->exit_event_source)
- rtnl->exit_event_source = sd_event_source_unref(rtnl->exit_event_source);
-
- if (rtnl->event)
- rtnl->event = sd_event_unref(rtnl->event);
+ rtnl->event = sd_event_unref(rtnl->event);
return 0;
}
-int sd_rtnl_add_match(sd_rtnl *rtnl,
+int sd_netlink_add_match(sd_netlink *rtnl,
uint16_t type,
- sd_rtnl_message_handler_t callback,
+ sd_netlink_message_handler_t callback,
void *userdata) {
- struct match_callback *c;
+ _cleanup_free_ struct match_callback *c = NULL;
+ int r;
assert_return(rtnl, -EINVAL);
assert_return(callback, -EINVAL);
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
- assert_return(rtnl_message_type_is_link(type) ||
- rtnl_message_type_is_addr(type) ||
- rtnl_message_type_is_route(type), -EOPNOTSUPP);
c = new0(struct match_callback, 1);
if (!c)
@@ -1022,14 +854,42 @@ int sd_rtnl_add_match(sd_rtnl *rtnl,
c->type = type;
c->userdata = userdata;
+ switch (type) {
+ case RTM_NEWLINK:
+ case RTM_SETLINK:
+ case RTM_GETLINK:
+ case RTM_DELLINK:
+ r = socket_join_broadcast_group(rtnl, RTNLGRP_LINK);
+ if (r < 0)
+ return r;
+
+ break;
+ case RTM_NEWADDR:
+ case RTM_GETADDR:
+ case RTM_DELADDR:
+ r = socket_join_broadcast_group(rtnl, RTNLGRP_IPV4_IFADDR);
+ if (r < 0)
+ return r;
+
+ r = socket_join_broadcast_group(rtnl, RTNLGRP_IPV6_IFADDR);
+ if (r < 0)
+ return r;
+
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
+
LIST_PREPEND(match_callbacks, rtnl->match_callbacks, c);
+ c = NULL;
+
return 0;
}
-int sd_rtnl_remove_match(sd_rtnl *rtnl,
+int sd_netlink_remove_match(sd_netlink *rtnl,
uint16_t type,
- sd_rtnl_message_handler_t callback,
+ sd_netlink_message_handler_t callback,
void *userdata) {
struct match_callback *c;
@@ -1037,6 +897,13 @@ int sd_rtnl_remove_match(sd_rtnl *rtnl,
assert_return(callback, -EINVAL);
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
+ /* we should unsubscribe from the broadcast groups at this point, but it is not so
+ trivial for a few reasons: the refcounting is a bit of a mess and not obvious
+ how it will look like after we add genetlink support, and it is also not possible
+ to query what broadcast groups were subscribed to when we inherit the socket to get
+ the initial refcount. The latter could indeed be done for the first 32 broadcast
+ groups (which incidentally is all we currently support in .socket units anyway),
+ but we better not rely on only ever using 32 groups. */
LIST_FOREACH(match_callbacks, c, rtnl->match_callbacks)
if (c->callback == callback && c->type == type && c->userdata == userdata) {
LIST_REMOVE(match_callbacks, rtnl->match_callbacks, c);
diff --git a/src/libsystemd/sd-rtnl/test-local-addresses.c b/src/libsystemd/sd-netlink/test-local-addresses.c
index 38cbcfbccb..38cbcfbccb 100644
--- a/src/libsystemd/sd-rtnl/test-local-addresses.c
+++ b/src/libsystemd/sd-netlink/test-local-addresses.c
diff --git a/src/libsystemd/sd-netlink/test-netlink.c b/src/libsystemd/sd-netlink/test-netlink.c
new file mode 100644
index 0000000000..c9cb415ca0
--- /dev/null
+++ b/src/libsystemd/sd-netlink/test-netlink.c
@@ -0,0 +1,440 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Tom Gundersen <teg@jklm.no>
+
+ systemd 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.1 of the License, or
+ (at your option) any later version.
+
+ systemd 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <netinet/ether.h>
+#include <net/if.h>
+
+#include "util.h"
+#include "macro.h"
+#include "sd-netlink.h"
+#include "socket-util.h"
+#include "netlink-util.h"
+#include "event-util.h"
+#include "missing.h"
+
+static void test_message_link_bridge(sd_netlink *rtnl) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *message = NULL;
+ uint32_t cost;
+
+ assert_se(sd_rtnl_message_new_link(rtnl, &message, RTM_NEWLINK, 1) >= 0);
+ assert_se(sd_rtnl_message_link_set_family(message, PF_BRIDGE) >= 0);
+ assert_se(sd_netlink_message_open_container(message, IFLA_PROTINFO) >= 0);
+ assert_se(sd_netlink_message_append_u32(message, IFLA_BRPORT_COST, 10) >= 0);
+ assert_se(sd_netlink_message_close_container(message) >= 0);
+
+ assert_se(sd_netlink_message_rewind(message) >= 0);
+
+ assert_se(sd_netlink_message_enter_container(message, IFLA_PROTINFO) >= 0);
+ assert_se(sd_netlink_message_read_u32(message, IFLA_BRPORT_COST, &cost) >= 0);
+ assert_se(cost == 10);
+ assert_se(sd_netlink_message_exit_container(message) >= 0);
+}
+
+static void test_link_configure(sd_netlink *rtnl, int ifindex) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *message = NULL;
+ const char *mac = "98:fe:94:3f:c6:18", *name = "test";
+ char buffer[ETHER_ADDR_TO_STRING_MAX];
+ unsigned int mtu = 1450, mtu_out;
+ const char *name_out;
+ struct ether_addr mac_out;
+
+ /* we'd really like to test NEWLINK, but let's not mess with the running kernel */
+ assert_se(sd_rtnl_message_new_link(rtnl, &message, RTM_GETLINK, ifindex) >= 0);
+ assert_se(sd_netlink_message_append_string(message, IFLA_IFNAME, name) >= 0);
+ assert_se(sd_netlink_message_append_ether_addr(message, IFLA_ADDRESS, ether_aton(mac)) >= 0);
+ assert_se(sd_netlink_message_append_u32(message, IFLA_MTU, mtu) >= 0);
+
+ assert_se(sd_netlink_call(rtnl, message, 0, NULL) == 1);
+ assert_se(sd_netlink_message_rewind(message) >= 0);
+
+ assert_se(sd_netlink_message_read_string(message, IFLA_IFNAME, &name_out) >= 0);
+ assert_se(streq(name, name_out));
+
+ assert_se(sd_netlink_message_read_ether_addr(message, IFLA_ADDRESS, &mac_out) >= 0);
+ assert_se(streq(mac, ether_addr_to_string(&mac_out, buffer)));
+
+ assert_se(sd_netlink_message_read_u32(message, IFLA_MTU, &mtu_out) >= 0);
+ assert_se(mtu == mtu_out);
+}
+
+static void test_link_get(sd_netlink *rtnl, int ifindex) {
+ sd_netlink_message *m;
+ sd_netlink_message *r;
+ unsigned int mtu = 1500;
+ const char *str_data;
+ uint8_t u8_data;
+ uint32_t u32_data;
+ struct ether_addr eth_data;
+
+ assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0);
+ assert_se(m);
+
+ /* u8 test cases */
+ assert_se(sd_netlink_message_append_u8(m, IFLA_CARRIER, 0) >= 0);
+ assert_se(sd_netlink_message_append_u8(m, IFLA_OPERSTATE, 0) >= 0);
+ assert_se(sd_netlink_message_append_u8(m, IFLA_LINKMODE, 0) >= 0);
+
+ /* u32 test cases */
+ assert_se(sd_netlink_message_append_u32(m, IFLA_MTU, mtu) >= 0);
+ assert_se(sd_netlink_message_append_u32(m, IFLA_GROUP, 0) >= 0);
+ assert_se(sd_netlink_message_append_u32(m, IFLA_TXQLEN, 0) >= 0);
+ assert_se(sd_netlink_message_append_u32(m, IFLA_NUM_TX_QUEUES, 0) >= 0);
+ assert_se(sd_netlink_message_append_u32(m, IFLA_NUM_RX_QUEUES, 0) >= 0);
+
+ assert_se(sd_netlink_call(rtnl, m, -1, &r) == 1);
+
+ assert_se(sd_netlink_message_read_string(r, IFLA_IFNAME, &str_data) == 0);
+
+ assert_se(sd_netlink_message_read_u8(r, IFLA_CARRIER, &u8_data) == 0);
+ assert_se(sd_netlink_message_read_u8(r, IFLA_OPERSTATE, &u8_data) == 0);
+ assert_se(sd_netlink_message_read_u8(r, IFLA_LINKMODE, &u8_data) == 0);
+
+ assert_se(sd_netlink_message_read_u32(r, IFLA_MTU, &u32_data) == 0);
+ assert_se(sd_netlink_message_read_u32(r, IFLA_GROUP, &u32_data) == 0);
+ assert_se(sd_netlink_message_read_u32(r, IFLA_TXQLEN, &u32_data) == 0);
+ assert_se(sd_netlink_message_read_u32(r, IFLA_NUM_TX_QUEUES, &u32_data) == 0);
+ assert_se(sd_netlink_message_read_u32(r, IFLA_NUM_RX_QUEUES, &u32_data) == 0);
+
+ assert_se(sd_netlink_message_read_ether_addr(r, IFLA_ADDRESS, &eth_data) == 0);
+
+ assert_se((m = sd_netlink_message_unref(m)) == NULL);
+ assert_se((r = sd_netlink_message_unref(r)) == NULL);
+}
+
+
+static void test_address_get(sd_netlink *rtnl, int ifindex) {
+ sd_netlink_message *m;
+ sd_netlink_message *r;
+ struct in_addr in_data;
+ struct ifa_cacheinfo cache;
+ const char *label;
+
+ assert_se(sd_rtnl_message_new_addr(rtnl, &m, RTM_GETADDR, ifindex, AF_INET) >= 0);
+ assert_se(m);
+
+ assert_se(sd_netlink_call(rtnl, m, -1, &r) == 1);
+
+ assert_se(sd_netlink_message_read_in_addr(r, IFA_LOCAL, &in_data) == 0);
+ assert_se(sd_netlink_message_read_in_addr(r, IFA_ADDRESS, &in_data) == 0);
+ assert_se(sd_netlink_message_read_string(r, IFA_LABEL, &label) == 0);
+ assert_se(sd_netlink_message_read_cache_info(r, IFA_CACHEINFO, &cache) == 0);
+
+ assert_se((m = sd_netlink_message_unref(m)) == NULL);
+ assert_se((r = sd_netlink_message_unref(r)) == NULL);
+
+}
+
+static void test_route(void) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req;
+ struct in_addr addr, addr_data;
+ uint32_t index = 2, u32_data;
+ int r;
+
+ r = sd_rtnl_message_new_route(NULL, &req, RTM_NEWROUTE, AF_INET, RTPROT_STATIC);
+ if (r < 0) {
+ log_error_errno(r, "Could not create RTM_NEWROUTE message: %m");
+ return;
+ }
+
+ addr.s_addr = htonl(INADDR_LOOPBACK);
+
+ r = sd_netlink_message_append_in_addr(req, RTA_GATEWAY, &addr);
+ if (r < 0) {
+ log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m");
+ return;
+ }
+
+ r = sd_netlink_message_append_u32(req, RTA_OIF, index);
+ if (r < 0) {
+ log_error_errno(r, "Could not append RTA_OIF attribute: %m");
+ return;
+ }
+
+ assert_se(sd_netlink_message_rewind(req) >= 0);
+
+ assert_se(sd_netlink_message_read_in_addr(req, RTA_GATEWAY, &addr_data) >= 0);
+ assert_se(addr_data.s_addr == addr.s_addr);
+
+ assert_se(sd_netlink_message_read_u32(req, RTA_OIF, &u32_data) >= 0);
+ assert_se(u32_data == index);
+
+ assert_se((req = sd_netlink_message_unref(req)) == NULL);
+}
+
+static void test_multiple(void) {
+ sd_netlink *rtnl1, *rtnl2;
+
+ assert_se(sd_netlink_open(&rtnl1) >= 0);
+ assert_se(sd_netlink_open(&rtnl2) >= 0);
+
+ rtnl1 = sd_netlink_unref(rtnl1);
+ rtnl2 = sd_netlink_unref(rtnl2);
+}
+
+static int link_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
+ char *ifname = userdata;
+ const char *data;
+
+ assert_se(rtnl);
+ assert_se(m);
+
+ log_info("got link info about %s", ifname);
+ free(ifname);
+
+ assert_se(sd_netlink_message_read_string(m, IFLA_IFNAME, &data) >= 0);
+ assert_se(streq(data, "lo"));
+
+ return 1;
+}
+
+static void test_event_loop(int ifindex) {
+ _cleanup_event_unref_ sd_event *event = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+ char *ifname;
+
+ ifname = strdup("lo2");
+ assert_se(ifname);
+
+ assert_se(sd_netlink_open(&rtnl) >= 0);
+ assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0);
+
+ assert_se(sd_netlink_call_async(rtnl, m, &link_handler, ifname, 0, NULL) >= 0);
+
+ assert_se(sd_event_default(&event) >= 0);
+
+ assert_se(sd_netlink_attach_event(rtnl, event, 0) >= 0);
+
+ assert_se(sd_event_run(event, 0) >= 0);
+
+ assert_se(sd_netlink_detach_event(rtnl) >= 0);
+
+ assert_se((rtnl = sd_netlink_unref(rtnl)) == NULL);
+}
+
+static int pipe_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
+ int *counter = userdata;
+ int r;
+
+ (*counter) --;
+
+ r = sd_netlink_message_get_errno(m);
+
+ log_info_errno(r, "%d left in pipe. got reply: %m", *counter);
+
+ assert_se(r >= 0);
+
+ return 1;
+}
+
+static void test_async(int ifindex) {
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL, *r = NULL;
+ uint32_t serial;
+ char *ifname;
+
+ ifname = strdup("lo");
+ assert_se(ifname);
+
+ assert_se(sd_netlink_open(&rtnl) >= 0);
+
+ assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0);
+
+ assert_se(sd_netlink_call_async(rtnl, m, &link_handler, ifname, 0, &serial) >= 0);
+
+ assert_se(sd_netlink_wait(rtnl, 0) >= 0);
+ assert_se(sd_netlink_process(rtnl, &r) >= 0);
+
+ assert_se((rtnl = sd_netlink_unref(rtnl)) == NULL);
+}
+
+static void test_pipe(int ifindex) {
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m1 = NULL, *m2 = NULL;
+ int counter = 0;
+
+ assert_se(sd_netlink_open(&rtnl) >= 0);
+
+ assert_se(sd_rtnl_message_new_link(rtnl, &m1, RTM_GETLINK, ifindex) >= 0);
+ assert_se(sd_rtnl_message_new_link(rtnl, &m2, RTM_GETLINK, ifindex) >= 0);
+
+ counter ++;
+ assert_se(sd_netlink_call_async(rtnl, m1, &pipe_handler, &counter, 0, NULL) >= 0);
+
+ counter ++;
+ assert_se(sd_netlink_call_async(rtnl, m2, &pipe_handler, &counter, 0, NULL) >= 0);
+
+ while (counter > 0) {
+ assert_se(sd_netlink_wait(rtnl, 0) >= 0);
+ assert_se(sd_netlink_process(rtnl, NULL) >= 0);
+ }
+
+ assert_se((rtnl = sd_netlink_unref(rtnl)) == NULL);
+}
+
+static void test_container(void) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+ uint16_t u16_data;
+ uint32_t u32_data;
+ const char *string_data;
+
+ assert_se(sd_rtnl_message_new_link(NULL, &m, RTM_NEWLINK, 0) >= 0);
+
+ assert_se(sd_netlink_message_open_container(m, IFLA_LINKINFO) >= 0);
+ assert_se(sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, "vlan") >= 0);
+ assert_se(sd_netlink_message_append_u16(m, IFLA_VLAN_ID, 100) >= 0);
+ assert_se(sd_netlink_message_close_container(m) >= 0);
+ assert_se(sd_netlink_message_append_string(m, IFLA_INFO_KIND, "vlan") >= 0);
+ assert_se(sd_netlink_message_close_container(m) >= 0);
+ assert_se(sd_netlink_message_close_container(m) == -EINVAL);
+
+ assert_se(sd_netlink_message_rewind(m) >= 0);
+
+ assert_se(sd_netlink_message_enter_container(m, IFLA_LINKINFO) >= 0);
+ assert_se(sd_netlink_message_read_string(m, IFLA_INFO_KIND, &string_data) >= 0);
+ assert_se(streq("vlan", string_data));
+
+ assert_se(sd_netlink_message_enter_container(m, IFLA_INFO_DATA) >= 0);
+ assert_se(sd_netlink_message_read_u16(m, IFLA_VLAN_ID, &u16_data) >= 0);
+ assert_se(sd_netlink_message_exit_container(m) >= 0);
+
+ assert_se(sd_netlink_message_read_string(m, IFLA_INFO_KIND, &string_data) >= 0);
+ assert_se(streq("vlan", string_data));
+ assert_se(sd_netlink_message_exit_container(m) >= 0);
+
+ assert_se(sd_netlink_message_read_u32(m, IFLA_LINKINFO, &u32_data) < 0);
+
+ assert_se(sd_netlink_message_exit_container(m) == -EINVAL);
+}
+
+static void test_match(void) {
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
+
+ assert_se(sd_netlink_open(&rtnl) >= 0);
+
+ assert_se(sd_netlink_add_match(rtnl, RTM_NEWLINK, &link_handler, NULL) >= 0);
+ assert_se(sd_netlink_add_match(rtnl, RTM_NEWLINK, &link_handler, NULL) >= 0);
+
+ assert_se(sd_netlink_remove_match(rtnl, RTM_NEWLINK, &link_handler, NULL) == 1);
+ assert_se(sd_netlink_remove_match(rtnl, RTM_NEWLINK, &link_handler, NULL) == 1);
+ assert_se(sd_netlink_remove_match(rtnl, RTM_NEWLINK, &link_handler, NULL) == 0);
+
+ assert_se((rtnl = sd_netlink_unref(rtnl)) == NULL);
+}
+
+static void test_get_addresses(sd_netlink *rtnl) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *m;
+
+ assert_se(sd_rtnl_message_new_addr(rtnl, &req, RTM_GETADDR, 0, AF_UNSPEC) >= 0);
+
+ assert_se(sd_netlink_call(rtnl, req, 0, &reply) >= 0);
+
+ for (m = reply; m; m = sd_netlink_message_next(m)) {
+ uint16_t type;
+ unsigned char scope, flags;
+ int family, ifindex;
+
+ assert_se(sd_netlink_message_get_type(m, &type) >= 0);
+ assert_se(type == RTM_NEWADDR);
+
+ assert_se(sd_rtnl_message_addr_get_ifindex(m, &ifindex) >= 0);
+ assert_se(sd_rtnl_message_addr_get_family(m, &family) >= 0);
+ assert_se(sd_rtnl_message_addr_get_scope(m, &scope) >= 0);
+ assert_se(sd_rtnl_message_addr_get_flags(m, &flags) >= 0);
+
+ assert_se(ifindex > 0);
+ assert_se(family == AF_INET || family == AF_INET6);
+
+ log_info("got IPv%u address on ifindex %i", family == AF_INET ? 4: 6, ifindex);
+ }
+}
+
+static void test_message(void) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+
+ assert_se(rtnl_message_new_synthetic_error(-ETIMEDOUT, 1, &m) >= 0);
+ assert_se(sd_netlink_message_get_errno(m) == -ETIMEDOUT);
+}
+
+int main(void) {
+ sd_netlink *rtnl;
+ sd_netlink_message *m;
+ sd_netlink_message *r;
+ const char *string_data;
+ int if_loopback;
+ uint16_t type;
+
+ test_message();
+
+ test_match();
+
+ test_multiple();
+
+ test_route();
+
+ test_container();
+
+ assert_se(sd_netlink_open(&rtnl) >= 0);
+ assert_se(rtnl);
+
+ if_loopback = (int) if_nametoindex("lo");
+ assert_se(if_loopback > 0);
+
+ test_async(if_loopback);
+
+ test_pipe(if_loopback);
+
+ test_event_loop(if_loopback);
+
+ test_link_configure(rtnl, if_loopback);
+
+ test_get_addresses(rtnl);
+
+ test_message_link_bridge(rtnl);
+
+ assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, if_loopback) >= 0);
+ assert_se(m);
+
+ assert_se(sd_netlink_message_get_type(m, &type) >= 0);
+ assert_se(type == RTM_GETLINK);
+
+ assert_se(sd_netlink_message_read_string(m, IFLA_IFNAME, &string_data) == -EPERM);
+
+ assert_se(sd_netlink_call(rtnl, m, 0, &r) == 1);
+ assert_se(sd_netlink_message_get_type(r, &type) >= 0);
+ assert_se(type == RTM_NEWLINK);
+
+ assert_se((r = sd_netlink_message_unref(r)) == NULL);
+
+ assert_se(sd_netlink_call(rtnl, m, -1, &r) == -EPERM);
+ assert_se((m = sd_netlink_message_unref(m)) == NULL);
+ assert_se((r = sd_netlink_message_unref(r)) == NULL);
+
+ test_link_get(rtnl, if_loopback);
+ test_address_get(rtnl, if_loopback);
+
+ assert_se((m = sd_netlink_message_unref(m)) == NULL);
+ assert_se((r = sd_netlink_message_unref(r)) == NULL);
+ assert_se((rtnl = sd_netlink_unref(rtnl)) == NULL);
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index 207eda163b..b63fdf8fcb 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -338,10 +338,8 @@ _public_ int sd_network_monitor_new(sd_network_monitor **m, const char *category
good = true;
}
- if (!good) {
- close_nointr(fd);
+ if (!good)
return -EINVAL;
- }
*m = FD_TO_MONITOR(fd);
fd = -1;
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
deleted file mode 100644
index 9dcf7df559..0000000000
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ /dev/null
@@ -1,1705 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2013 Tom Gundersen <teg@jklm.no>
-
- systemd 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.1 of the License, or
- (at your option) any later version.
-
- systemd 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <netinet/in.h>
-#include <stdbool.h>
-#include <unistd.h>
-
-#include "util.h"
-#include "formats-util.h"
-#include "refcnt.h"
-#include "missing.h"
-
-#include "sd-rtnl.h"
-#include "rtnl-util.h"
-#include "rtnl-internal.h"
-#include "rtnl-types.h"
-
-#define GET_CONTAINER(m, i) ((i) < (m)->n_containers ? (struct rtattr*)((uint8_t*)(m)->hdr + (m)->container_offsets[i]) : NULL)
-#define PUSH_CONTAINER(m, new) (m)->container_offsets[(m)->n_containers ++] = (uint8_t*)(new) - (uint8_t*)(m)->hdr;
-
-#define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
-
-static int message_new_empty(sd_rtnl *rtnl, sd_rtnl_message **ret) {
- sd_rtnl_message *m;
-
- assert_return(ret, -EINVAL);
-
- /* Note that 'rtnl' is currently unused, if we start using it internally
- we must take care to avoid problems due to mutual references between
- buses and their queued messages. See sd-bus.
- */
-
- m = new0(sd_rtnl_message, 1);
- if (!m)
- return -ENOMEM;
-
- m->n_ref = REFCNT_INIT;
-
- m->sealed = false;
-
- *ret = m;
-
- return 0;
-}
-
-int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t type) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
- const NLType *nl_type;
- size_t size;
- int r;
-
- r = type_system_get_type(NULL, &nl_type, type);
- if (r < 0)
- return r;
-
- r = message_new_empty(rtnl, &m);
- if (r < 0)
- return r;
-
- size = NLMSG_SPACE(nl_type->size);
-
- assert(size >= sizeof(struct nlmsghdr));
- m->hdr = malloc0(size);
- if (!m->hdr)
- return -ENOMEM;
-
- m->hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-
- m->container_type_system[0] = nl_type->type_system;
- m->hdr->nlmsg_len = size;
- m->hdr->nlmsg_type = type;
-
- *ret = m;
- m = NULL;
-
- return 0;
-}
-
-int sd_rtnl_message_route_set_dst_prefixlen(sd_rtnl_message *m, unsigned char prefixlen) {
- struct rtmsg *rtm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
-
- rtm = NLMSG_DATA(m->hdr);
-
- if ((rtm->rtm_family == AF_INET && prefixlen > 32) ||
- (rtm->rtm_family == AF_INET6 && prefixlen > 128))
- return -ERANGE;
-
- rtm->rtm_dst_len = prefixlen;
-
- return 0;
-}
-
-int sd_rtnl_message_route_set_src_prefixlen(sd_rtnl_message *m, unsigned char prefixlen) {
- struct rtmsg *rtm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
-
- rtm = NLMSG_DATA(m->hdr);
-
- if ((rtm->rtm_family == AF_INET && prefixlen > 32) ||
- (rtm->rtm_family == AF_INET6 && prefixlen > 128))
- return -ERANGE;
-
- rtm->rtm_src_len = prefixlen;
-
- return 0;
-}
-
-int sd_rtnl_message_route_set_scope(sd_rtnl_message *m, unsigned char scope) {
- struct rtmsg *rtm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
-
- rtm = NLMSG_DATA(m->hdr);
-
- rtm->rtm_scope = scope;
-
- return 0;
-}
-
-int sd_rtnl_message_route_get_family(sd_rtnl_message *m, int *family) {
- struct rtmsg *rtm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
- assert_return(family, -EINVAL);
-
- rtm = NLMSG_DATA(m->hdr);
-
- *family = rtm->rtm_family;
-
- return 0;
-}
-
-int sd_rtnl_message_route_get_dst_prefixlen(sd_rtnl_message *m, unsigned char *dst_len) {
- struct rtmsg *rtm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
- assert_return(dst_len, -EINVAL);
-
- rtm = NLMSG_DATA(m->hdr);
-
- *dst_len = rtm->rtm_dst_len;
-
- return 0;
-}
-
-int sd_rtnl_message_route_get_src_prefixlen(sd_rtnl_message *m, unsigned char *src_len) {
- struct rtmsg *rtm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
- assert_return(src_len, -EINVAL);
-
- rtm = NLMSG_DATA(m->hdr);
-
- *src_len = rtm->rtm_src_len;
-
- return 0;
-}
-
-int sd_rtnl_message_new_route(sd_rtnl *rtnl, sd_rtnl_message **ret,
- uint16_t nlmsg_type, int rtm_family,
- unsigned char rtm_protocol) {
- struct rtmsg *rtm;
- int r;
-
- assert_return(rtnl_message_type_is_route(nlmsg_type), -EINVAL);
- assert_return((nlmsg_type == RTM_GETROUTE && rtm_family == AF_UNSPEC) ||
- rtm_family == AF_INET || rtm_family == AF_INET6, -EINVAL);
- assert_return(ret, -EINVAL);
-
- r = message_new(rtnl, ret, nlmsg_type);
- if (r < 0)
- return r;
-
- if (nlmsg_type == RTM_NEWROUTE)
- (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_APPEND;
-
- rtm = NLMSG_DATA((*ret)->hdr);
-
- rtm->rtm_family = rtm_family;
- rtm->rtm_scope = RT_SCOPE_UNIVERSE;
- rtm->rtm_type = RTN_UNICAST;
- rtm->rtm_table = RT_TABLE_MAIN;
- rtm->rtm_protocol = rtm_protocol;
-
- return 0;
-}
-
-int sd_rtnl_message_neigh_set_flags(sd_rtnl_message *m, uint8_t flags) {
- struct ndmsg *ndm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
-
- ndm = NLMSG_DATA(m->hdr);
- ndm->ndm_flags |= flags;
-
- return 0;
-}
-
-int sd_rtnl_message_neigh_set_state(sd_rtnl_message *m, uint16_t state) {
- struct ndmsg *ndm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
-
- ndm = NLMSG_DATA(m->hdr);
- ndm->ndm_state |= state;
-
- return 0;
-}
-
-int sd_rtnl_message_neigh_get_flags(sd_rtnl_message *m, uint8_t *flags) {
- struct ndmsg *ndm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
-
- ndm = NLMSG_DATA(m->hdr);
- *flags = ndm->ndm_flags;
-
- return 0;
-}
-
-int sd_rtnl_message_neigh_get_state(sd_rtnl_message *m, uint16_t *state) {
- struct ndmsg *ndm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
-
- ndm = NLMSG_DATA(m->hdr);
- *state = ndm->ndm_state;
-
- return 0;
-}
-
-int sd_rtnl_message_neigh_get_family(sd_rtnl_message *m, int *family) {
- struct ndmsg *ndm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
- assert_return(family, -EINVAL);
-
- ndm = NLMSG_DATA(m->hdr);
-
- *family = ndm->ndm_family;
-
- return 0;
-}
-
-int sd_rtnl_message_neigh_get_ifindex(sd_rtnl_message *m, int *index) {
- struct ndmsg *ndm;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_neigh(m->hdr->nlmsg_type), -EINVAL);
- assert_return(index, -EINVAL);
-
- ndm = NLMSG_DATA(m->hdr);
-
- *index = ndm->ndm_ifindex;
-
- return 0;
-}
-
-int sd_rtnl_message_new_neigh(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t nlmsg_type, int index, int ndm_family) {
- struct ndmsg *ndm;
- int r;
-
- assert_return(rtnl_message_type_is_neigh(nlmsg_type), -EINVAL);
- assert_return(ndm_family == AF_INET ||
- ndm_family == AF_INET6 ||
- ndm_family == PF_BRIDGE, -EINVAL);
- assert_return(ret, -EINVAL);
-
- r = message_new(rtnl, ret, nlmsg_type);
- if (r < 0)
- return r;
-
- if (nlmsg_type == RTM_NEWNEIGH)
- (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_APPEND;
-
- ndm = NLMSG_DATA((*ret)->hdr);
-
- ndm->ndm_family = ndm_family;
- ndm->ndm_ifindex = index;
-
- return 0;
-}
-
-int sd_rtnl_message_link_set_flags(sd_rtnl_message *m, unsigned flags, unsigned change) {
- struct ifinfomsg *ifi;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
- assert_return(change, -EINVAL);
-
- ifi = NLMSG_DATA(m->hdr);
-
- ifi->ifi_flags = flags;
- ifi->ifi_change = change;
-
- return 0;
-}
-
-int sd_rtnl_message_link_set_type(sd_rtnl_message *m, unsigned type) {
- struct ifinfomsg *ifi;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
-
- ifi = NLMSG_DATA(m->hdr);
-
- ifi->ifi_type = type;
-
- return 0;
-}
-
-int sd_rtnl_message_link_set_family(sd_rtnl_message *m, unsigned family) {
- struct ifinfomsg *ifi;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
-
- ifi = NLMSG_DATA(m->hdr);
-
- ifi->ifi_family = family;
-
- return 0;
-}
-
-int sd_rtnl_message_new_link(sd_rtnl *rtnl, sd_rtnl_message **ret,
- uint16_t nlmsg_type, int index) {
- struct ifinfomsg *ifi;
- int r;
-
- assert_return(rtnl_message_type_is_link(nlmsg_type), -EINVAL);
- assert_return(nlmsg_type != RTM_DELLINK || index > 0, -EINVAL);
- assert_return(ret, -EINVAL);
-
- r = message_new(rtnl, ret, nlmsg_type);
- if (r < 0)
- return r;
-
- if (nlmsg_type == RTM_NEWLINK)
- (*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
-
- ifi = NLMSG_DATA((*ret)->hdr);
-
- ifi->ifi_family = AF_UNSPEC;
- ifi->ifi_index = index;
-
- return 0;
-}
-
-int sd_rtnl_message_request_dump(sd_rtnl_message *m, int dump) {
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(m->hdr->nlmsg_type == RTM_GETLINK ||
- m->hdr->nlmsg_type == RTM_GETADDR ||
- m->hdr->nlmsg_type == RTM_GETROUTE ||
- m->hdr->nlmsg_type == RTM_GETNEIGH,
- -EINVAL);
-
- if (dump)
- m->hdr->nlmsg_flags |= NLM_F_DUMP;
- else
- m->hdr->nlmsg_flags &= ~NLM_F_DUMP;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_set_prefixlen(sd_rtnl_message *m, unsigned char prefixlen) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- if ((ifa->ifa_family == AF_INET && prefixlen > 32) ||
- (ifa->ifa_family == AF_INET6 && prefixlen > 128))
- return -ERANGE;
-
- ifa->ifa_prefixlen = prefixlen;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_set_flags(sd_rtnl_message *m, unsigned char flags) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- ifa->ifa_flags = flags;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_set_scope(sd_rtnl_message *m, unsigned char scope) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- ifa->ifa_scope = scope;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_get_family(sd_rtnl_message *m, int *family) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
- assert_return(family, -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- *family = ifa->ifa_family;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_get_prefixlen(sd_rtnl_message *m, unsigned char *prefixlen) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
- assert_return(prefixlen, -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- *prefixlen = ifa->ifa_prefixlen;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_get_scope(sd_rtnl_message *m, unsigned char *scope) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
- assert_return(scope, -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- *scope = ifa->ifa_scope;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_get_flags(sd_rtnl_message *m, unsigned char *flags) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
- assert_return(flags, -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- *flags = ifa->ifa_flags;
-
- return 0;
-}
-
-int sd_rtnl_message_addr_get_ifindex(sd_rtnl_message *m, int *ifindex) {
- struct ifaddrmsg *ifa;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL);
- assert_return(ifindex, -EINVAL);
-
- ifa = NLMSG_DATA(m->hdr);
-
- *ifindex = ifa->ifa_index;
-
- return 0;
-}
-
-int sd_rtnl_message_new_addr(sd_rtnl *rtnl, sd_rtnl_message **ret,
- uint16_t nlmsg_type, int index,
- int family) {
- struct ifaddrmsg *ifa;
- int r;
-
- assert_return(rtnl_message_type_is_addr(nlmsg_type), -EINVAL);
- assert_return((nlmsg_type == RTM_GETADDR && index == 0) ||
- index > 0, -EINVAL);
- assert_return((nlmsg_type == RTM_GETADDR && family == AF_UNSPEC) ||
- family == AF_INET || family == AF_INET6, -EINVAL);
- assert_return(ret, -EINVAL);
-
- r = message_new(rtnl, ret, nlmsg_type);
- if (r < 0)
- return r;
-
- if (nlmsg_type == RTM_GETADDR)
- (*ret)->hdr->nlmsg_flags |= NLM_F_DUMP;
-
- ifa = NLMSG_DATA((*ret)->hdr);
-
- ifa->ifa_index = index;
- ifa->ifa_family = family;
- if (family == AF_INET)
- ifa->ifa_prefixlen = 32;
- else if (family == AF_INET6)
- ifa->ifa_prefixlen = 128;
-
- return 0;
-}
-
-int sd_rtnl_message_new_addr_update(sd_rtnl *rtnl, sd_rtnl_message **ret,
- int index, int family) {
- int r;
-
- r = sd_rtnl_message_new_addr(rtnl, ret, RTM_NEWADDR, index, family);
- if (r < 0)
- return r;
-
- (*ret)->hdr->nlmsg_flags |= NLM_F_REPLACE;
-
- return 0;
-}
-
-sd_rtnl_message *sd_rtnl_message_ref(sd_rtnl_message *m) {
- if (m)
- assert_se(REFCNT_INC(m->n_ref) >= 2);
-
- return m;
-}
-
-sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m) {
- if (m && REFCNT_DEC(m->n_ref) == 0) {
- unsigned i;
-
- free(m->hdr);
-
- for (i = 0; i <= m->n_containers; i++)
- free(m->rta_offset_tb[i]);
-
- sd_rtnl_message_unref(m->next);
-
- free(m);
- }
-
- return NULL;
-}
-
-int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type) {
- assert_return(m, -EINVAL);
- assert_return(type, -EINVAL);
-
- *type = m->hdr->nlmsg_type;
-
- return 0;
-}
-
-int sd_rtnl_message_get_family(sd_rtnl_message *m, int *family) {
- assert_return(m, -EINVAL);
- assert_return(family, -EINVAL);
-
- assert(m->hdr);
-
- if (rtnl_message_type_is_link(m->hdr->nlmsg_type)) {
- struct ifinfomsg *ifi;
-
- ifi = NLMSG_DATA(m->hdr);
-
- *family = ifi->ifi_family;
-
- return 0;
- } else if (rtnl_message_type_is_route(m->hdr->nlmsg_type)) {
- struct rtmsg *rtm;
-
- rtm = NLMSG_DATA(m->hdr);
-
- *family = rtm->rtm_family;
-
- return 0;
- } else if (rtnl_message_type_is_neigh(m->hdr->nlmsg_type)) {
- struct ndmsg *ndm;
-
- ndm = NLMSG_DATA(m->hdr);
-
- *family = ndm->ndm_family;
-
- return 0;
- } else if (rtnl_message_type_is_addr(m->hdr->nlmsg_type)) {
- struct ifaddrmsg *ifa;
-
- ifa = NLMSG_DATA(m->hdr);
-
- *family = ifa->ifa_family;
-
- return 0;
- }
-
- return -EOPNOTSUPP;
-}
-
-int sd_rtnl_message_is_broadcast(sd_rtnl_message *m) {
- assert_return(m, -EINVAL);
-
- return m->broadcast;
-}
-
-int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) {
- struct ifinfomsg *ifi;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
- assert_return(ifindex, -EINVAL);
-
- ifi = NLMSG_DATA(m->hdr);
-
- *ifindex = ifi->ifi_index;
-
- return 0;
-}
-
-int sd_rtnl_message_link_get_flags(sd_rtnl_message *m, unsigned *flags) {
- struct ifinfomsg *ifi;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
- assert_return(flags, -EINVAL);
-
- ifi = NLMSG_DATA(m->hdr);
-
- *flags = ifi->ifi_flags;
-
- return 0;
-}
-
-int sd_rtnl_message_link_get_type(sd_rtnl_message *m, unsigned *type) {
- struct ifinfomsg *ifi;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
- assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
- assert_return(type, -EINVAL);
-
- ifi = NLMSG_DATA(m->hdr);
-
- *type = ifi->ifi_type;
-
- return 0;
-}
-
-/* If successful the updated message will be correctly aligned, if
- unsuccessful the old message is untouched. */
-static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, size_t data_length) {
- uint32_t rta_length;
- size_t message_length, padding_length;
- struct nlmsghdr *new_hdr;
- struct rtattr *rta;
- char *padding;
- unsigned i;
- int offset;
-
- assert(m);
- assert(m->hdr);
- assert(!m->sealed);
- assert(NLMSG_ALIGN(m->hdr->nlmsg_len) == m->hdr->nlmsg_len);
- assert(!data || data_length);
-
- /* get offset of the new attribute */
- offset = m->hdr->nlmsg_len;
-
- /* get the size of the new rta attribute (with padding at the end) */
- rta_length = RTA_LENGTH(data_length);
-
- /* get the new message size (with padding at the end) */
- message_length = offset + RTA_ALIGN(rta_length);
-
- /* realloc to fit the new attribute */
- new_hdr = realloc(m->hdr, message_length);
- if (!new_hdr)
- return -ENOMEM;
- m->hdr = new_hdr;
-
- /* get pointer to the attribute we are about to add */
- rta = (struct rtattr *) ((uint8_t *) m->hdr + offset);
-
- /* if we are inside containers, extend them */
- for (i = 0; i < m->n_containers; i++)
- GET_CONTAINER(m, i)->rta_len += message_length - offset;
-
- /* fill in the attribute */
- rta->rta_type = type;
- rta->rta_len = rta_length;
- if (data)
- /* we don't deal with the case where the user lies about the type
- * and gives us too little data (so don't do that)
- */
- padding = mempcpy(RTA_DATA(rta), data, data_length);
- else {
- /* if no data was passed, make sure we still initialize the padding
- note that we can have data_length > 0 (used by some containers) */
- padding = RTA_DATA(rta);
- }
-
- /* make sure also the padding at the end of the message is initialized */
- padding_length = (uint8_t*)m->hdr + message_length - (uint8_t*)padding;
- memzero(padding, padding_length);
-
- /* update message size */
- m->hdr->nlmsg_len = message_length;
-
- return offset;
-}
-
-static int message_attribute_has_type(sd_rtnl_message *m, uint16_t attribute_type, uint16_t data_type) {
- const NLType *type;
- int r;
-
- r = type_system_get_type(m->container_type_system[m->n_containers], &type, attribute_type);
- if (r < 0)
- return r;
-
- if (type->type != data_type)
- return -EINVAL;
-
- return type->size;
-}
-
-int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const char *data) {
- size_t length, size;
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
- assert_return(data, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_STRING);
- if (r < 0)
- return r;
- else
- size = (size_t)r;
-
- if (size) {
- length = strnlen(data, size+1);
- if (length > size)
- return -EINVAL;
- } else
- length = strlen(data);
-
- r = add_rtattr(m, type, data, length + 1);
- if (r < 0)
- return r;
-
- return 0;
-}
-
-int sd_rtnl_message_append_u8(sd_rtnl_message *m, unsigned short type, uint8_t data) {
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
-
- r = message_attribute_has_type(m, type, NLA_U8);
- if (r < 0)
- return r;
-
- r = add_rtattr(m, type, &data, sizeof(uint8_t));
- if (r < 0)
- return r;
-
- return 0;
-}
-
-
-int sd_rtnl_message_append_u16(sd_rtnl_message *m, unsigned short type, uint16_t data) {
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
-
- r = message_attribute_has_type(m, type, NLA_U16);
- if (r < 0)
- return r;
-
- r = add_rtattr(m, type, &data, sizeof(uint16_t));
- if (r < 0)
- return r;
-
- return 0;
-}
-
-int sd_rtnl_message_append_u32(sd_rtnl_message *m, unsigned short type, uint32_t data) {
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
-
- r = message_attribute_has_type(m, type, NLA_U32);
- if (r < 0)
- return r;
-
- r = add_rtattr(m, type, &data, sizeof(uint32_t));
- if (r < 0)
- return r;
-
- return 0;
-}
-
-int sd_rtnl_message_append_in_addr(sd_rtnl_message *m, unsigned short type, const struct in_addr *data) {
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
- assert_return(data, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_IN_ADDR);
- if (r < 0)
- return r;
-
- r = add_rtattr(m, type, data, sizeof(struct in_addr));
- if (r < 0)
- return r;
-
- return 0;
-}
-
-int sd_rtnl_message_append_in6_addr(sd_rtnl_message *m, unsigned short type, const struct in6_addr *data) {
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
- assert_return(data, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_IN_ADDR);
- if (r < 0)
- return r;
-
- r = add_rtattr(m, type, data, sizeof(struct in6_addr));
- if (r < 0)
- return r;
-
- return 0;
-}
-
-int sd_rtnl_message_append_ether_addr(sd_rtnl_message *m, unsigned short type, const struct ether_addr *data) {
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
- assert_return(data, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_ETHER_ADDR);
- if (r < 0)
- return r;
-
- r = add_rtattr(m, type, data, ETH_ALEN);
- if (r < 0)
- return r;
-
- return 0;
-}
-
-int sd_rtnl_message_append_cache_info(sd_rtnl_message *m, unsigned short type, const struct ifa_cacheinfo *info) {
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
- assert_return(info, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_CACHE_INFO);
- if (r < 0)
- return r;
-
- r = add_rtattr(m, type, info, sizeof(struct ifa_cacheinfo));
- if (r < 0)
- return r;
-
- return 0;
-}
-
-int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type) {
- size_t size;
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
- assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -ERANGE);
-
- r = message_attribute_has_type(m, type, NLA_NESTED);
- if (r < 0) {
- const NLTypeSystemUnion *type_system_union;
- int family;
-
- r = message_attribute_has_type(m, type, NLA_UNION);
- if (r < 0)
- return r;
- size = (size_t) r;
-
- r = sd_rtnl_message_get_family(m, &family);
- if (r < 0)
- return r;
-
- r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
- if (r < 0)
- return r;
-
- r = type_system_union_protocol_get_type_system(type_system_union,
- &m->container_type_system[m->n_containers + 1],
- family);
- if (r < 0)
- return r;
- } else {
- size = (size_t)r;
-
- r = type_system_get_type_system(m->container_type_system[m->n_containers],
- &m->container_type_system[m->n_containers + 1],
- type);
- if (r < 0)
- return r;
- }
-
- r = add_rtattr(m, type | NLA_F_NESTED, NULL, size);
- if (r < 0)
- return r;
-
- m->container_offsets[m->n_containers ++] = r;
-
- return 0;
-}
-
-int sd_rtnl_message_open_container_union(sd_rtnl_message *m, unsigned short type, const char *key) {
- const NLTypeSystemUnion *type_system_union;
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
-
- r = type_system_get_type_system_union(m->container_type_system[m->n_containers], &type_system_union, type);
- if (r < 0)
- return r;
-
- r = type_system_union_get_type_system(type_system_union,
- &m->container_type_system[m->n_containers + 1],
- key);
- if (r < 0)
- return r;
-
- r = sd_rtnl_message_append_string(m, type_system_union->match, key);
- if (r < 0)
- return r;
-
- /* do we evere need non-null size */
- r = add_rtattr(m, type, NULL, 0);
- if (r < 0)
- return r;
-
- m->container_offsets[m->n_containers ++] = r;
-
- return 0;
-}
-
-
-int sd_rtnl_message_close_container(sd_rtnl_message *m) {
- assert_return(m, -EINVAL);
- assert_return(!m->sealed, -EPERM);
- assert_return(m->n_containers > 0, -EINVAL);
-
- m->container_type_system[m->n_containers] = NULL;
- m->n_containers --;
-
- return 0;
-}
-
-int rtnl_message_read_internal(sd_rtnl_message *m, unsigned short type, void **data) {
- struct rtattr *rta;
-
- assert_return(m, -EINVAL);
- assert_return(m->sealed, -EPERM);
- assert_return(data, -EINVAL);
- assert(m->n_containers <= RTNL_CONTAINER_DEPTH);
- assert(m->rta_offset_tb[m->n_containers]);
- assert(type < m->rta_tb_size[m->n_containers]);
-
- if(!m->rta_offset_tb[m->n_containers][type])
- return -ENODATA;
-
- rta = (struct rtattr*)((uint8_t *) m->hdr + m->rta_offset_tb[m->n_containers][type]);
-
- *data = RTA_DATA(rta);
-
- return RTA_PAYLOAD(rta);
-}
-
-int sd_rtnl_message_read_string(sd_rtnl_message *m, unsigned short type, const char **data) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_STRING);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if (strnlen(attr_data, r) >= (size_t) r)
- return -EIO;
-
- if (data)
- *data = (const char *) attr_data;
-
- return 0;
-}
-
-int sd_rtnl_message_read_u8(sd_rtnl_message *m, unsigned short type, uint8_t *data) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_U8);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if ((size_t) r < sizeof(uint8_t))
- return -EIO;
-
- if (data)
- *data = *(uint8_t *) attr_data;
-
- return 0;
-}
-
-int sd_rtnl_message_read_u16(sd_rtnl_message *m, unsigned short type, uint16_t *data) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_U16);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if ((size_t) r < sizeof(uint16_t))
- return -EIO;
-
- if (data)
- *data = *(uint16_t *) attr_data;
-
- return 0;
-}
-
-int sd_rtnl_message_read_u32(sd_rtnl_message *m, unsigned short type, uint32_t *data) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_U32);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if ((size_t)r < sizeof(uint32_t))
- return -EIO;
-
- if (data)
- *data = *(uint32_t *) attr_data;
-
- return 0;
-}
-
-int sd_rtnl_message_read_ether_addr(sd_rtnl_message *m, unsigned short type, struct ether_addr *data) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_ETHER_ADDR);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if ((size_t)r < sizeof(struct ether_addr))
- return -EIO;
-
- if (data)
- memcpy(data, attr_data, sizeof(struct ether_addr));
-
- return 0;
-}
-
-int sd_rtnl_message_read_cache_info(sd_rtnl_message *m, unsigned short type, struct ifa_cacheinfo *info) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_CACHE_INFO);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if ((size_t)r < sizeof(struct ifa_cacheinfo))
- return -EIO;
-
- if (info)
- memcpy(info, attr_data, sizeof(struct ifa_cacheinfo));
-
- return 0;
-}
-
-int sd_rtnl_message_read_in_addr(sd_rtnl_message *m, unsigned short type, struct in_addr *data) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_IN_ADDR);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if ((size_t)r < sizeof(struct in_addr))
- return -EIO;
-
- if (data)
- memcpy(data, attr_data, sizeof(struct in_addr));
-
- return 0;
-}
-
-int sd_rtnl_message_read_in6_addr(sd_rtnl_message *m, unsigned short type, struct in6_addr *data) {
- int r;
- void *attr_data;
-
- assert_return(m, -EINVAL);
-
- r = message_attribute_has_type(m, type, NLA_IN_ADDR);
- if (r < 0)
- return r;
-
- r = rtnl_message_read_internal(m, type, &attr_data);
- if (r < 0)
- return r;
- else if ((size_t)r < sizeof(struct in6_addr))
- return -EIO;
-
- if (data)
- memcpy(data, attr_data, sizeof(struct in6_addr));
-
- return 0;
-}
-
-int sd_rtnl_message_enter_container(sd_rtnl_message *m, unsigned short type) {
- const NLType *nl_type;
- const NLTypeSystem *type_system;
- void *container;
- size_t size;
- int r;
-
- assert_return(m, -EINVAL);
- assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -EINVAL);
-
- r = type_system_get_type(m->container_type_system[m->n_containers],
- &nl_type,
- type);
- if (r < 0)
- return r;
-
- if (nl_type->type == NLA_NESTED) {
- r = type_system_get_type_system(m->container_type_system[m->n_containers],
- &type_system,
- type);
- if (r < 0)
- return r;
- } else if (nl_type->type == NLA_UNION) {
- const NLTypeSystemUnion *type_system_union;
-
- r = type_system_get_type_system_union(m->container_type_system[m->n_containers],
- &type_system_union,
- type);
- if (r < 0)
- return r;
-
- switch (type_system_union->match_type) {
- case NL_MATCH_SIBLING:
- {
- const char *key;
-
- r = sd_rtnl_message_read_string(m, type_system_union->match, &key);
- if (r < 0)
- return r;
-
- r = type_system_union_get_type_system(type_system_union,
- &type_system,
- key);
- if (r < 0)
- return r;
-
- break;
- }
- case NL_MATCH_PROTOCOL:
- {
- int family;
-
- r = sd_rtnl_message_get_family(m, &family);
- if (r < 0)
- return r;
-
- r = type_system_union_protocol_get_type_system(type_system_union,
- &type_system,
- family);
- if (r < 0)
- return r;
-
- break;
- }
- default:
- assert_not_reached("sd-rtnl: invalid type system union type");
- }
- } else
- return -EINVAL;
-
- r = rtnl_message_read_internal(m, type, &container);
- if (r < 0)
- return r;
- else
- size = (size_t)r;
-
- m->n_containers ++;
-
- r = rtnl_message_parse(m,
- &m->rta_offset_tb[m->n_containers],
- &m->rta_tb_size[m->n_containers],
- type_system->max,
- container,
- size);
- if (r < 0) {
- m->n_containers --;
- return r;
- }
-
- m->container_type_system[m->n_containers] = type_system;
-
- return 0;
-}
-
-int sd_rtnl_message_exit_container(sd_rtnl_message *m) {
- assert_return(m, -EINVAL);
- assert_return(m->sealed, -EINVAL);
- assert_return(m->n_containers > 0, -EINVAL);
-
- free(m->rta_offset_tb[m->n_containers]);
- m->rta_offset_tb[m->n_containers] = NULL;
- m->container_type_system[m->n_containers] = NULL;
-
- m->n_containers --;
-
- return 0;
-}
-
-uint32_t rtnl_message_get_serial(sd_rtnl_message *m) {
- assert(m);
- assert(m->hdr);
-
- return m->hdr->nlmsg_seq;
-}
-
-int sd_rtnl_message_is_error(sd_rtnl_message *m) {
- assert_return(m, 0);
- assert_return(m->hdr, 0);
-
- return m->hdr->nlmsg_type == NLMSG_ERROR;
-}
-
-int sd_rtnl_message_get_errno(sd_rtnl_message *m) {
- struct nlmsgerr *err;
-
- assert_return(m, -EINVAL);
- assert_return(m->hdr, -EINVAL);
-
- if (!sd_rtnl_message_is_error(m))
- return 0;
-
- err = NLMSG_DATA(m->hdr);
-
- return err->error;
-}
-
-int rtnl_message_parse(sd_rtnl_message *m,
- size_t **rta_offset_tb,
- unsigned short *rta_tb_size,
- int max,
- struct rtattr *rta,
- unsigned int rt_len) {
- unsigned short type;
- size_t *tb;
-
- tb = new0(size_t, max + 1);
- if(!tb)
- return -ENOMEM;
-
- *rta_tb_size = max + 1;
-
- for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
- type = RTA_TYPE(rta);
-
- /* if the kernel is newer than the headers we used
- when building, we ignore out-of-range attributes
- */
- if (type > max)
- continue;
-
- if (tb[type])
- log_debug("rtnl: message parse - overwriting repeated attribute");
-
- tb[type] = (uint8_t *) rta - (uint8_t *) m->hdr;
- }
-
- *rta_offset_tb = tb;
-
- return 0;
-}
-
-/* returns the number of bytes sent, or a negative error code */
-int socket_write_message(sd_rtnl *nl, sd_rtnl_message *m) {
- union {
- struct sockaddr sa;
- struct sockaddr_nl nl;
- } addr = {
- .nl.nl_family = AF_NETLINK,
- };
- ssize_t k;
-
- assert(nl);
- assert(m);
- assert(m->hdr);
-
- k = sendto(nl->fd, m->hdr, m->hdr->nlmsg_len,
- 0, &addr.sa, sizeof(addr));
- if (k < 0)
- return (errno == EAGAIN) ? 0 : -errno;
-
- return k;
-}
-
-static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool peek) {
- uint8_t cred_buffer[CMSG_SPACE(sizeof(struct ucred)) +
- CMSG_SPACE(sizeof(struct nl_pktinfo))];
- struct msghdr msg = {
- .msg_iov = iov,
- .msg_iovlen = 1,
- .msg_control = cred_buffer,
- .msg_controllen = sizeof(cred_buffer),
- };
- struct cmsghdr *cmsg;
- uint32_t group = 0;
- bool auth = false;
- int r;
-
- assert(fd >= 0);
- assert(iov);
-
- r = recvmsg(fd, &msg, MSG_TRUNC | (peek ? MSG_PEEK : 0));
- if (r < 0) {
- /* no data */
- if (errno == ENOBUFS)
- log_debug("rtnl: kernel receive buffer overrun");
- else if (errno == EAGAIN)
- log_debug("rtnl: no data in socket");
-
- return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
- }
-
- CMSG_FOREACH(cmsg, &msg) {
- if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_CREDENTIALS &&
- cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred))) {
- struct ucred *ucred = (void *)CMSG_DATA(cmsg);
-
- /* from the kernel */
- if (ucred->pid == 0)
- auth = true;
- else
- log_debug("rtnl: ignoring message from PID "PID_FMT, ucred->pid);
- } else if (cmsg->cmsg_level == SOL_NETLINK &&
- cmsg->cmsg_type == NETLINK_PKTINFO &&
- cmsg->cmsg_len == CMSG_LEN(sizeof(struct nl_pktinfo))) {
- struct nl_pktinfo *pktinfo = (void *)CMSG_DATA(cmsg);
-
- /* multi-cast group */
- group = pktinfo->group;
- }
- }
-
- if (!auth) {
- /* not from the kernel, ignore */
- if (peek) {
- /* drop the message */
- r = recvmsg(fd, &msg, 0);
- if (r < 0)
- return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
- }
-
- return 0;
- }
-
- if (_group)
- *_group = group;
-
- return r;
-}
-
-/* On success, the number of bytes received is returned and *ret points to the received message
- * which has a valid header and the correct size.
- * If nothing useful was received 0 is returned.
- * On failure, a negative error code is returned.
- */
-int socket_read_message(sd_rtnl *rtnl) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *first = NULL;
- struct iovec iov = {};
- uint32_t group = 0;
- bool multi_part = false, done = false;
- struct nlmsghdr *new_msg;
- size_t len;
- int r;
- unsigned i = 0;
-
- assert(rtnl);
- assert(rtnl->rbuffer);
- assert(rtnl->rbuffer_allocated >= sizeof(struct nlmsghdr));
-
- /* read nothing, just get the pending message size */
- r = socket_recv_message(rtnl->fd, &iov, NULL, true);
- if (r <= 0)
- return r;
- else
- len = (size_t)r;
-
- /* make room for the pending message */
- if (!greedy_realloc((void **)&rtnl->rbuffer,
- &rtnl->rbuffer_allocated,
- len, sizeof(uint8_t)))
- return -ENOMEM;
-
- iov.iov_base = rtnl->rbuffer;
- iov.iov_len = rtnl->rbuffer_allocated;
-
- /* read the pending message */
- r = socket_recv_message(rtnl->fd, &iov, &group, false);
- if (r <= 0)
- return r;
- else
- len = (size_t)r;
-
- if (len > rtnl->rbuffer_allocated)
- /* message did not fit in read buffer */
- return -EIO;
-
- if (NLMSG_OK(rtnl->rbuffer, len) && rtnl->rbuffer->nlmsg_flags & NLM_F_MULTI) {
- multi_part = true;
-
- for (i = 0; i < rtnl->rqueue_partial_size; i++) {
- if (rtnl_message_get_serial(rtnl->rqueue_partial[i]) ==
- rtnl->rbuffer->nlmsg_seq) {
- first = rtnl->rqueue_partial[i];
- break;
- }
- }
- }
-
- for (new_msg = rtnl->rbuffer; NLMSG_OK(new_msg, len) && !done; new_msg = NLMSG_NEXT(new_msg, len)) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
- const NLType *nl_type;
-
- if (!group && new_msg->nlmsg_pid != rtnl->sockaddr.nl.nl_pid)
- /* not broadcast and not for us */
- continue;
-
- if (new_msg->nlmsg_type == NLMSG_NOOP)
- /* silently drop noop messages */
- continue;
-
- if (new_msg->nlmsg_type == NLMSG_DONE) {
- /* finished reading multi-part message */
- done = true;
-
- /* if first is not defined, put NLMSG_DONE into the receive queue. */
- if (first)
- continue;
- }
-
- /* check that we support this message type */
- r = type_system_get_type(NULL, &nl_type, new_msg->nlmsg_type);
- if (r < 0) {
- if (r == -EOPNOTSUPP)
- log_debug("sd-rtnl: ignored message with unknown type: %i",
- new_msg->nlmsg_type);
-
- continue;
- }
-
- /* check that the size matches the message type */
- if (new_msg->nlmsg_len < NLMSG_LENGTH(nl_type->size)) {
- log_debug("sd-rtnl: message larger than expected, dropping");
- continue;
- }
-
- r = message_new_empty(rtnl, &m);
- if (r < 0)
- return r;
-
- m->broadcast = !!group;
-
- m->hdr = memdup(new_msg, new_msg->nlmsg_len);
- if (!m->hdr)
- return -ENOMEM;
-
- /* seal and parse the top-level message */
- r = sd_rtnl_message_rewind(m);
- if (r < 0)
- return r;
-
- /* push the message onto the multi-part message stack */
- if (first)
- m->next = first;
- first = m;
- m = NULL;
- }
-
- if (len)
- log_debug("sd-rtnl: discarding %zu bytes of incoming message", len);
-
- if (!first)
- return 0;
-
- if (!multi_part || done) {
- /* we got a complete message, push it on the read queue */
- r = rtnl_rqueue_make_room(rtnl);
- if (r < 0)
- return r;
-
- rtnl->rqueue[rtnl->rqueue_size ++] = first;
- first = NULL;
-
- if (multi_part && (i < rtnl->rqueue_partial_size)) {
- /* remove the message form the partial read queue */
- memmove(rtnl->rqueue_partial + i,rtnl->rqueue_partial + i + 1,
- sizeof(sd_rtnl_message*) * (rtnl->rqueue_partial_size - i - 1));
- rtnl->rqueue_partial_size --;
- }
-
- return 1;
- } else {
- /* we only got a partial multi-part message, push it on the
- partial read queue */
- if (i < rtnl->rqueue_partial_size) {
- rtnl->rqueue_partial[i] = first;
- } else {
- r = rtnl_rqueue_partial_make_room(rtnl);
- if (r < 0)
- return r;
-
- rtnl->rqueue_partial[rtnl->rqueue_partial_size ++] = first;
- }
- first = NULL;
-
- return 0;
- }
-}
-
-int sd_rtnl_message_rewind(sd_rtnl_message *m) {
- const NLType *type;
- unsigned i;
- int r;
-
- assert_return(m, -EINVAL);
-
- /* don't allow appending to message once parsed */
- if (!m->sealed)
- rtnl_message_seal(m);
-
- for (i = 1; i <= m->n_containers; i++) {
- free(m->rta_offset_tb[i]);
- m->rta_offset_tb[i] = NULL;
- m->rta_tb_size[i] = 0;
- m->container_type_system[i] = NULL;
- }
-
- m->n_containers = 0;
-
- if (m->rta_offset_tb[0]) {
- /* top-level attributes have already been parsed */
- return 0;
- }
-
- assert(m->hdr);
-
- r = type_system_get_type(NULL, &type, m->hdr->nlmsg_type);
- if (r < 0)
- return r;
-
- if (type->type == NLA_NESTED) {
- const NLTypeSystem *type_system = type->type_system;
-
- assert(type_system);
-
- m->container_type_system[0] = type_system;
-
- r = rtnl_message_parse(m,
- &m->rta_offset_tb[m->n_containers],
- &m->rta_tb_size[m->n_containers],
- type_system->max,
- (struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) +
- NLMSG_ALIGN(type->size)),
- NLMSG_PAYLOAD(m->hdr, type->size));
- if (r < 0)
- return r;
- }
-
- return 0;
-}
-
-void rtnl_message_seal(sd_rtnl_message *m) {
- assert(m);
- assert(!m->sealed);
-
- m->sealed = true;
-}
-
-sd_rtnl_message *sd_rtnl_message_next(sd_rtnl_message *m) {
- assert_return(m, NULL);
-
- return m->next;
-}
diff --git a/src/libsystemd/sd-rtnl/test-rtnl.c b/src/libsystemd/sd-rtnl/test-rtnl.c
deleted file mode 100644
index 47cce64816..0000000000
--- a/src/libsystemd/sd-rtnl/test-rtnl.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2013 Tom Gundersen <teg@jklm.no>
-
- systemd 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.1 of the License, or
- (at your option) any later version.
-
- systemd 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <netinet/ether.h>
-#include <net/if.h>
-
-#include "util.h"
-#include "macro.h"
-#include "sd-rtnl.h"
-#include "socket-util.h"
-#include "rtnl-util.h"
-#include "event-util.h"
-#include "missing.h"
-
-static void test_message_link_bridge(sd_rtnl *rtnl) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *message = NULL;
- uint32_t cost;
-
- assert_se(sd_rtnl_message_new_link(rtnl, &message, RTM_NEWLINK, 1) >= 0);
- assert_se(sd_rtnl_message_link_set_family(message, PF_BRIDGE) >= 0);
- assert_se(sd_rtnl_message_open_container(message, IFLA_PROTINFO) >= 0);
- assert_se(sd_rtnl_message_append_u32(message, IFLA_BRPORT_COST, 10) >= 0);
- assert_se(sd_rtnl_message_close_container(message) >= 0);
-
- assert_se(sd_rtnl_message_rewind(message) >= 0);
-
- assert_se(sd_rtnl_message_enter_container(message, IFLA_PROTINFO) >= 0);
- assert_se(sd_rtnl_message_read_u32(message, IFLA_BRPORT_COST, &cost) >= 0);
- assert_se(cost == 10);
- assert_se(sd_rtnl_message_exit_container(message) >= 0);
-}
-
-static void test_link_configure(sd_rtnl *rtnl, int ifindex) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *message = NULL;
- const char *mac = "98:fe:94:3f:c6:18", *name = "test";
- char buffer[ETHER_ADDR_TO_STRING_MAX];
- unsigned int mtu = 1450, mtu_out;
- const char *name_out;
- struct ether_addr mac_out;
-
- /* we'd really like to test NEWLINK, but let's not mess with the running kernel */
- assert_se(sd_rtnl_message_new_link(rtnl, &message, RTM_GETLINK, ifindex) >= 0);
- assert_se(sd_rtnl_message_append_string(message, IFLA_IFNAME, name) >= 0);
- assert_se(sd_rtnl_message_append_ether_addr(message, IFLA_ADDRESS, ether_aton(mac)) >= 0);
- assert_se(sd_rtnl_message_append_u32(message, IFLA_MTU, mtu) >= 0);
-
- assert_se(sd_rtnl_call(rtnl, message, 0, NULL) == 1);
- assert_se(sd_rtnl_message_rewind(message) >= 0);
-
- assert_se(sd_rtnl_message_read_string(message, IFLA_IFNAME, &name_out) >= 0);
- assert_se(streq(name, name_out));
-
- assert_se(sd_rtnl_message_read_ether_addr(message, IFLA_ADDRESS, &mac_out) >= 0);
- assert_se(streq(mac, ether_addr_to_string(&mac_out, buffer)));
-
- assert_se(sd_rtnl_message_read_u32(message, IFLA_MTU, &mtu_out) >= 0);
- assert_se(mtu == mtu_out);
-}
-
-static void test_link_get(sd_rtnl *rtnl, int ifindex) {
- sd_rtnl_message *m;
- sd_rtnl_message *r;
- unsigned int mtu = 1500;
- const char *str_data;
- uint8_t u8_data;
- uint32_t u32_data;
- struct ether_addr eth_data;
-
- assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0);
- assert_se(m);
-
- /* u8 test cases */
- assert_se(sd_rtnl_message_append_u8(m, IFLA_CARRIER, 0) >= 0);
- assert_se(sd_rtnl_message_append_u8(m, IFLA_OPERSTATE, 0) >= 0);
- assert_se(sd_rtnl_message_append_u8(m, IFLA_LINKMODE, 0) >= 0);
-
- /* u32 test cases */
- assert_se(sd_rtnl_message_append_u32(m, IFLA_MTU, mtu) >= 0);
- assert_se(sd_rtnl_message_append_u32(m, IFLA_GROUP, 0) >= 0);
- assert_se(sd_rtnl_message_append_u32(m, IFLA_TXQLEN, 0) >= 0);
- assert_se(sd_rtnl_message_append_u32(m, IFLA_NUM_TX_QUEUES, 0) >= 0);
- assert_se(sd_rtnl_message_append_u32(m, IFLA_NUM_RX_QUEUES, 0) >= 0);
-
- assert_se(sd_rtnl_call(rtnl, m, -1, &r) == 1);
-
- assert_se(sd_rtnl_message_read_string(r, IFLA_IFNAME, &str_data) == 0);
-
- assert_se(sd_rtnl_message_read_u8(r, IFLA_CARRIER, &u8_data) == 0);
- assert_se(sd_rtnl_message_read_u8(r, IFLA_OPERSTATE, &u8_data) == 0);
- assert_se(sd_rtnl_message_read_u8(r, IFLA_LINKMODE, &u8_data) == 0);
-
- assert_se(sd_rtnl_message_read_u32(r, IFLA_MTU, &u32_data) == 0);
- assert_se(sd_rtnl_message_read_u32(r, IFLA_GROUP, &u32_data) == 0);
- assert_se(sd_rtnl_message_read_u32(r, IFLA_TXQLEN, &u32_data) == 0);
- assert_se(sd_rtnl_message_read_u32(r, IFLA_NUM_TX_QUEUES, &u32_data) == 0);
- assert_se(sd_rtnl_message_read_u32(r, IFLA_NUM_RX_QUEUES, &u32_data) == 0);
-
- assert_se(sd_rtnl_message_read_ether_addr(r, IFLA_ADDRESS, &eth_data) == 0);
-
- assert_se(sd_rtnl_flush(rtnl) >= 0);
- assert_se((m = sd_rtnl_message_unref(m)) == NULL);
- assert_se((r = sd_rtnl_message_unref(r)) == NULL);
-}
-
-
-static void test_address_get(sd_rtnl *rtnl, int ifindex) {
- sd_rtnl_message *m;
- sd_rtnl_message *r;
- struct in_addr in_data;
- struct ifa_cacheinfo cache;
- const char *label;
-
- assert_se(sd_rtnl_message_new_addr(rtnl, &m, RTM_GETADDR, ifindex, AF_INET) >= 0);
- assert_se(m);
-
- assert_se(sd_rtnl_call(rtnl, m, -1, &r) == 1);
-
- assert_se(sd_rtnl_message_read_in_addr(r, IFA_LOCAL, &in_data) == 0);
- assert_se(sd_rtnl_message_read_in_addr(r, IFA_ADDRESS, &in_data) == 0);
- assert_se(sd_rtnl_message_read_string(r, IFA_LABEL, &label) == 0);
- assert_se(sd_rtnl_message_read_cache_info(r, IFA_CACHEINFO, &cache) == 0);
-
- assert_se(sd_rtnl_flush(rtnl) >= 0);
- assert_se((m = sd_rtnl_message_unref(m)) == NULL);
- assert_se((r = sd_rtnl_message_unref(r)) == NULL);
-
-}
-
-static void test_route(void) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req;
- struct in_addr addr, addr_data;
- uint32_t index = 2, u32_data;
- int r;
-
- r = sd_rtnl_message_new_route(NULL, &req, RTM_NEWROUTE, AF_INET, RTPROT_STATIC);
- if (r < 0) {
- log_error_errno(r, "Could not create RTM_NEWROUTE message: %m");
- return;
- }
-
- addr.s_addr = htonl(INADDR_LOOPBACK);
-
- r = sd_rtnl_message_append_in_addr(req, RTA_GATEWAY, &addr);
- if (r < 0) {
- log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m");
- return;
- }
-
- r = sd_rtnl_message_append_u32(req, RTA_OIF, index);
- if (r < 0) {
- log_error_errno(r, "Could not append RTA_OIF attribute: %m");
- return;
- }
-
- assert_se(sd_rtnl_message_rewind(req) >= 0);
-
- assert_se(sd_rtnl_message_read_in_addr(req, RTA_GATEWAY, &addr_data) >= 0);
- assert_se(addr_data.s_addr == addr.s_addr);
-
- assert_se(sd_rtnl_message_read_u32(req, RTA_OIF, &u32_data) >= 0);
- assert_se(u32_data == index);
-
- assert_se((req = sd_rtnl_message_unref(req)) == NULL);
-}
-
-static void test_multiple(void) {
- sd_rtnl *rtnl1, *rtnl2;
-
- assert_se(sd_rtnl_open(&rtnl1, 0) >= 0);
- assert_se(sd_rtnl_open(&rtnl2, 0) >= 0);
-
- rtnl1 = sd_rtnl_unref(rtnl1);
- rtnl2 = sd_rtnl_unref(rtnl2);
-}
-
-static int link_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
- char *ifname = userdata;
- const char *data;
-
- assert_se(rtnl);
- assert_se(m);
-
- log_info("got link info about %s", ifname);
- free(ifname);
-
- assert_se(sd_rtnl_message_read_string(m, IFLA_IFNAME, &data) >= 0);
- assert_se(streq(data, "lo"));
-
- return 1;
-}
-
-static void test_event_loop(int ifindex) {
- _cleanup_event_unref_ sd_event *event = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
- char *ifname;
-
- ifname = strdup("lo2");
- assert_se(ifname);
-
- assert_se(sd_rtnl_open(&rtnl, 0) >= 0);
- assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0);
-
- assert_se(sd_rtnl_call_async(rtnl, m, &link_handler, ifname, 0, NULL) >= 0);
-
- assert_se(sd_event_default(&event) >= 0);
-
- assert_se(sd_rtnl_attach_event(rtnl, event, 0) >= 0);
-
- assert_se(sd_event_run(event, 0) >= 0);
-
- assert_se(sd_rtnl_detach_event(rtnl) >= 0);
-
- assert_se((rtnl = sd_rtnl_unref(rtnl)) == NULL);
-}
-
-static int pipe_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
- int *counter = userdata;
- int r;
-
- (*counter) --;
-
- r = sd_rtnl_message_get_errno(m);
-
- log_info_errno(r, "%d left in pipe. got reply: %m", *counter);
-
- assert_se(r >= 0);
-
- return 1;
-}
-
-static void test_async(int ifindex) {
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL, *r = NULL;
- uint32_t serial;
- char *ifname;
-
- ifname = strdup("lo");
- assert_se(ifname);
-
- assert_se(sd_rtnl_open(&rtnl, 0) >= 0);
-
- assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, ifindex) >= 0);
-
- assert_se(sd_rtnl_call_async(rtnl, m, &link_handler, ifname, 0, &serial) >= 0);
-
- assert_se(sd_rtnl_wait(rtnl, 0) >= 0);
- assert_se(sd_rtnl_process(rtnl, &r) >= 0);
-
- assert_se((rtnl = sd_rtnl_unref(rtnl)) == NULL);
-}
-
-static void test_pipe(int ifindex) {
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m1 = NULL, *m2 = NULL;
- int counter = 0;
-
- assert_se(sd_rtnl_open(&rtnl, 0) >= 0);
-
- assert_se(sd_rtnl_message_new_link(rtnl, &m1, RTM_GETLINK, ifindex) >= 0);
- assert_se(sd_rtnl_message_new_link(rtnl, &m2, RTM_GETLINK, ifindex) >= 0);
-
- counter ++;
- assert_se(sd_rtnl_call_async(rtnl, m1, &pipe_handler, &counter, 0, NULL) >= 0);
-
- counter ++;
- assert_se(sd_rtnl_call_async(rtnl, m2, &pipe_handler, &counter, 0, NULL) >= 0);
-
- while (counter > 0) {
- assert_se(sd_rtnl_wait(rtnl, 0) >= 0);
- assert_se(sd_rtnl_process(rtnl, NULL) >= 0);
- }
-
- assert_se((rtnl = sd_rtnl_unref(rtnl)) == NULL);
-}
-
-static void test_container(void) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
- uint16_t u16_data;
- uint32_t u32_data;
- const char *string_data;
-
- assert_se(sd_rtnl_message_new_link(NULL, &m, RTM_NEWLINK, 0) >= 0);
-
- assert_se(sd_rtnl_message_open_container(m, IFLA_LINKINFO) >= 0);
- assert_se(sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "vlan") >= 0);
- assert_se(sd_rtnl_message_append_u16(m, IFLA_VLAN_ID, 100) >= 0);
- assert_se(sd_rtnl_message_close_container(m) >= 0);
- assert_se(sd_rtnl_message_append_string(m, IFLA_INFO_KIND, "vlan") >= 0);
- assert_se(sd_rtnl_message_close_container(m) >= 0);
- assert_se(sd_rtnl_message_close_container(m) == -EINVAL);
-
- assert_se(sd_rtnl_message_rewind(m) >= 0);
-
- assert_se(sd_rtnl_message_enter_container(m, IFLA_LINKINFO) >= 0);
- assert_se(sd_rtnl_message_read_string(m, IFLA_INFO_KIND, &string_data) >= 0);
- assert_se(streq("vlan", string_data));
-
- assert_se(sd_rtnl_message_enter_container(m, IFLA_INFO_DATA) >= 0);
- assert_se(sd_rtnl_message_read_u16(m, IFLA_VLAN_ID, &u16_data) >= 0);
- assert_se(sd_rtnl_message_exit_container(m) >= 0);
-
- assert_se(sd_rtnl_message_read_string(m, IFLA_INFO_KIND, &string_data) >= 0);
- assert_se(streq("vlan", string_data));
- assert_se(sd_rtnl_message_exit_container(m) >= 0);
-
- assert_se(sd_rtnl_message_read_u32(m, IFLA_LINKINFO, &u32_data) < 0);
-
- assert_se(sd_rtnl_message_exit_container(m) == -EINVAL);
-}
-
-static void test_match(void) {
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
-
- assert_se(sd_rtnl_open(&rtnl, 0) >= 0);
-
- assert_se(sd_rtnl_add_match(rtnl, RTM_NEWLINK, &link_handler, NULL) >= 0);
- assert_se(sd_rtnl_add_match(rtnl, RTM_NEWLINK, &link_handler, NULL) >= 0);
-
- assert_se(sd_rtnl_remove_match(rtnl, RTM_NEWLINK, &link_handler, NULL) == 1);
- assert_se(sd_rtnl_remove_match(rtnl, RTM_NEWLINK, &link_handler, NULL) == 1);
- assert_se(sd_rtnl_remove_match(rtnl, RTM_NEWLINK, &link_handler, NULL) == 0);
-
- assert_se((rtnl = sd_rtnl_unref(rtnl)) == NULL);
-}
-
-static void test_get_addresses(sd_rtnl *rtnl) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *m;
-
- assert_se(sd_rtnl_message_new_addr(rtnl, &req, RTM_GETADDR, 0, AF_UNSPEC) >= 0);
-
- assert_se(sd_rtnl_call(rtnl, req, 0, &reply) >= 0);
-
- for (m = reply; m; m = sd_rtnl_message_next(m)) {
- uint16_t type;
- unsigned char scope, flags;
- int family, ifindex;
-
- assert_se(sd_rtnl_message_get_type(m, &type) >= 0);
- assert_se(type == RTM_NEWADDR);
-
- assert_se(sd_rtnl_message_addr_get_ifindex(m, &ifindex) >= 0);
- assert_se(sd_rtnl_message_addr_get_family(m, &family) >= 0);
- assert_se(sd_rtnl_message_addr_get_scope(m, &scope) >= 0);
- assert_se(sd_rtnl_message_addr_get_flags(m, &flags) >= 0);
-
- assert_se(ifindex > 0);
- assert_se(family == AF_INET || family == AF_INET6);
-
- log_info("got IPv%u address on ifindex %i", family == AF_INET ? 4: 6, ifindex);
- }
-}
-
-static void test_message(void) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
-
- assert_se(rtnl_message_new_synthetic_error(-ETIMEDOUT, 1, &m) >= 0);
- assert_se(sd_rtnl_message_get_errno(m) == -ETIMEDOUT);
-}
-
-int main(void) {
- sd_rtnl *rtnl;
- sd_rtnl_message *m;
- sd_rtnl_message *r;
- const char *string_data;
- int if_loopback;
- uint16_t type;
-
- test_message();
-
- test_match();
-
- test_multiple();
-
- test_route();
-
- test_container();
-
- assert_se(sd_rtnl_open(&rtnl, 0) >= 0);
- assert_se(rtnl);
-
- if_loopback = (int) if_nametoindex("lo");
- assert_se(if_loopback > 0);
-
- test_async(if_loopback);
-
- test_pipe(if_loopback);
-
- test_event_loop(if_loopback);
-
- test_link_configure(rtnl, if_loopback);
-
- test_get_addresses(rtnl);
-
- test_message_link_bridge(rtnl);
-
- assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, if_loopback) >= 0);
- assert_se(m);
-
- assert_se(sd_rtnl_message_get_type(m, &type) >= 0);
- assert_se(type == RTM_GETLINK);
-
- assert_se(sd_rtnl_message_read_string(m, IFLA_IFNAME, &string_data) == -EPERM);
-
- assert_se(sd_rtnl_call(rtnl, m, 0, &r) == 1);
- assert_se(sd_rtnl_message_get_type(r, &type) >= 0);
- assert_se(type == RTM_NEWLINK);
-
- assert_se((r = sd_rtnl_message_unref(r)) == NULL);
-
- assert_se(sd_rtnl_call(rtnl, m, -1, &r) == -EPERM);
- assert_se((m = sd_rtnl_message_unref(m)) == NULL);
- assert_se((r = sd_rtnl_message_unref(r)) == NULL);
-
- test_link_get(rtnl, if_loopback);
- test_address_get(rtnl, if_loopback);
-
- assert_se(sd_rtnl_flush(rtnl) >= 0);
- assert_se((m = sd_rtnl_message_unref(m)) == NULL);
- assert_se((r = sd_rtnl_message_unref(r)) == NULL);
- assert_se((rtnl = sd_rtnl_unref(rtnl)) == NULL);
-
- return EXIT_SUCCESS;
-}
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 8c60339e3e..601839d5dc 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -69,14 +69,27 @@ static void polkit_agent_open_if_enabled(void) {
typedef struct StatusInfo {
char **locale;
- const char *vconsole_keymap;
- const char *vconsole_keymap_toggle;
- const char *x11_layout;
- const char *x11_model;
- const char *x11_variant;
- const char *x11_options;
+ char *vconsole_keymap;
+ char *vconsole_keymap_toggle;
+ char *x11_layout;
+ char *x11_model;
+ char *x11_variant;
+ char *x11_options;
} StatusInfo;
+static void status_info_clear(StatusInfo *info) {
+ if (info) {
+ strv_free(info->locale);
+ free(info->vconsole_keymap);
+ free(info->vconsole_keymap_toggle);
+ free(info->x11_layout);
+ free(info->x11_model);
+ free(info->x11_variant);
+ free(info->x11_options);
+ zero(*info);
+ }
+}
+
static void print_overridden_variables(void) {
int r;
char *variables[_VARIABLE_LC_MAX] = {};
@@ -150,7 +163,7 @@ static void print_status_info(StatusInfo *i) {
}
static int show_status(sd_bus *bus, char **args, unsigned n) {
- StatusInfo info = {};
+ _cleanup_(status_info_clear) StatusInfo info = {};
static const struct bus_properties_map map[] = {
{ "VConsoleKeymap", "s", NULL, offsetof(StatusInfo, vconsole_keymap) },
{ "VConsoleKeymap", "s", NULL, offsetof(StatusInfo, vconsole_keymap) },
@@ -171,16 +184,12 @@ static int show_status(sd_bus *bus, char **args, unsigned n) {
"/org/freedesktop/locale1",
map,
&info);
- if (r < 0) {
- log_error_errno(r, "Could not get properties: %m");
- goto fail;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not get properties: %m");
print_overridden_variables();
print_status_info(&info);
-fail:
- strv_free(info.locale);
return r;
}
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 02d240c704..06208bc4b3 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -277,42 +277,81 @@ static int show_unit_cgroup(sd_bus *bus, const char *interface, const char *unit
}
typedef struct SessionStatusInfo {
- const char *id;
+ char *id;
uid_t uid;
- const char *name;
+ char *name;
struct dual_timestamp timestamp;
unsigned int vtnr;
- const char *seat;
- const char *tty;
- const char *display;
+ char *seat;
+ char *tty;
+ char *display;
bool remote;
- const char *remote_host;
- const char *remote_user;
- const char *service;
+ char *remote_host;
+ char *remote_user;
+ char *service;
pid_t leader;
- const char *type;
- const char *class;
- const char *state;
- const char *scope;
- const char *desktop;
+ char *type;
+ char *class;
+ char *state;
+ char *scope;
+ char *desktop;
} SessionStatusInfo;
typedef struct UserStatusInfo {
uid_t uid;
- const char *name;
+ char *name;
struct dual_timestamp timestamp;
- const char *state;
+ char *state;
char **sessions;
- const char *display;
- const char *slice;
+ char *display;
+ char *slice;
} UserStatusInfo;
typedef struct SeatStatusInfo {
- const char *id;
- const char *active_session;
+ char *id;
+ char *active_session;
char **sessions;
} SeatStatusInfo;
+static void session_status_info_clear(SessionStatusInfo *info) {
+ if (info) {
+ free(info->id);
+ free(info->name);
+ free(info->seat);
+ free(info->tty);
+ free(info->display);
+ free(info->remote_host);
+ free(info->remote_user);
+ free(info->service);
+ free(info->type);
+ free(info->class);
+ free(info->state);
+ free(info->scope);
+ free(info->desktop);
+ zero(*info);
+ }
+}
+
+static void user_status_info_clear(UserStatusInfo *info) {
+ if (info) {
+ free(info->name);
+ free(info->state);
+ strv_free(info->sessions);
+ free(info->display);
+ free(info->slice);
+ zero(*info);
+ }
+}
+
+static void seat_status_info_clear(SeatStatusInfo *info) {
+ if (info) {
+ free(info->id);
+ free(info->active_session);
+ strv_free(info->sessions);
+ zero(*info);
+ }
+}
+
static int prop_map_first_of_struct(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
const char *contents;
int r;
@@ -404,7 +443,7 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char since2[FORMAT_TIMESTAMP_MAX], *s2;
- SessionStatusInfo i = {};
+ _cleanup_(session_status_info_clear) SessionStatusInfo i = {};
int r;
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
@@ -532,14 +571,12 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char since2[FORMAT_TIMESTAMP_MAX], *s2;
- UserStatusInfo i = {};
+ _cleanup_(user_status_info_clear) UserStatusInfo i = {};
int r;
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
- if (r < 0) {
- log_error_errno(r, "Could not get properties: %m");
- goto finish;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not get properties: %m");
if (*new_line)
printf("\n");
@@ -594,10 +631,7 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
NULL);
}
-finish:
- strv_free(i.sessions);
-
- return r;
+ return 0;
}
static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line) {
@@ -609,14 +643,12 @@ static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line)
{}
};
- SeatStatusInfo i = {};
+ _cleanup_(seat_status_info_clear) SeatStatusInfo i = {};
int r;
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
- if (r < 0) {
- log_error_errno(r, "Could not get properties: %m");
- goto finish;
- }
+ if (r < 0)
+ return log_error_errno(r, "Could not get properties: %m");
if (*new_line)
printf("\n");
@@ -653,10 +685,7 @@ static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line)
show_sysfs(i.id, "\t\t ", c);
}
-finish:
- strv_free(i.sessions);
-
- return r;
+ return 0;
}
static int show_properties(sd_bus *bus, const char *path, bool *new_line) {
diff --git a/src/login/logind-session.h b/src/login/logind-session.h
index 7a329b94ad..4bf739a44d 100644
--- a/src/login/logind-session.h
+++ b/src/login/logind-session.h
@@ -26,7 +26,7 @@ typedef enum KillWho KillWho;
#include "list.h"
#include "logind-user.h"
-#include "login-shared.h"
+#include "login-util.h"
typedef enum SessionState {
SESSION_OPENING, /* Session scope is being created */
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index c0b473930d..a9cf529e12 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -763,6 +763,9 @@ static int elect_display_compare(Session *s1, Session *s2) {
* is preferred.
*
* s1 or s2 may be NULL. */
+ if (!s1 && !s2)
+ return 0;
+
if ((s1 == NULL) != (s2 == NULL))
return (s1 == NULL) - (s2 == NULL);
diff --git a/src/login/test-login-shared.c b/src/login/test-login-shared.c
index d29d7e7921..4c4275d124 100644
--- a/src/login/test-login-shared.c
+++ b/src/login/test-login-shared.c
@@ -20,7 +20,7 @@
***/
#include "macro.h"
-#include "login-shared.h"
+#include "login-util.h"
static void test_session_id_valid(void) {
assert_se(session_id_valid("c1"));
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index c86c36c2de..719eb10932 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -500,6 +500,18 @@ typedef struct MachineStatusInfo {
unsigned n_netif;
} MachineStatusInfo;
+static void machine_status_info_clear(MachineStatusInfo *info) {
+ if (info) {
+ free(info->name);
+ free(info->class);
+ free(info->service);
+ free(info->unit);
+ free(info->root_directory);
+ free(info->netif);
+ zero(*info);
+ }
+}
+
static void print_machine_status_info(sd_bus *bus, MachineStatusInfo *i) {
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char since2[FORMAT_TIMESTAMP_MAX], *s2;
@@ -636,7 +648,7 @@ static int show_machine_info(const char *verb, sd_bus *bus, const char *path, bo
{}
};
- MachineStatusInfo info = {};
+ _cleanup_(machine_status_info_clear) MachineStatusInfo info = {};
int r;
assert(verb);
@@ -658,13 +670,6 @@ static int show_machine_info(const char *verb, sd_bus *bus, const char *path, bo
print_machine_status_info(bus, &info);
- free(info.name);
- free(info.class);
- free(info.service);
- free(info.unit);
- free(info.root_directory);
- free(info.netif);
-
return r;
}
@@ -753,6 +758,15 @@ typedef struct ImageStatusInfo {
uint64_t limit_exclusive;
} ImageStatusInfo;
+static void image_status_info_clear(ImageStatusInfo *info) {
+ if (info) {
+ free(info->name);
+ free(info->path);
+ free(info->type);
+ zero(*info);
+ }
+}
+
static void print_image_status_info(sd_bus *bus, ImageStatusInfo *i) {
char ts_relative[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char ts_absolute[FORMAT_TIMESTAMP_MAX], *s2;
@@ -823,7 +837,7 @@ static int show_image_info(sd_bus *bus, const char *path, bool *new_line) {
{}
};
- ImageStatusInfo info = {};
+ _cleanup_(image_status_info_clear) ImageStatusInfo info = {};
int r;
assert(bus);
@@ -844,10 +858,6 @@ static int show_image_info(sd_bus *bus, const char *path, bool *new_line) {
print_image_status_info(bus, &info);
- free(info.name);
- free(info.path);
- free(info.type);
-
return r;
}
@@ -857,6 +867,15 @@ typedef struct PoolStatusInfo {
uint64_t limit;
} PoolStatusInfo;
+static void pool_status_info_clear(PoolStatusInfo *info) {
+ if (info) {
+ free(info->path);
+ zero(*info);
+ info->usage = -1;
+ info->limit = -1;
+ }
+}
+
static void print_pool_status_info(sd_bus *bus, PoolStatusInfo *i) {
char bs[FORMAT_BYTES_MAX], *s;
@@ -881,7 +900,7 @@ static int show_pool_info(sd_bus *bus) {
{}
};
- PoolStatusInfo info = {
+ _cleanup_(pool_status_info_clear) PoolStatusInfo info = {
.usage = (uint64_t) -1,
.limit = (uint64_t) -1,
};
@@ -899,7 +918,6 @@ static int show_pool_info(sd_bus *bus) {
print_pool_status_info(bus, &info);
- free(info.path);
return 0;
}
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 68925debe6..9d6c453dbc 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -24,7 +24,7 @@
#include <net/if.h>
#include "sd-network.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-hwdb.h"
#include "sd-device.h"
@@ -33,7 +33,7 @@
#include "util.h"
#include "pager.h"
#include "lldp.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "device-util.h"
#include "hwdb-util.h"
#include "arphrd-list.h"
@@ -112,19 +112,19 @@ static int link_info_compare(const void *a, const void *b) {
return x->ifindex - y->ifindex;
}
-static int decode_and_sort_links(sd_rtnl_message *m, LinkInfo **ret) {
+static int decode_and_sort_links(sd_netlink_message *m, LinkInfo **ret) {
_cleanup_free_ LinkInfo *links = NULL;
size_t size = 0, c = 0;
- sd_rtnl_message *i;
+ sd_netlink_message *i;
int r;
- for (i = m; i; i = sd_rtnl_message_next(i)) {
+ for (i = m; i; i = sd_netlink_message_next(i)) {
const char *name;
unsigned iftype;
uint16_t type;
int ifindex;
- r = sd_rtnl_message_get_type(i, &type);
+ r = sd_netlink_message_get_type(i, &type);
if (r < 0)
return r;
@@ -135,7 +135,7 @@ static int decode_and_sort_links(sd_rtnl_message *m, LinkInfo **ret) {
if (r < 0)
return r;
- r = sd_rtnl_message_read_string(i, IFLA_IFNAME, &name);
+ r = sd_netlink_message_read_string(i, IFLA_IFNAME, &name);
if (r < 0)
return r;
@@ -192,14 +192,14 @@ static void setup_state_to_color(const char *state, const char **on, const char
}
static int list_links(int argc, char *argv[], void *userdata) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
_cleanup_free_ LinkInfo *links = NULL;
int r, c, i;
pager_open_if_enabled();
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -207,11 +207,11 @@ static int list_links(int argc, char *argv[], void *userdata) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
@@ -287,14 +287,14 @@ static int ieee_oui(sd_hwdb *hwdb, struct ether_addr *mac, char **ret) {
}
static int get_gateway_description(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
sd_hwdb *hwdb,
int ifindex,
int family,
union in_addr_union *gateway,
char **gateway_description) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *m;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *m;
int r;
assert(rtnl);
@@ -307,27 +307,27 @@ static int get_gateway_description(
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (m = reply; m; m = sd_rtnl_message_next(m)) {
+ for (m = reply; m; m = sd_netlink_message_next(m)) {
union in_addr_union gw = {};
struct ether_addr mac = {};
uint16_t type;
int ifi, fam;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0) {
log_error_errno(r, "got error: %m");
continue;
}
- r = sd_rtnl_message_get_type(m, &type);
+ r = sd_netlink_message_get_type(m, &type);
if (r < 0) {
log_error_errno(r, "could not get type: %m");
continue;
@@ -360,13 +360,13 @@ static int get_gateway_description(
switch (fam) {
case AF_INET:
- r = sd_rtnl_message_read_in_addr(m, NDA_DST, &gw.in);
+ r = sd_netlink_message_read_in_addr(m, NDA_DST, &gw.in);
if (r < 0)
continue;
break;
case AF_INET6:
- r = sd_rtnl_message_read_in6_addr(m, NDA_DST, &gw.in6);
+ r = sd_netlink_message_read_in6_addr(m, NDA_DST, &gw.in6);
if (r < 0)
continue;
@@ -378,7 +378,7 @@ static int get_gateway_description(
if (!in_addr_equal(fam, &gw, gateway))
continue;
- r = sd_rtnl_message_read_ether_addr(m, NDA_LLADDR, &mac);
+ r = sd_netlink_message_read_ether_addr(m, NDA_LLADDR, &mac);
if (r < 0)
continue;
@@ -393,7 +393,7 @@ static int get_gateway_description(
}
static int dump_gateways(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
sd_hwdb *hwdb,
const char *prefix,
int ifindex) {
@@ -442,7 +442,7 @@ static int dump_gateways(
}
static int dump_addresses(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
const char *prefix,
int ifindex) {
@@ -493,12 +493,12 @@ static void dump_list(const char *prefix, char **l) {
}
static int link_status_one(
- sd_rtnl *rtnl,
+ sd_netlink *rtnl,
sd_hwdb *hwdb,
const char *name) {
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **domains = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL;
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
_cleanup_device_unref_ sd_device *d = NULL;
char devid[2 + DECIMAL_STR_MAX(int)];
_cleanup_free_ char *t = NULL, *network = NULL;
@@ -523,13 +523,13 @@ static int link_status_one(
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_append_string(req, IFLA_IFNAME, name);
+ r = sd_netlink_message_append_string(req, IFLA_IFNAME, name);
}
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to query link: %m");
@@ -537,7 +537,7 @@ static int link_status_one(
if (r < 0)
return rtnl_log_parse_error(r);
- r = sd_rtnl_message_read_string(reply, IFLA_IFNAME, &name);
+ r = sd_netlink_message_read_string(reply, IFLA_IFNAME, &name);
if (r < 0)
return rtnl_log_parse_error(r);
@@ -545,7 +545,7 @@ static int link_status_one(
if (r < 0)
return rtnl_log_parse_error(r);
- have_mac = sd_rtnl_message_read_ether_addr(reply, IFLA_ADDRESS, &e) >= 0;
+ have_mac = sd_netlink_message_read_ether_addr(reply, IFLA_ADDRESS, &e) >= 0;
if (have_mac) {
const uint8_t *p;
@@ -561,7 +561,7 @@ static int link_status_one(
have_mac = false;
}
- sd_rtnl_message_read_u32(reply, IFLA_MTU, &mtu);
+ sd_netlink_message_read_u32(reply, IFLA_MTU, &mtu);
sd_network_link_get_operational_state(ifindex, &operational_state);
operational_state_to_color(operational_state, &on_color_operational, &off_color_operational);
@@ -666,11 +666,11 @@ static int link_status_one(
static int link_status(int argc, char *argv[], void *userdata) {
_cleanup_hwdb_unref_ sd_hwdb *hwdb = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
char **name;
int r;
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -711,7 +711,7 @@ static int link_status(int argc, char *argv[], void *userdata) {
pager_open_if_enabled();
if (arg_all) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
_cleanup_free_ LinkInfo *links = NULL;
int c, i;
@@ -719,11 +719,11 @@ static int link_status(int argc, char *argv[], void *userdata) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
@@ -897,8 +897,8 @@ static char *lldp_system_caps(uint16_t cap) {
}
static int link_lldp_status(int argc, char *argv[], void *userdata) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
_cleanup_free_ LinkInfo *links = NULL;
const char *state, *word;
@@ -910,7 +910,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
pager_open_if_enabled();
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -918,11 +918,11 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_call(rtnl, req, 0, &reply);
+ r = sd_netlink_call(rtnl, req, 0, &reply);
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 069ba3eccb..172ca43a7d 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -24,7 +24,7 @@
#include "utf8.h"
#include "util.h"
#include "conf-parser.h"
-#include "fw-util.h"
+#include "firewall-util.h"
#include "networkd.h"
#include "networkd-link.h"
@@ -151,8 +151,8 @@ int address_release(Address *address, Link *link) {
}
int address_drop(Address *address, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(address);
@@ -174,13 +174,13 @@ int address_drop(Address *address, Link *link,
return log_error_errno(r, "Could not set prefixlen: %m");
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
else if (address->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -190,8 +190,8 @@ int address_drop(Address *address, Link *link,
}
int address_update(Address *address, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(address);
@@ -216,7 +216,7 @@ int address_update(Address *address, Link *link,
return log_error_errno(r, "Could not set flags: %m");
if (address->flags & ~0xff && link->rtnl_extended_attrs) {
- r = sd_rtnl_message_append_u32(req, IFA_FLAGS, address->flags);
+ r = sd_netlink_message_append_u32(req, IFA_FLAGS, address->flags);
if (r < 0)
return log_error_errno(r, "Could not set extended flags: %m");
}
@@ -226,29 +226,29 @@ int address_update(Address *address, Link *link,
return log_error_errno(r, "Could not set scope: %m");
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
else if (address->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
if (address->family == AF_INET) {
- r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
+ r = sd_netlink_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
if (r < 0)
return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
}
if (address->label) {
- r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
+ r = sd_netlink_message_append_string(req, IFA_LABEL, address->label);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
}
- r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo);
+ r = sd_netlink_message_append_cache_info(req, IFA_CACHEINFO, &address->cinfo);
if (r < 0)
return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -317,8 +317,8 @@ static int address_acquire(Link *link, Address *original, Address **ret) {
}
int address_configure(Address *address, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(address);
@@ -348,7 +348,7 @@ int address_configure(Address *address, Link *link,
return log_error_errno(r, "Could not set flags: %m");
if (address->flags & ~0xff) {
- r = sd_rtnl_message_append_u32(req, IFA_FLAGS, address->flags);
+ r = sd_netlink_message_append_u32(req, IFA_FLAGS, address->flags);
if (r < 0)
return log_error_errno(r, "Could not set extended flags: %m");
}
@@ -358,39 +358,39 @@ int address_configure(Address *address, Link *link,
return log_error_errno(r, "Could not set scope: %m");
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_message_append_in_addr(req, IFA_LOCAL, &address->in_addr.in);
else if (address->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, IFA_LOCAL, &address->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LOCAL attribute: %m");
if (!in_addr_is_null(address->family, &address->in_addr_peer)) {
if (address->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
+ r = sd_netlink_message_append_in_addr(req, IFA_ADDRESS, &address->in_addr_peer.in);
else if (address->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
+ r = sd_netlink_message_append_in6_addr(req, IFA_ADDRESS, &address->in_addr_peer.in6);
if (r < 0)
return log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
} else {
if (address->family == AF_INET) {
- r = sd_rtnl_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
+ r = sd_netlink_message_append_in_addr(req, IFA_BROADCAST, &address->broadcast);
if (r < 0)
return log_error_errno(r, "Could not append IFA_BROADCAST attribute: %m");
}
}
if (address->label) {
- r = sd_rtnl_message_append_string(req, IFA_LABEL, address->label);
+ r = sd_netlink_message_append_string(req, IFA_LABEL, address->label);
if (r < 0)
return log_error_errno(r, "Could not append IFA_LABEL attribute: %m");
}
- r = sd_rtnl_message_append_cache_info(req, IFA_CACHEINFO,
+ r = sd_netlink_message_append_cache_info(req, IFA_CACHEINFO,
&address->cinfo);
if (r < 0)
return log_error_errno(r, "Could not append IFA_CACHEINFO attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 71cc722bcc..d446bfa8b3 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -27,7 +27,7 @@
#include "network-internal.h"
#include "dhcp-lease-internal.h"
-static int dhcp4_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int dhcp4_route_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -37,7 +37,7 @@ static int dhcp4_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
link->dhcp4_messages --;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set DHCPv4 route: %s",
strerror(-r));
@@ -285,14 +285,14 @@ static int dhcp_lease_lost(Link *link) {
return 0;
}
-static int dhcp4_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set DHCPv4 address: %s",
strerror(-r));
diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
index 33e18137d2..3a5ac1c39b 100644
--- a/src/network/networkd-dhcp6.c
+++ b/src/network/networkd-dhcp6.c
@@ -35,14 +35,14 @@ static int dhcp6_lease_information_acquired(sd_dhcp6_client *client,
return 0;
}
-static int dhcp6_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int dhcp6_address_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
if (link->rtnl_extended_attrs) {
log_link_warning(link, "Could not set extended netlink attributes, reverting to fallback mechanism");
diff --git a/src/network/networkd-fdb.c b/src/network/networkd-fdb.c
index 796d1117b6..0f2510e904 100644
--- a/src/network/networkd-fdb.c
+++ b/src/network/networkd-fdb.c
@@ -80,13 +80,13 @@ int fdb_entry_new_static(Network *const network,
return 0;
}
-static int set_fdb_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int set_fdb_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
Link *link = userdata;
int r;
assert(link);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
log_link_error_errno(link, r, "Could not add FDB entry: %m");
@@ -95,8 +95,8 @@ static int set_fdb_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
/* send a request to the kernel to add a FDB entry in its static MAC table. */
int fdb_entry_configure(Link *const link, FdbEntry *const fdb_entry) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
- sd_rtnl *rtnl;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
+ sd_netlink *rtnl;
int r;
assert(link);
@@ -120,19 +120,19 @@ int fdb_entry_configure(Link *const link, FdbEntry *const fdb_entry) {
if (r < 0)
return rtnl_log_create_error(r);
- r = sd_rtnl_message_append_ether_addr(req, NDA_LLADDR, fdb_entry->mac_addr);
+ r = sd_netlink_message_append_ether_addr(req, NDA_LLADDR, fdb_entry->mac_addr);
if (r < 0)
return rtnl_log_create_error(r);
/* VLAN Id is optional. We'll add VLAN Id only if it's specified. */
if (0 != fdb_entry->vlan_id) {
- r = sd_rtnl_message_append_u16(req, NDA_VLAN, fdb_entry->vlan_id);
+ r = sd_netlink_message_append_u16(req, NDA_VLAN, fdb_entry->vlan_id);
if (r < 0)
return rtnl_log_create_error(r);
}
/* send message to the kernel to update its internal static MAC table. */
- r = sd_rtnl_call_async(rtnl, req, set_fdb_handler, link, 0, NULL);
+ r = sd_netlink_call_async(rtnl, req, set_fdb_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index 14b8770429..0a27a30278 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -73,14 +73,14 @@ static int ipv4ll_address_lost(Link *link) {
return 0;
}
-static int ipv4ll_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int ipv4ll_route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
assert(!link->ipv4ll_route);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set ipv4ll route: %s", strerror(-r));
link_enter_failed(link);
@@ -94,14 +94,14 @@ static int ipv4ll_route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdat
return 1;
}
-static int ipv4ll_address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int ipv4ll_address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
assert(link);
assert(!link->ipv4ll_address);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error(link, "could not set ipv4ll address: %s", strerror(-r));
link_enter_failed(link);
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 7841f69dab..16243a5352 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -121,7 +121,7 @@ static bool link_ipv6_forward_enabled(Link *link) {
? ((old & flag) ? (" -" string) : (" +" string)) \
: "")
-static int link_update_flags(Link *link, sd_rtnl_message *m) {
+static int link_update_flags(Link *link, sd_netlink_message *m) {
unsigned flags, unknown_flags_added, unknown_flags_removed, unknown_flags;
uint8_t operstate;
int r;
@@ -132,7 +132,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) {
if (r < 0)
return log_link_warning_errno(link, r, "Could not get link flags: %m");
- r = sd_rtnl_message_read_u8(m, IFLA_OPERSTATE, &operstate);
+ r = sd_netlink_message_read_u8(m, IFLA_OPERSTATE, &operstate);
if (r < 0)
/* if we got a message without operstate, take it to mean
the state was unchanged */
@@ -193,7 +193,7 @@ static int link_update_flags(Link *link, sd_rtnl_message *m) {
return 0;
}
-static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
+static int link_new(Manager *manager, sd_netlink_message *message, Link **ret) {
_cleanup_link_unref_ Link *link = NULL;
uint16_t type;
const char *ifname;
@@ -203,7 +203,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
assert(message);
assert(ret);
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0)
return r;
else if (type != RTM_NEWLINK)
@@ -215,7 +215,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
else if (ifindex <= 0)
return -EINVAL;
- r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(message, IFLA_IFNAME, &ifname);
if (r < 0)
return r;
@@ -232,7 +232,7 @@ static int link_new(Manager *manager, sd_rtnl_message *message, Link **ret) {
if (!link->ifname)
return -ENOMEM;
- r = sd_rtnl_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
+ r = sd_netlink_message_read_ether_addr(message, IFLA_ADDRESS, &link->mac);
if (r < 0)
log_link_debug(link, "MAC address not found for new device, continuing without");
@@ -497,7 +497,7 @@ void link_client_handler(Link *link) {
return;
}
-static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int route_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -511,7 +511,7 @@ static int route_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
log_link_warning_errno(link, r, "%-*s: could not set route: %m", IFNAMSIZ, link->ifname);
@@ -554,7 +554,7 @@ static int link_enter_set_routes(Link *link) {
return 0;
}
-int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+int link_route_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -565,14 +565,14 @@ int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -ESRCH)
log_link_warning_errno(link, r, "%-*s: could not drop route: %m", IFNAMSIZ, link->ifname);
return 1;
}
-static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int address_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -589,7 +589,7 @@ static int address_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST)
log_link_warning_errno(link, r, "%-*s: could not set address: %m", IFNAMSIZ, link->ifname);
else if (r >= 0)
@@ -682,7 +682,7 @@ static int link_enter_set_addresses(Link *link) {
return 0;
}
-int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+int link_address_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -693,7 +693,7 @@ int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EADDRNOTAVAIL)
log_link_warning_errno(link, r, "%-*s: could not drop address: %m", IFNAMSIZ, link->ifname);
@@ -715,13 +715,13 @@ static int link_set_bridge_fdb(Link *const link) {
return r;
}
-static int link_set_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
log_link_debug(link, "Set link");
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error_errno(link, r, "Could not join netdev: %m");
link_enter_failed(link);
@@ -784,7 +784,7 @@ int link_set_hostname(Link *link, const char *hostname) {
return 0;
}
-static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int set_mtu_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -795,7 +795,7 @@ static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
log_link_warning_errno(link, r, "%-*s: could not set MTU: %m", IFNAMSIZ, link->ifname);
@@ -803,7 +803,7 @@ static int set_mtu_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
}
int link_set_mtu(Link *link, uint32_t mtu) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -816,11 +816,11 @@ int link_set_mtu(Link *link, uint32_t mtu) {
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
- r = sd_rtnl_message_append_u32(req, IFLA_MTU, mtu);
+ r = sd_netlink_message_append_u32(req, IFLA_MTU, mtu);
if (r < 0)
return log_link_error_errno(link, r, "Could not append MTU: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, set_mtu_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, set_mtu_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -830,7 +830,7 @@ int link_set_mtu(Link *link, uint32_t mtu) {
}
static int link_set_bridge(Link *link) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -847,21 +847,21 @@ static int link_set_bridge(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not set message family: %m");
- r = sd_rtnl_message_open_container(req, IFLA_PROTINFO);
+ r = sd_netlink_message_open_container(req, IFLA_PROTINFO);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_PROTINFO attribute: %m");
if(link->network->cost != 0) {
- r = sd_rtnl_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost);
+ r = sd_netlink_message_append_u32(req, IFLA_BRPORT_COST, link->network->cost);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_BRPORT_COST attribute: %m");
}
- r = sd_rtnl_message_close_container(req);
+ r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_LINKINFO attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, link_set_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, link_set_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -952,7 +952,7 @@ bool link_has_carrier(Link *link) {
return false;
}
-static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -961,7 +961,7 @@ static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
/* we warn but don't fail the link, as it may be
brought up later */
@@ -971,7 +971,7 @@ static int link_up_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
}
static int link_up(Link *link) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
uint8_t ipv6ll_mode;
int r;
@@ -991,48 +991,48 @@ static int link_up(Link *link) {
return log_link_error_errno(link, r, "Could not set link flags: %m");
if (link->network->mac) {
- r = sd_rtnl_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
+ r = sd_netlink_message_append_ether_addr(req, IFLA_ADDRESS, link->network->mac);
if (r < 0)
return log_link_error_errno(link, r, "Could not set MAC address: %m");
}
if (link->network->mtu) {
- r = sd_rtnl_message_append_u32(req, IFLA_MTU, link->network->mtu);
+ r = sd_netlink_message_append_u32(req, IFLA_MTU, link->network->mtu);
if (r < 0)
return log_link_error_errno(link, r, "Could not set MTU: %m");
}
- r = sd_rtnl_message_open_container(req, IFLA_AF_SPEC);
+ r = sd_netlink_message_open_container(req, IFLA_AF_SPEC);
if (r < 0)
return log_link_error_errno(link, r, "Could not open IFLA_AF_SPEC container: %m");
if (socket_ipv6_is_supported()) {
/* if the kernel lacks ipv6 support setting IFF_UP fails if any ipv6 options are passed */
- r = sd_rtnl_message_open_container(req, AF_INET6);
+ r = sd_netlink_message_open_container(req, AF_INET6);
if (r < 0)
return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m");
ipv6ll_mode = link_ipv6ll_enabled(link) ? IN6_ADDR_GEN_MODE_EUI64 : IN6_ADDR_GEN_MODE_NONE;
- r = sd_rtnl_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
+ r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m");
if (!in_addr_is_null(AF_INET6, &link->network->ipv6_token)) {
- r = sd_rtnl_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
+ r = sd_netlink_message_append_in6_addr(req, IFLA_INET6_TOKEN, &link->network->ipv6_token.in6);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_INET6_TOKEN: %m");
}
- r = sd_rtnl_message_close_container(req);
+ r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not close AF_INET6 container: %m");
}
- r = sd_rtnl_message_close_container(req);
+ r = sd_netlink_message_close_container(req);
if (r < 0)
return log_link_error_errno(link, r, "Could not close IFLA_AF_SPEC container: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, link_up_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -1041,7 +1041,7 @@ static int link_up(Link *link) {
return 0;
}
-static int link_down_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int link_down_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -1050,7 +1050,7 @@ static int link_down_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0)
log_link_warning_errno(link, r, "%-*s: could not bring down interface: %m", IFNAMSIZ, link->ifname);
@@ -1058,7 +1058,7 @@ static int link_down_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
}
static int link_down(Link *link) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -1076,7 +1076,7 @@ static int link_down(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not set link flags: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, link_down_handler, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, link_down_handler, link, 0, NULL);
if (r < 0)
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
@@ -1360,7 +1360,7 @@ static int link_joined(Link *link) {
return link_enter_set_addresses(link);
}
-static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int netdev_join_handler(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
int r;
@@ -1373,7 +1373,7 @@ static int netdev_join_handler(sd_rtnl *rtnl, sd_rtnl_message *m,
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 1;
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r < 0 && r != -EEXIST) {
log_link_error_errno(link, r, "%-*s: could not join netdev: %m", IFNAMSIZ, link->ifname);
link_enter_failed(link);
@@ -1477,6 +1477,9 @@ static int link_set_ipv4_forward(Link *link) {
const char *p = NULL;
int r;
+ if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
+ return 0;
+
p = strjoina("/proc/sys/net/ipv4/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv4_forward_enabled(link)));
if (r < 0)
@@ -1493,6 +1496,9 @@ static int link_set_ipv6_forward(Link *link) {
if (!socket_ipv6_is_supported())
return 0;
+ if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
+ return 0;
+
p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv6_forward_enabled(link)));
if (r < 0)
@@ -1572,7 +1578,7 @@ static int link_configure(Link *link) {
return link_enter_join_netdev(link);
}
-static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
+static int link_initialized_and_synced(sd_netlink *rtnl, sd_netlink_message *m,
void *userdata) {
_cleanup_link_unref_ Link *link = userdata;
Network *network;
@@ -1630,7 +1636,7 @@ static int link_initialized_and_synced(sd_rtnl *rtnl, sd_rtnl_message *m,
}
int link_initialized(Link *link, struct udev_device *device) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -1658,7 +1664,7 @@ int link_initialized(Link *link, struct udev_device *device) {
if (r < 0)
return r;
- r = sd_rtnl_call_async(link->manager->rtnl, req,
+ r = sd_netlink_call_async(link->manager->rtnl, req,
link_initialized_and_synced, link, 0, NULL);
if (r < 0)
return r;
@@ -1681,7 +1687,7 @@ static Address* link_get_equal_address(Link *link, Address *needle) {
return NULL;
}
-int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata) {
+int link_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message, void *userdata) {
Manager *m = userdata;
Link *link = NULL;
uint16_t type;
@@ -1696,15 +1702,15 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
assert(message);
assert(m);
- if (sd_rtnl_message_is_error(message)) {
- r = sd_rtnl_message_get_errno(message);
+ if (sd_netlink_message_is_error(message)) {
+ r = sd_netlink_message_get_errno(message);
if (r < 0)
log_warning_errno(r, "rtnl: failed to receive address: %m");
return 0;
}
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0) {
log_warning_errno(r, "rtnl: could not get message type: %m");
return 0;
@@ -1762,7 +1768,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
switch (address->family) {
case AF_INET:
- r = sd_rtnl_message_read_in_addr(message, IFA_LOCAL, &address->in_addr.in);
+ r = sd_netlink_message_read_in_addr(message, IFA_LOCAL, &address->in_addr.in);
if (r < 0) {
log_link_warning_errno(link, r, "rtnl: received address without valid address, ignoring: %m");
return 0;
@@ -1771,7 +1777,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
break;
case AF_INET6:
- r = sd_rtnl_message_read_in6_addr(message, IFA_ADDRESS, &address->in_addr.in6);
+ r = sd_netlink_message_read_in6_addr(message, IFA_ADDRESS, &address->in_addr.in6);
if (r < 0) {
log_link_warning_errno(link, r, "rtnl: received address without valid address, ignoring: %m");
return 0;
@@ -1788,7 +1794,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
return 0;
}
- r = sd_rtnl_message_read_cache_info(message, IFA_CACHEINFO, &address->cinfo);
+ r = sd_netlink_message_read_cache_info(message, IFA_CACHEINFO, &address->cinfo);
if (r >= 0) {
if (address->cinfo.ifa_valid == CACHE_INFO_INFINITY_LIFE_TIME)
valid_str = "ever";
@@ -1841,7 +1847,7 @@ int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *use
return 1;
}
-int link_add(Manager *m, sd_rtnl_message *message, Link **ret) {
+int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
Link *link;
_cleanup_udev_device_unref_ struct udev_device *device = NULL;
char ifindex_str[2 + DECIMAL_STR_MAX(int)];
@@ -1947,7 +1953,7 @@ int link_carrier_reset(Link *link) {
}
-int link_update(Link *link, sd_rtnl_message *m) {
+int link_update(Link *link, sd_netlink_message *m) {
struct ether_addr mac;
const char *ifname;
uint32_t mtu;
@@ -1968,7 +1974,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(m, IFLA_IFNAME, &ifname);
if (r >= 0 && !streq(ifname, link->ifname)) {
log_link_info(link, "Renamed to %s", ifname);
@@ -1984,7 +1990,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
return r;
}
- r = sd_rtnl_message_read_u32(m, IFLA_MTU, &mtu);
+ r = sd_netlink_message_read_u32(m, IFLA_MTU, &mtu);
if (r >= 0 && mtu > 0) {
link->mtu = mtu;
if (!link->original_mtu) {
@@ -2004,7 +2010,7 @@ int link_update(Link *link, sd_rtnl_message *m) {
/* The kernel may broadcast NEWLINK messages without the MAC address
set, simply ignore them. */
- r = sd_rtnl_message_read_ether_addr(m, IFLA_ADDRESS, &mac);
+ r = sd_netlink_message_read_ether_addr(m, IFLA_ADDRESS, &mac);
if (r >= 0) {
if (memcmp(link->mac.ether_addr_octet, mac.ether_addr_octet,
ETH_ALEN)) {
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index c599952c45..2dcbbda607 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -94,19 +94,19 @@ struct Link {
Link *link_unref(Link *link);
Link *link_ref(Link *link);
int link_get(Manager *m, int ifindex, Link **ret);
-int link_add(Manager *manager, sd_rtnl_message *message, Link **ret);
+int link_add(Manager *manager, sd_netlink_message *message, Link **ret);
void link_drop(Link *link);
-int link_address_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata);
-int link_route_drop_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata);
+int link_address_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
+int link_route_drop_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
void link_enter_failed(Link *link);
int link_initialized(Link *link, struct udev_device *device);
void link_client_handler(Link *link);
-int link_update(Link *link, sd_rtnl_message *message);
-int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata);
+int link_update(Link *link, sd_netlink_message *message);
+int link_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message, void *userdata);
int link_save(Link *link);
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index db737ad484..a5c2351cf9 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -29,12 +29,12 @@
#include "networkd-link.h"
#include "libudev-private.h"
#include "udev-util.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "bus-util.h"
#include "def.h"
#include "virt.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-daemon.h"
/* use 8 MB for receive socket kernel queue. */
@@ -274,7 +274,7 @@ static int manager_connect_udev(Manager *m) {
return 0;
}
-static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata) {
+static int manager_rtnl_process_link(sd_netlink *rtnl, sd_netlink_message *message, void *userdata) {
Manager *m = userdata;
Link *link = NULL;
NetDev *netdev = NULL;
@@ -286,15 +286,15 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
assert(message);
assert(m);
- if (sd_rtnl_message_is_error(message)) {
- r = sd_rtnl_message_get_errno(message);
+ if (sd_netlink_message_is_error(message)) {
+ r = sd_netlink_message_get_errno(message);
if (r < 0)
log_warning_errno(r, "rtnl: could not receive link: %m");
return 0;
}
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0) {
log_warning_errno(r, "rtnl: could not get message type: %m");
return 0;
@@ -313,7 +313,7 @@ static int manager_rtnl_process_link(sd_rtnl *rtnl, sd_rtnl_message *message, vo
} else
link_get(m, ifindex, &link);
- r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &name);
+ r = sd_netlink_message_read_string(message, IFLA_IFNAME, &name);
if (r < 0) {
log_warning_errno(r, "rtnl: received link message without ifname: %m");
return 0;
@@ -385,33 +385,33 @@ static int manager_connect_rtnl(Manager *m) {
fd = systemd_netlink_fd();
if (fd < 0)
- r = sd_rtnl_open(&m->rtnl, 3, RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR, RTNLGRP_IPV6_IFADDR);
+ r = sd_netlink_open(&m->rtnl);
else
- r = sd_rtnl_open_fd(&m->rtnl, fd, 0);
+ r = sd_netlink_open_fd(&m->rtnl, fd);
if (r < 0)
return r;
- r = sd_rtnl_inc_rcvbuf(m->rtnl, RCVBUF_SIZE);
+ r = sd_netlink_inc_rcvbuf(m->rtnl, RCVBUF_SIZE);
if (r < 0)
return r;
- r = sd_rtnl_attach_event(m->rtnl, m->event, 0);
+ r = sd_netlink_attach_event(m->rtnl, m->event, 0);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWLINK, &manager_rtnl_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWLINK, &manager_rtnl_process_link, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELLINK, &manager_rtnl_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELLINK, &manager_rtnl_process_link, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWADDR, &link_rtnl_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWADDR, &link_rtnl_process_address, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELADDR, &link_rtnl_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELADDR, &link_rtnl_process_address, m);
if (r < 0)
return r;
@@ -498,7 +498,7 @@ void manager_free(Manager *m) {
while ((pool = m->address_pools))
address_pool_free(pool);
- sd_rtnl_unref(m->rtnl);
+ sd_netlink_unref(m->rtnl);
free(m);
}
@@ -570,8 +570,8 @@ bool manager_should_reload(Manager *m) {
}
int manager_rtnl_enumerate_links(Manager *m) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *link;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *link;
int r;
assert(m);
@@ -581,15 +581,15 @@ int manager_rtnl_enumerate_links(Manager *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (link = reply; link; link = sd_rtnl_message_next(link)) {
+ for (link = reply; link; link = sd_netlink_message_next(link)) {
int k;
m->enumerating = true;
@@ -605,8 +605,8 @@ int manager_rtnl_enumerate_links(Manager *m) {
}
int manager_rtnl_enumerate_addresses(Manager *m) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *addr;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *addr;
int r;
assert(m);
@@ -616,15 +616,15 @@ int manager_rtnl_enumerate_addresses(Manager *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (addr = reply; addr; addr = sd_rtnl_message_next(addr)) {
+ for (addr = reply; addr; addr = sd_netlink_message_next(addr)) {
int k;
m->enumerating = true;
diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c
index 9919955f51..6336ff58a7 100644
--- a/src/network/networkd-netdev-bond.c
+++ b/src/network/networkd-netdev-bond.c
@@ -24,8 +24,8 @@
#include <linux/if_bonding.h>
#include "conf-parser.h"
-#include "sd-rtnl.h"
-#include "rtnl-types.h"
+#include "sd-netlink.h"
+#include "netlink-types.h"
#include "networkd-netdev-bond.h"
#include "missing.h"
@@ -178,7 +178,7 @@ static uint8_t bond_xmit_hash_policy_to_kernel(BondXmitHashPolicy policy) {
}
}
-static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Bond *b = BOND(netdev);
ArpIpTarget *target = NULL;
int r, i = 0;
@@ -189,14 +189,14 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(m);
if (b->mode != _NETDEV_BOND_MODE_INVALID) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_MODE,
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_MODE,
bond_mode_to_kernel(b->mode));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_MODE attribute: %m");
}
if (b->xmit_hash_policy != _NETDEV_BOND_XMIT_HASH_POLICY_INVALID) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY,
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY,
bond_xmit_hash_policy_to_kernel(b->xmit_hash_policy));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_XMIT_HASH_POLICY attribute: %m");
@@ -204,117 +204,118 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
if (b->lacp_rate != _NETDEV_BOND_LACP_RATE_INVALID &&
b->mode == NETDEV_BOND_MODE_802_3AD) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate );
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate );
if (r < 0) {
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_LACP_RATE attribute: %m");
}
}
if (b->miimon != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / USEC_PER_MSEC);
if (r < 0)
log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_BOND_MIIMON attribute: %m");
}
if (b->downdelay != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / USEC_PER_MSEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_DOWNDELAY attribute: %m");
}
if (b->updelay != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / USEC_PER_MSEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_UPDELAY attribute: %m");
}
if (b->arp_interval != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_INTERVAL, b->arp_interval / USEC_PER_MSEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_INTERVAL, b->arp_interval / USEC_PER_MSEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_INTERVAL attribute: %m");
if ((b->lp_interval >= LEARNING_PACKETS_INTERVAL_MIN_SEC) &&
(b->lp_interval <= LEARNING_PACKETS_INTERVAL_MAX_SEC)) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_LP_INTERVAL, b->lp_interval / USEC_PER_SEC);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_LP_INTERVAL, b->lp_interval / USEC_PER_SEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_LP_INTERVAL attribute: %m");
}
}
if (b->ad_select != _NETDEV_BOND_AD_SELECT_INVALID &&
- b->mode == BOND_MODE_8023AD) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_AD_SELECT, b->ad_select);
+ b->mode == NETDEV_BOND_MODE_802_3AD) {
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_SELECT, b->ad_select);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_SELECT attribute: %m");
}
if (b->fail_over_mac != _NETDEV_BOND_FAIL_OVER_MAC_INVALID &&
b->mode == NETDEV_BOND_MODE_ACTIVE_BACKUP) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_FAIL_OVER_MAC, b->fail_over_mac);
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_FAIL_OVER_MAC, b->fail_over_mac);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_FAIL_OVER_MAC attribute: %m");
}
if (b->arp_validate != _NETDEV_BOND_ARP_VALIDATE_INVALID) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_VALIDATE, b->arp_validate);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_VALIDATE, b->arp_validate);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_VALIDATE attribute: %m");
}
if (b->arp_all_targets != _NETDEV_BOND_ARP_ALL_TARGETS_INVALID) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->arp_all_targets);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->arp_all_targets);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_VALIDATE attribute: %m");
}
if (b->primary_reselect != _NETDEV_BOND_PRIMARY_RESELECT_INVALID) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->primary_reselect);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_ARP_ALL_TARGETS, b->primary_reselect);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
}
if (b->resend_igmp <= RESEND_IGMP_MAX) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_RESEND_IGMP, b->resend_igmp);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_RESEND_IGMP, b->resend_igmp);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_RESEND_IGMP attribute: %m");
}
- if (b->packets_per_slave <= PACKETS_PER_SLAVE_MAX) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_PACKETS_PER_SLAVE, b->packets_per_slave);
+ if (b->packets_per_slave <= PACKETS_PER_SLAVE_MAX &&
+ b->mode == NETDEV_BOND_MODE_BALANCE_RR) {
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_PACKETS_PER_SLAVE, b->packets_per_slave);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_PACKETS_PER_SLAVE attribute: %m");
}
if (b->num_grat_arp <= GRATUITOUS_ARP_MAX) {
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_NUM_PEER_NOTIF, b->num_grat_arp);
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_NUM_PEER_NOTIF, b->num_grat_arp);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_NUM_PEER_NOTIF attribute: %m");
}
if (b->min_links != 0) {
- r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIN_LINKS, b->min_links);
+ r = sd_netlink_message_append_u32(m, IFLA_BOND_MIN_LINKS, b->min_links);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_MIN_LINKS attribute: %m");
}
- r = sd_rtnl_message_append_u8(m, IFLA_BOND_ALL_SLAVES_ACTIVE, b->all_slaves_active);
+ r = sd_netlink_message_append_u8(m, IFLA_BOND_ALL_SLAVES_ACTIVE, b->all_slaves_active);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ALL_SLAVES_ACTIVE attribute: %m");
if (b->arp_interval > 0) {
if (b->n_arp_ip_targets > 0) {
- r = sd_rtnl_message_open_container(m, IFLA_BOND_ARP_IP_TARGET);
+ r = sd_netlink_message_open_container(m, IFLA_BOND_ARP_IP_TARGET);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not open contaniner IFLA_BOND_ARP_IP_TARGET : %m");
LIST_FOREACH(arp_ip_target, target, b->arp_ip_targets) {
- r = sd_rtnl_message_append_u32(m, i++, target->ip.in.s_addr);
+ r = sd_netlink_message_append_u32(m, i++, target->ip.in.s_addr);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
}
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not close contaniner IFLA_BOND_ARP_IP_TARGET : %m");
}
diff --git a/src/network/networkd-netdev-ipvlan.c b/src/network/networkd-netdev-ipvlan.c
index 5189000c1f..5eb4a1eb36 100644
--- a/src/network/networkd-netdev-ipvlan.c
+++ b/src/network/networkd-netdev-ipvlan.c
@@ -32,7 +32,7 @@ static const char* const ipvlan_mode_table[_NETDEV_IPVLAN_MODE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(ipvlan_mode, IPVlanMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_ipvlan_mode, ipvlan_mode, IPVlanMode, "Failed to parse ipvlan mode");
-static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
+static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
IPVlan *m = IPVLAN(netdev);
int r;
@@ -42,13 +42,9 @@ static int netdev_ipvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
assert(netdev->ifname);
if (m->mode != _NETDEV_IPVLAN_MODE_INVALID) {
- r = sd_rtnl_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_IPVLAN_MODE attribute: %s",
- strerror(-r));
- return r;
- }
+ r = sd_netlink_message_append_u16(req, IFLA_IPVLAN_MODE, m->mode);
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPVLAN_MODE attribute: %m");
}
return 0;
diff --git a/src/network/networkd-netdev-macvlan.c b/src/network/networkd-netdev-macvlan.c
index 5f41f1c865..c2c564935c 100644
--- a/src/network/networkd-netdev-macvlan.c
+++ b/src/network/networkd-netdev-macvlan.c
@@ -34,7 +34,7 @@ static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(macvlan_mode, MacVlanMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, "Failed to parse macvlan mode");
-static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
+static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
MacVlan *m = MACVLAN(netdev);
int r;
@@ -44,13 +44,9 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_rtn
assert(netdev->ifname);
if (m->mode != _NETDEV_MACVLAN_MODE_INVALID) {
- r = sd_rtnl_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
- if (r < 0) {
- log_netdev_error(netdev,
- "Could not append IFLA_MACVLAN_MODE attribute: %s",
- strerror(-r));
- return r;
- }
+ r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MODE attribute: %m");
}
return 0;
diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c
index 8af4be4974..5533fb5c7b 100644
--- a/src/network/networkd-netdev-tunnel.c
+++ b/src/network/networkd-netdev-tunnel.c
@@ -25,7 +25,7 @@
#include <linux/if_tunnel.h>
#include <linux/ip6_tunnel.h>
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "networkd-netdev-tunnel.h"
#include "networkd-link.h"
#include "util.h"
@@ -43,7 +43,7 @@ static const char* const ip6tnl_mode_table[_NETDEV_IP6_TNL_MODE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(ip6tnl_mode, Ip6TnlMode);
DEFINE_CONFIG_PARSE_ENUM(config_parse_ip6tnl_mode, ip6tnl_mode, Ip6TnlMode, "Failed to parse ip6 tunnel Mode");
-static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = IPIP(netdev);
int r;
@@ -53,30 +53,30 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(t);
assert(t->family == AF_INET);
- r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
return r;
}
-static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = SIT(netdev);
int r;
@@ -86,30 +86,30 @@ static int netdev_sit_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
assert(t);
assert(t->family == AF_INET);
- r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PMTUDISC, t->pmtudisc);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
return r;
}
-static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t;
int r;
@@ -125,34 +125,34 @@ static int netdev_gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
assert(link);
assert(m);
- r = sd_rtnl_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_GRE_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_GRE_REMOTE, &t->remote.in);
if (r < 0)
log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TOS, t->tos);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_TOS, t->tos);
if (r < 0)
log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TOS attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_PMTUDISC, t->pmtudisc);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_PMTUDISC attribute: %m");
return r;
}
-static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t;
int r;
@@ -168,26 +168,26 @@ static int netdev_ip6gre_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
assert(link);
assert(m);
- r = sd_rtnl_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_GRE_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LINK attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_GRE_LOCAL, &t->local.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_LOCAL, &t->local.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_GRE_REMOTE, &t->remote.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_GRE_REMOTE, &t->remote.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_GRE_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GRE_TTL attribute: %m");
return r;
}
-static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = VTI(netdev);
int r;
@@ -197,22 +197,22 @@ static int netdev_vti_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_me
assert(t);
assert(t->family == AF_INET);
- r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_LOCAL, &t->local.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_VTI_LOCAL, &t->local.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in_addr(m, IFLA_VTI_REMOTE, &t->remote.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_VTI_REMOTE, &t->remote.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
return r;
}
-static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = VTI6(netdev);
int r;
@@ -222,22 +222,22 @@ static int netdev_vti6_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(t);
assert(t->family == AF_INET6);
- r = sd_rtnl_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_VTI_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_LOCAL, &t->local.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_VTI_LOCAL, &t->local.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_VTI_REMOTE, &t->remote.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_VTI_REMOTE, &t->remote.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
return r;
}
-static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Tunnel *t = IP6TNL(netdev);
uint8_t proto;
int r;
@@ -248,19 +248,19 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
assert(t);
assert(t->family == AF_INET6);
- r = sd_rtnl_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_IPTUN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LINK attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_IPTUN_LOCAL, &t->local.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_LOCAL, &t->local.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_LOCAL attribute: %m");
- r = sd_rtnl_message_append_in6_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in6);
+ r = sd_netlink_message_append_in6_addr(m, IFLA_IPTUN_REMOTE, &t->remote.in6);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_REMOTE attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_TTL, t->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_TTL attribute: %m");
@@ -277,7 +277,7 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_rtnl
break;
}
- r = sd_rtnl_message_append_u8(m, IFLA_IPTUN_PROTO, proto);
+ r = sd_netlink_message_append_u8(m, IFLA_IPTUN_PROTO, proto);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_MODE attribute: %m");
diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c
index 4e974927cb..378312f091 100644
--- a/src/network/networkd-netdev-tuntap.c
+++ b/src/network/networkd-netdev-tuntap.c
@@ -69,18 +69,12 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
assert(ifr);
fd = open(TUN_DEV, O_RDWR);
- if (fd < 0) {
- log_netdev_error(netdev, "Failed to open tun dev: %m");
- return -errno;
- }
+ if (fd < 0)
+ return log_netdev_error_errno(netdev, -errno, "Failed to open tun dev: %m");
r = ioctl(fd, TUNSETIFF, ifr);
- if (r < 0) {
- log_netdev_error(netdev,
- "TUNSETIFF failed on tun dev: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, -errno, "TUNSETIFF failed on tun dev: %m");
if (netdev->kind == NETDEV_KIND_TAP)
t = TAP(netdev);
@@ -94,18 +88,12 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
user = t->user_name;
r = get_user_creds(&user, &uid, NULL, NULL, NULL);
- if (r < 0) {
- log_error_errno(r, "Cannot resolve user name %s: %m",
- t->user_name);
- return 0;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Cannot resolve user name %s: %m", t->user_name);
r = ioctl(fd, TUNSETOWNER, uid);
- if ( r < 0) {
- log_netdev_error(netdev,
- "TUNSETOWNER failed on tun dev: %s",
- strerror(-r));
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, -errno, "TUNSETOWNER failed on tun dev: %m");
}
if (t->group_name) {
@@ -113,29 +101,18 @@ static int netdev_tuntap_add(NetDev *netdev, struct ifreq *ifr) {
group = t->group_name;
r = get_group_creds(&group, &gid);
- if (r < 0) {
- log_error_errno(r, "Cannot resolve group name %s: %m",
- t->group_name);
- return 0;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, r, "Cannot resolve group name %s: %m", t->group_name);
r = ioctl(fd, TUNSETGROUP, gid);
- if( r < 0) {
- log_netdev_error(netdev,
- "TUNSETGROUP failed on tun dev: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, -errno, "TUNSETGROUP failed on tun dev: %m");
}
r = ioctl(fd, TUNSETPERSIST, 1);
- if (r < 0) {
- log_netdev_error(netdev,
- "TUNSETPERSIST failed on tun dev: %s",
- strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_netdev_error_errno(netdev, -errno, "TUNSETPERSIST failed on tun dev: %m");
return 0;
}
diff --git a/src/network/networkd-netdev-veth.c b/src/network/networkd-netdev-veth.c
index 7bb02d1ae1..e20f9f74e2 100644
--- a/src/network/networkd-netdev-veth.c
+++ b/src/network/networkd-netdev-veth.c
@@ -22,10 +22,10 @@
#include <net/if.h>
#include <linux/veth.h>
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "networkd-netdev-veth.h"
-static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
Veth *v = VETH(netdev);
int r;
@@ -34,23 +34,23 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(v);
assert(m);
- r = sd_rtnl_message_open_container(m, VETH_INFO_PEER);
+ r = sd_netlink_message_open_container(m, VETH_INFO_PEER);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append VETH_INFO_PEER attribute: %m");
if (v->ifname_peer) {
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface name: %m");
}
if (v->mac_peer) {
- r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer);
+ r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, v->mac_peer);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
}
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
diff --git a/src/network/networkd-netdev-vlan.c b/src/network/networkd-netdev-vlan.c
index 0ed024b41d..d53e7beaac 100644
--- a/src/network/networkd-netdev-vlan.c
+++ b/src/network/networkd-netdev-vlan.c
@@ -23,7 +23,7 @@
#include "networkd-netdev-vlan.h"
-static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *req) {
+static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
VLan *v = VLAN(netdev);
int r;
@@ -33,7 +33,7 @@ static int netdev_vlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m
assert(req);
if (v->id <= VLANID_MAX) {
- r = sd_rtnl_message_append_u16(req, IFLA_VLAN_ID, v->id);
+ r = sd_netlink_message_append_u16(req, IFLA_VLAN_ID, v->id);
if (r < 0) {
log_netdev_error(netdev,
"Could not append IFLA_VLAN_ID attribute: %s",
diff --git a/src/network/networkd-netdev-vxlan.c b/src/network/networkd-netdev-vxlan.c
index 01a1e5089c..2a5c5f0baa 100644
--- a/src/network/networkd-netdev-vxlan.c
+++ b/src/network/networkd-netdev-vxlan.c
@@ -21,13 +21,13 @@
#include <net/if.h>
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "networkd-netdev-vxlan.h"
#include "networkd-link.h"
#include "conf-parser.h"
#include "missing.h"
-static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_message *m) {
+static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *m) {
VxLan *v = VXLAN(netdev);
int r;
@@ -38,66 +38,66 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_
if (v->id <= VXLAN_VID_MAX) {
- r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_ID, v->id);
+ r = sd_netlink_message_append_u32(m, IFLA_VXLAN_ID, v->id);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m");
}
- r = sd_rtnl_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
+ r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_VXLAN_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LINK attribute: %m");
if(v->ttl) {
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TTL, v->ttl);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TTL attribute: %m");
}
if(v->tos) {
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_TOS, v->tos);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_TOS attribute: %m");
}
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_LEARNING, v->learning);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_LEARNING attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_RSC, v->route_short_circuit);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_RSC attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_PROXY, v->arp_proxy);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_PROXY attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_L2MISS, v->l2miss);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L2MISS attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_L3MISS, v->l3miss);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_L3MISS attribute: %m");
if(v->fdb_ageing) {
- r = sd_rtnl_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
+ r = sd_netlink_message_append_u32(m, IFLA_VXLAN_AGEING, v->fdb_ageing / USEC_PER_SEC);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_AGEING attribute: %m");
}
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_CSUM, v->udpcsum);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_CSUM attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_TX, v->udp6zerocsumtx);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_TX attribute: %m");
- r = sd_rtnl_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
+ r = sd_netlink_message_append_u8(m, IFLA_VXLAN_UDP_ZERO_CSUM6_RX, v->udp6zerocsumrx);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_UDP_ZERO_CSUM6_RX attribute: %m");
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 66fd0fac0a..ece9ecc251 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -77,7 +77,7 @@ DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind);
DEFINE_CONFIG_PARSE_ENUM(config_parse_netdev_kind, netdev_kind, NetDevKind, "Failed to parse netdev kind");
static void netdev_cancel_callbacks(NetDev *netdev) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
netdev_join_callback *callback;
if (!netdev)
@@ -180,8 +180,8 @@ static int netdev_enter_failed(NetDev *netdev) {
return 0;
}
-static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(netdev);
@@ -196,11 +196,11 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not allocate RTM_SETLINK message: %m");
- r = sd_rtnl_message_append_u32(req, IFLA_MASTER, netdev->ifindex);
+ r = sd_netlink_message_append_u32(req, IFLA_MASTER, netdev->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_MASTER attribute: %m");
- r = sd_rtnl_call_async(netdev->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(netdev->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_netdev_error(netdev, "Could not send rtnetlink message: %m");
@@ -241,13 +241,13 @@ static int netdev_enter_ready(NetDev *netdev) {
}
/* callback for netdev's created without a backing Link */
-static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int netdev_create_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
_cleanup_netdev_unref_ NetDev *netdev = userdata;
int r;
assert(netdev->state != _NETDEV_STATE_INVALID);
- r = sd_rtnl_message_get_errno(m);
+ r = sd_netlink_message_get_errno(m);
if (r == -EEXIST)
log_netdev_info(netdev, "netdev exists, using existing without changing its parameters");
else if (r < 0) {
@@ -262,7 +262,7 @@ static int netdev_create_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userda
return 1;
}
-int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) {
+int netdev_enslave(NetDev *netdev, Link *link, sd_netlink_message_handler_t callback) {
int r;
assert(netdev);
@@ -292,7 +292,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callbac
return 0;
}
-int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
+int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *message) {
uint16_t type;
const char *kind;
const char *received_kind;
@@ -302,7 +302,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
assert(netdev);
assert(message);
- r = sd_rtnl_message_get_type(message, &type);
+ r = sd_netlink_message_get_type(message, &type);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get rtnl message type: %m");
@@ -333,7 +333,7 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
return 0;
}
- r = sd_rtnl_message_read_string(message, IFLA_IFNAME, &received_name);
+ r = sd_netlink_message_read_string(message, IFLA_IFNAME, &received_name);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get IFNAME: %m");
@@ -343,15 +343,15 @@ int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *message) {
return r;
}
- r = sd_rtnl_message_enter_container(message, IFLA_LINKINFO);
+ r = sd_netlink_message_enter_container(message, IFLA_LINKINFO);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get LINKINFO: %m");
- r = sd_rtnl_message_read_string(message, IFLA_INFO_KIND, &received_kind);
+ r = sd_netlink_message_read_string(message, IFLA_INFO_KIND, &received_kind);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not get KIND: %m");
- r = sd_rtnl_message_exit_container(message);
+ r = sd_netlink_message_exit_container(message);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not exit container: %m");
@@ -431,7 +431,7 @@ int netdev_get_mac(const char *ifname, struct ether_addr **ret) {
}
static int netdev_create(NetDev *netdev, Link *link,
- sd_rtnl_message_handler_t callback) {
+ sd_netlink_message_handler_t callback) {
int r;
assert(netdev);
@@ -447,39 +447,39 @@ static int netdev_create(NetDev *netdev, Link *link,
log_netdev_debug(netdev, "Created");
} else {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
r = sd_rtnl_message_new_link(netdev->manager->rtnl, &m, RTM_NEWLINK, 0);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not allocate RTM_NEWLINK message: %m");
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, netdev->ifname);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, netdev->ifname);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IFNAME, attribute: %m");
if (netdev->mac) {
- r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, netdev->mac);
+ r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, netdev->mac);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
}
if (netdev->mtu) {
- r = sd_rtnl_message_append_u32(m, IFLA_MTU, netdev->mtu);
+ r = sd_netlink_message_append_u32(m, IFLA_MTU, netdev->mtu);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_MTU attribute: %m");
}
if (link) {
- r = sd_rtnl_message_append_u32(m, IFLA_LINK, link->ifindex);
+ r = sd_netlink_message_append_u32(m, IFLA_LINK, link->ifindex);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINK attribute: %m");
}
- r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
+ r = sd_netlink_message_open_container(m, IFLA_LINKINFO);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
- r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, netdev_kind_to_string(netdev->kind));
+ r = sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, netdev_kind_to_string(netdev->kind));
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
@@ -489,22 +489,22 @@ static int netdev_create(NetDev *netdev, Link *link,
return r;
}
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_LINKINFO attribute: %m");
if (link) {
- r = sd_rtnl_call_async(netdev->manager->rtnl, m, callback, link, 0, NULL);
+ r = sd_netlink_call_async(netdev->manager->rtnl, m, callback, link, 0, NULL);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not send rtnetlink message: %m");
link_ref(link);
} else {
- r = sd_rtnl_call_async(netdev->manager->rtnl, m, netdev_create_handler, netdev, 0, NULL);
+ r = sd_netlink_call_async(netdev->manager->rtnl, m, netdev_create_handler, netdev, 0, NULL);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not send rtnetlink message: %m");
@@ -520,7 +520,7 @@ static int netdev_create(NetDev *netdev, Link *link,
}
/* the callback must be called, possibly after a timeout, as otherwise the Link will hang */
-int netdev_join(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) {
+int netdev_join(NetDev *netdev, Link *link, sd_netlink_message_handler_t callback) {
int r;
assert(netdev);
diff --git a/src/network/networkd-netdev.h b/src/network/networkd-netdev.h
index 1ded495e4a..a004f2fe5f 100644
--- a/src/network/networkd-netdev.h
+++ b/src/network/networkd-netdev.h
@@ -29,7 +29,7 @@ typedef struct NetDevVTable NetDevVTable;
typedef struct netdev_join_callback netdev_join_callback;
struct netdev_join_callback {
- sd_rtnl_message_handler_t callback;
+ sd_netlink_message_handler_t callback;
Link *link;
LIST_FIELDS(netdev_join_callback, callbacks);
@@ -129,7 +129,7 @@ struct NetDevVTable {
void (*done)(NetDev *n);
/* fill in message to create netdev */
- int (*fill_message_create)(NetDev *netdev, Link *link, sd_rtnl_message *message);
+ int (*fill_message_create)(NetDev *netdev, Link *link, sd_netlink_message *message);
/* specifies if netdev is independent, or a master device or a stacked device */
NetDevCreateType create_type;
@@ -187,10 +187,10 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
#define _cleanup_netdev_unref_ _cleanup_(netdev_unrefp)
int netdev_get(Manager *manager, const char *name, NetDev **ret);
-int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *newlink);
-int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback);
+int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *newlink);
+int netdev_enslave(NetDev *netdev, Link *link, sd_netlink_message_handler_t callback);
int netdev_get_mac(const char *ifname, struct ether_addr **ret);
-int netdev_join(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb);
+int netdev_join(NetDev *netdev, Link *link, sd_netlink_message_handler_t cb);
const char *netdev_kind_to_string(NetDevKind d) _const_;
NetDevKind netdev_kind_from_string(const char *d) _pure_;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 8abf5bcf2e..b05bc949f2 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -15,69 +15,69 @@ struct ConfigPerfItem;
%struct-type
%includes
%%
-Match.MACAddress, config_parse_hwaddr, 0, offsetof(Network, match_mac)
-Match.Path, config_parse_strv, 0, offsetof(Network, match_path)
-Match.Driver, config_parse_strv, 0, offsetof(Network, match_driver)
-Match.Type, config_parse_strv, 0, offsetof(Network, match_type)
-Match.Name, config_parse_ifnames, 0, offsetof(Network, match_name)
-Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, match_host)
-Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(Network, match_virt)
-Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, match_kernel)
-Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, match_arch)
-Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
-Link.MTUBytes, config_parse_iec_size, 0, offsetof(Network, mtu)
-Network.Description, config_parse_string, 0, offsetof(Network, description)
-Network.Bridge, config_parse_netdev, 0, offsetof(Network, bridge)
-Network.Bond, config_parse_netdev, 0, offsetof(Network, bond)
-Network.VLAN, config_parse_netdev, 0, 0
-Network.MACVLAN, config_parse_netdev, 0, 0
-Network.IPVLAN, config_parse_netdev, 0, 0
-Network.VXLAN, config_parse_netdev, 0, 0
-Network.Tunnel, config_parse_tunnel, 0, 0
-Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp)
-Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
-Network.LinkLocalAddressing, config_parse_address_family_boolean,0, offsetof(Network, link_local)
-Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route)
-Network.IPv6Token, config_parse_ipv6token, 0, offsetof(Network, ipv6_token)
-Network.LLDP, config_parse_bool, 0, offsetof(Network, lldp)
-Network.Address, config_parse_address, 0, 0
-Network.Gateway, config_parse_gateway, 0, 0
-Network.Domains, config_parse_domains, 0, offsetof(Network, domains)
-Network.DNS, config_parse_strv, 0, offsetof(Network, dns)
-Network.LLMNR, config_parse_llmnr, 0, offsetof(Network, llmnr)
-Network.NTP, config_parse_strv, 0, offsetof(Network, ntp)
-Network.IPForward, config_parse_address_family_boolean,0, offsetof(Network, ip_forward)
-Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade)
-Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier)
-Address.Address, config_parse_address, 0, 0
-Address.Peer, config_parse_address, 0, 0
-Address.Broadcast, config_parse_broadcast, 0, 0
-Address.Label, config_parse_label, 0, 0
-Route.Gateway, config_parse_gateway, 0, 0
-Route.Destination, config_parse_destination, 0, 0
-Route.Source, config_parse_destination, 0, 0
-Route.Metric, config_parse_route_priority, 0, 0
-Route.Scope, config_parse_route_scope, 0, 0
-DHCP.ClientIdentifier, config_parse_dhcp_client_identifier,0, offsetof(Network, dhcp_client_identifier)
-DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
-DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_ntp)
-DHCP.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
-DHCP.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
-DHCP.UseDomains, config_parse_bool, 0, offsetof(Network, dhcp_domains)
-DHCP.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_routes)
-DHCP.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_sendhost)
-DHCP.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast)
-DHCP.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
-DHCP.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier)
-DHCP.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric)
-Bridge.Cost, config_parse_unsigned, 0, offsetof(Network, cost)
-BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
-BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
+Match.MACAddress, config_parse_hwaddr, 0, offsetof(Network, match_mac)
+Match.Path, config_parse_strv, 0, offsetof(Network, match_path)
+Match.Driver, config_parse_strv, 0, offsetof(Network, match_driver)
+Match.Type, config_parse_strv, 0, offsetof(Network, match_type)
+Match.Name, config_parse_ifnames, 0, offsetof(Network, match_name)
+Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, match_host)
+Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(Network, match_virt)
+Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, match_kernel)
+Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, match_arch)
+Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
+Link.MTUBytes, config_parse_iec_size, 0, offsetof(Network, mtu)
+Network.Description, config_parse_string, 0, offsetof(Network, description)
+Network.Bridge, config_parse_netdev, 0, offsetof(Network, bridge)
+Network.Bond, config_parse_netdev, 0, offsetof(Network, bond)
+Network.VLAN, config_parse_netdev, 0, 0
+Network.MACVLAN, config_parse_netdev, 0, 0
+Network.IPVLAN, config_parse_netdev, 0, 0
+Network.VXLAN, config_parse_netdev, 0, 0
+Network.Tunnel, config_parse_tunnel, 0, 0
+Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp)
+Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
+Network.LinkLocalAddressing, config_parse_address_family_boolean, 0, offsetof(Network, link_local)
+Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route)
+Network.IPv6Token, config_parse_ipv6token, 0, offsetof(Network, ipv6_token)
+Network.LLDP, config_parse_bool, 0, offsetof(Network, lldp)
+Network.Address, config_parse_address, 0, 0
+Network.Gateway, config_parse_gateway, 0, 0
+Network.Domains, config_parse_domains, 0, offsetof(Network, domains)
+Network.DNS, config_parse_strv, 0, offsetof(Network, dns)
+Network.LLMNR, config_parse_llmnr, 0, offsetof(Network, llmnr)
+Network.NTP, config_parse_strv, 0, offsetof(Network, ntp)
+Network.IPForward, config_parse_address_family_boolean_with_kernel,0, offsetof(Network, ip_forward)
+Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade)
+Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier)
+Address.Address, config_parse_address, 0, 0
+Address.Peer, config_parse_address, 0, 0
+Address.Broadcast, config_parse_broadcast, 0, 0
+Address.Label, config_parse_label, 0, 0
+Route.Gateway, config_parse_gateway, 0, 0
+Route.Destination, config_parse_destination, 0, 0
+Route.Source, config_parse_destination, 0, 0
+Route.Metric, config_parse_route_priority, 0, 0
+Route.Scope, config_parse_route_scope, 0, 0
+DHCP.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
+DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
+DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_ntp)
+DHCP.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
+DHCP.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
+DHCP.UseDomains, config_parse_bool, 0, offsetof(Network, dhcp_domains)
+DHCP.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_routes)
+DHCP.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_sendhost)
+DHCP.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast)
+DHCP.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
+DHCP.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier)
+DHCP.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric)
+Bridge.Cost, config_parse_unsigned, 0, offsetof(Network, cost)
+BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
+BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
/* backwards compatibility: do not add new entries to this section */
-Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
-DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
-DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
-DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
-DHCP.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
-DHCPv4.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
-DHCPv4.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
+Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
+DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
+DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
+DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
+DHCP.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
+DHCPv4.UseDomainName, config_parse_bool, 0, offsetof(Network, dhcp_domains)
+DHCPv4.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 6f32e5f4a4..ec95c8661e 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -717,3 +717,37 @@ int config_parse_ipv6token(
return 0;
}
+
+int config_parse_address_family_boolean_with_kernel(
+ const char* unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ AddressFamilyBoolean *fwd = data, s;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ s = address_family_boolean_from_string(rvalue);
+ if (s < 0) {
+ if (streq(rvalue, "kernel"))
+ s = _ADDRESS_FAMILY_BOOLEAN_INVALID;
+ else {
+ log_syntax(unit, LOG_ERR, filename, line, s, "Failed to parse IPForwarding option, ignoring: %s", rvalue);
+ return 0;
+ }
+ }
+
+ *fwd = s;
+
+ return 0;
+}
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 7f110a5217..31b10c458d 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -97,8 +97,8 @@ void route_free(Route *route) {
}
int route_drop(Route *route, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -115,18 +115,18 @@ int route_drop(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->in_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_GATEWAY, &route->in_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_GATEWAY, &route->in_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m");
}
if (route->dst_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_DST, &route->dst_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_DST, &route->dst_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_DST attribute: %m");
@@ -137,9 +137,9 @@ int route_drop(Route *route, Link *link,
if (route->src_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_DST attribute: %m");
@@ -150,9 +150,9 @@ int route_drop(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->prefsrc_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PREFSRC attribute: %m");
}
@@ -161,15 +161,15 @@ int route_drop(Route *route, Link *link,
if (r < 0)
return log_error_errno(r, "Could not set scope: %m");
- r = sd_rtnl_message_append_u32(req, RTA_PRIORITY, route->metrics);
+ r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->metrics);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m");
- r = sd_rtnl_message_append_u32(req, RTA_OIF, link->ifindex);
+ r = sd_netlink_message_append_u32(req, RTA_OIF, link->ifindex);
if (r < 0)
return log_error_errno(r, "Could not append RTA_OIF attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
@@ -179,8 +179,8 @@ int route_drop(Route *route, Link *link,
}
int route_configure(Route *route, Link *link,
- sd_rtnl_message_handler_t callback) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL;
+ sd_netlink_message_handler_t callback) {
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL;
int r;
assert(link);
@@ -197,18 +197,18 @@ int route_configure(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->in_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_GATEWAY, &route->in_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_GATEWAY, &route->in_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_GATEWAY, &route->in_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_GATEWAY attribute: %m");
}
if (route->dst_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_DST, &route->dst_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_DST, &route->dst_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_DST, &route->dst_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_DST attribute: %m");
@@ -219,9 +219,9 @@ int route_configure(Route *route, Link *link,
if (route->src_prefixlen) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_SRC, &route->src_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_SRC, &route->src_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_SRC attribute: %m");
@@ -232,9 +232,9 @@ int route_configure(Route *route, Link *link,
if (!in_addr_is_null(route->family, &route->prefsrc_addr)) {
if (route->family == AF_INET)
- r = sd_rtnl_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
+ r = sd_netlink_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in);
else if (route->family == AF_INET6)
- r = sd_rtnl_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
+ r = sd_netlink_message_append_in6_addr(req, RTA_PREFSRC, &route->prefsrc_addr.in6);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PREFSRC attribute: %m");
}
@@ -243,15 +243,15 @@ int route_configure(Route *route, Link *link,
if (r < 0)
return log_error_errno(r, "Could not set scope: %m");
- r = sd_rtnl_message_append_u32(req, RTA_PRIORITY, route->metrics);
+ r = sd_netlink_message_append_u32(req, RTA_PRIORITY, route->metrics);
if (r < 0)
return log_error_errno(r, "Could not append RTA_PRIORITY attribute: %m");
- r = sd_rtnl_message_append_u32(req, RTA_OIF, link->ifindex);
+ r = sd_netlink_message_append_u32(req, RTA_OIF, link->ifindex);
if (r < 0)
return log_error_errno(r, "Could not append RTA_OIF attribute: %m");
- r = sd_rtnl_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
+ r = sd_netlink_call_async(link->manager->rtnl, req, callback, link, 0, NULL);
if (r < 0)
return log_error_errno(r, "Could not send rtnetlink message: %m");
diff --git a/src/network/networkd-wait-online-link.c b/src/network/networkd-wait-online-link.c
index 341bcae3fb..2d5123788c 100644
--- a/src/network/networkd-wait-online-link.c
+++ b/src/network/networkd-wait-online-link.c
@@ -82,7 +82,7 @@ Link *link_free(Link *l) {
return NULL;
}
-int link_update_rtnl(Link *l, sd_rtnl_message *m) {
+int link_update_rtnl(Link *l, sd_netlink_message *m) {
const char *ifname;
int r;
@@ -94,7 +94,7 @@ int link_update_rtnl(Link *l, sd_rtnl_message *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_read_string(m, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(m, IFLA_IFNAME, &ifname);
if (r < 0)
return r;
diff --git a/src/network/networkd-wait-online-link.h b/src/network/networkd-wait-online-link.h
index 90ea6b3405..068196622e 100644
--- a/src/network/networkd-wait-online-link.h
+++ b/src/network/networkd-wait-online-link.h
@@ -39,7 +39,7 @@ struct Link {
int link_new(Manager *m, Link **ret, int ifindex, const char *ifname);
Link *link_free(Link *l);
-int link_update_rtnl(Link *l, sd_rtnl_message *m);
+int link_update_rtnl(Link *l, sd_netlink_message *m);
int link_update_monitor(Link *l);
bool link_relevant(Link *l);
diff --git a/src/network/networkd-wait-online-manager.c b/src/network/networkd-wait-online-manager.c
index 1c997a50a4..1fc724f5a4 100644
--- a/src/network/networkd-wait-online-manager.c
+++ b/src/network/networkd-wait-online-manager.c
@@ -23,7 +23,7 @@
#include <linux/if.h>
#include <fnmatch.h>
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "network-internal.h"
#include "networkd-wait-online-link.h"
@@ -93,7 +93,7 @@ bool manager_all_configured(Manager *m) {
return one_ready;
}
-static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
+static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
Manager *m = userdata;
uint16_t type;
Link *l;
@@ -104,7 +104,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda
assert(m);
assert(mm);
- r = sd_rtnl_message_get_type(mm, &type);
+ r = sd_netlink_message_get_type(mm, &type);
if (r < 0)
goto fail;
@@ -112,7 +112,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda
if (r < 0)
goto fail;
- r = sd_rtnl_message_read_string(mm, IFLA_IFNAME, &ifname);
+ r = sd_netlink_message_read_string(mm, IFLA_IFNAME, &ifname);
if (r < 0)
goto fail;
@@ -155,7 +155,7 @@ fail:
return 0;
}
-static int on_rtnl_event(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
+static int on_rtnl_event(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
Manager *m = userdata;
int r;
@@ -170,26 +170,26 @@ static int on_rtnl_event(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
}
static int manager_rtnl_listen(Manager *m) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *i;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *i;
int r;
assert(m);
/* First, subscribe to interfaces coming and going */
- r = sd_rtnl_open(&m->rtnl, 3, RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR, RTNLGRP_IPV6_IFADDR);
+ r = sd_netlink_open(&m->rtnl);
if (r < 0)
return r;
- r = sd_rtnl_attach_event(m->rtnl, m->event, 0);
+ r = sd_netlink_attach_event(m->rtnl, m->event, 0);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWLINK, on_rtnl_event, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWLINK, on_rtnl_event, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELLINK, on_rtnl_event, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELLINK, on_rtnl_event, m);
if (r < 0)
return r;
@@ -198,15 +198,15 @@ static int manager_rtnl_listen(Manager *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (i = reply; i; i = sd_rtnl_message_next(i)) {
+ for (i = reply; i; i = sd_netlink_message_next(i)) {
r = manager_process_link(m->rtnl, i, m);
if (r < 0)
return r;
@@ -323,7 +323,7 @@ void manager_free(Manager *m) {
sd_network_monitor_unref(m->network_monitor);
sd_event_source_unref(m->rtnl_event_source);
- sd_rtnl_unref(m->rtnl);
+ sd_netlink_unref(m->rtnl);
sd_event_unref(m->event);
free(m);
diff --git a/src/network/networkd-wait-online.h b/src/network/networkd-wait-online.h
index 73d129699d..627c46be13 100644
--- a/src/network/networkd-wait-online.h
+++ b/src/network/networkd-wait-online.h
@@ -22,7 +22,7 @@
#pragma once
#include "sd-event.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-network.h"
#include "hashmap.h"
@@ -38,7 +38,7 @@ struct Manager {
char **interfaces;
char **ignore;
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
sd_event_source *rtnl_event_source;
sd_network_monitor *network_monitor;
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 4b13d4aed1..ac6e2c8a8e 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -24,7 +24,7 @@
#include <arpa/inet.h>
#include "sd-event.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "sd-bus.h"
#include "sd-dhcp-client.h"
#include "sd-dhcp-server.h"
@@ -34,7 +34,7 @@
#include "udev.h"
#include "sd-lldp.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "hashmap.h"
#include "list.h"
#include "set.h"
@@ -218,7 +218,7 @@ struct AddressPool {
};
struct Manager {
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
sd_event *event;
sd_event_source *bus_retry_event_source;
sd_bus *bus;
@@ -342,8 +342,8 @@ const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, unsig
int route_new_static(Network *network, unsigned section, Route **ret);
int route_new_dynamic(Route **ret, unsigned char rtm_protocol);
void route_free(Route *route);
-int route_configure(Route *route, Link *link, sd_rtnl_message_handler_t callback);
-int route_drop(Route *route, Link *link, sd_rtnl_message_handler_t callback);
+int route_configure(Route *route, Link *link, sd_netlink_message_handler_t callback);
+int route_drop(Route *route, Link *link, sd_netlink_message_handler_t callback);
DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
@@ -368,9 +368,9 @@ int config_parse_route_scope(const char *unit, const char *filename, unsigned li
int address_new_static(Network *network, unsigned section, Address **ret);
int address_new_dynamic(Address **ret);
void address_free(Address *address);
-int address_configure(Address *address, Link *link, sd_rtnl_message_handler_t callback);
-int address_update(Address *address, Link *link, sd_rtnl_message_handler_t callback);
-int address_drop(Address *address, Link *link, sd_rtnl_message_handler_t callback);
+int address_configure(Address *address, Link *link, sd_netlink_message_handler_t callback);
+int address_update(Address *address, Link *link, sd_netlink_message_handler_t callback);
+int address_drop(Address *address, Link *link, sd_netlink_message_handler_t callback);
int address_establish(Address *address, Link *link);
int address_release(Address *address, Link *link);
bool address_equal(Address *a1, Address *a2);
@@ -448,6 +448,9 @@ AddressFamilyBoolean address_family_boolean_from_string(const char *s) _const_;
int config_parse_address_family_boolean(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+/* IPForwarding parser */
+int config_parse_address_family_boolean_with_kernel(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+
/* Operational State */
const char* link_operstate_to_string(LinkOperationalState s) _const_;
diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
index 67fcca2ac0..438214015d 100644
--- a/src/network/test-network-tables.c
+++ b/src/network/test-network-tables.c
@@ -3,7 +3,7 @@
#include "networkd-netdev-macvlan.h"
#include "dhcp6-internal.h"
#include "dhcp6-protocol.h"
-#include "rtnl-internal.h"
+#include "netlink-internal.h"
#include "ethtool-util.h"
#include "test-tables.h"
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 251af4a67c..c87956bb01 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -55,7 +55,7 @@
#include "sd-daemon.h"
#include "sd-bus.h"
#include "sd-id128.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "random-util.h"
#include "log.h"
#include "util.h"
@@ -75,7 +75,7 @@
#include "bus-error.h"
#include "ptyfwd.h"
#include "env-util.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "udev-util.h"
#include "blkid-util.h"
#include "gpt.h"
@@ -90,7 +90,7 @@
#include "machine-image.h"
#include "list.h"
#include "in-addr-util.h"
-#include "fw-util.h"
+#include "firewall-util.h"
#include "local-addresses.h"
#include "formats-util.h"
#include "process-util.h"
@@ -1966,7 +1966,7 @@ static int flush_ports(union in_addr_union *exposed) {
return 0;
}
-static int expose_ports(sd_rtnl *rtnl, union in_addr_union *exposed) {
+static int expose_ports(sd_netlink *rtnl, union in_addr_union *exposed) {
_cleanup_free_ struct local_address *addresses = NULL;
_cleanup_free_ char *pretty = NULL;
union in_addr_union new_exposed;
@@ -2020,7 +2020,7 @@ static int expose_ports(sd_rtnl *rtnl, union in_addr_union *exposed) {
return 0;
}
-static int on_address_change(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
+static int on_address_change(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
union in_addr_union *exposed = userdata;
assert(rtnl);
@@ -2031,7 +2031,7 @@ static int on_address_change(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata)
return 0;
}
-static int watch_rtnl(sd_event *event, int recv_fd, union in_addr_union *exposed, sd_rtnl **ret) {
+static int watch_rtnl(sd_event *event, int recv_fd, union in_addr_union *exposed, sd_netlink **ret) {
union {
struct cmsghdr cmsghdr;
uint8_t buf[CMSG_SPACE(sizeof(int))];
@@ -2041,7 +2041,7 @@ static int watch_rtnl(sd_event *event, int recv_fd, union in_addr_union *exposed
.msg_controllen = sizeof(control),
};
struct cmsghdr *cmsg;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
int fd, r;
ssize_t k;
@@ -2062,21 +2062,21 @@ static int watch_rtnl(sd_event *event, int recv_fd, union in_addr_union *exposed
assert(cmsg->cmsg_len == CMSG_LEN(sizeof(int)));
memcpy(&fd, CMSG_DATA(cmsg), sizeof(int));
- r = sd_rtnl_open_fd(&rtnl, fd, 1, RTNLGRP_IPV4_IFADDR);
+ r = sd_netlink_open_fd(&rtnl, fd);
if (r < 0) {
safe_close(fd);
return log_error_errno(r, "Failed to create rtnl object: %m");
}
- r = sd_rtnl_add_match(rtnl, RTM_NEWADDR, on_address_change, exposed);
+ r = sd_netlink_add_match(rtnl, RTM_NEWADDR, on_address_change, exposed);
if (r < 0)
return log_error_errno(r, "Failed to subscribe to RTM_NEWADDR messages: %m");
- r = sd_rtnl_add_match(rtnl, RTM_DELADDR, on_address_change, exposed);
+ r = sd_netlink_add_match(rtnl, RTM_DELADDR, on_address_change, exposed);
if (r < 0)
return log_error_errno(r, "Failed to subscribe to RTM_DELADDR messages: %m");
- r = sd_rtnl_attach_event(rtnl, event, 0);
+ r = sd_netlink_attach_event(rtnl, event, 0);
if (r < 0)
return log_error_errno(r, "Failed to add to even loop: %m");
@@ -2550,8 +2550,8 @@ static int generate_mac(struct ether_addr *mac, sd_id128_t hash_key, uint64_t id
}
static int setup_veth(pid_t pid, char iface_name[IFNAMSIZ], int *ifi) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
struct ether_addr mac_host, mac_container;
int r, i;
@@ -2574,7 +2574,7 @@ static int setup_veth(pid_t pid, char iface_name[IFNAMSIZ], int *ifi) {
if (r < 0)
return log_error_errno(r, "Failed to generate predictable MAC address for host side: %m");
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -2582,51 +2582,51 @@ static int setup_veth(pid_t pid, char iface_name[IFNAMSIZ], int *ifi) {
if (r < 0)
return log_error_errno(r, "Failed to allocate netlink message: %m");
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, iface_name);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, iface_name);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface name: %m");
- r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, &mac_host);
+ r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, &mac_host);
if (r < 0)
return log_error_errno(r, "Failed to add netlink MAC address: %m");
- r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
+ r = sd_netlink_message_open_container(m, IFLA_LINKINFO);
if (r < 0)
return log_error_errno(r, "Failed to open netlink container: %m");
- r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "veth");
+ r = sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, "veth");
if (r < 0)
return log_error_errno(r, "Failed to open netlink container: %m");
- r = sd_rtnl_message_open_container(m, VETH_INFO_PEER);
+ r = sd_netlink_message_open_container(m, VETH_INFO_PEER);
if (r < 0)
return log_error_errno(r, "Failed to open netlink container: %m");
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, "host0");
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, "host0");
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface name: %m");
- r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, &mac_container);
+ r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, &mac_container);
if (r < 0)
return log_error_errno(r, "Failed to add netlink MAC address: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_NET_NS_PID, pid);
+ r = sd_netlink_message_append_u32(m, IFLA_NET_NS_PID, pid);
if (r < 0)
return log_error_errno(r, "Failed to add netlink namespace field: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_error_errno(r, "Failed to close netlink container: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_error_errno(r, "Failed to close netlink container: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_error_errno(r, "Failed to close netlink container: %m");
- r = sd_rtnl_call(rtnl, m, 0, NULL);
+ r = sd_netlink_call(rtnl, m, 0, NULL);
if (r < 0)
return log_error_errno(r, "Failed to add new veth interfaces (host0, %s): %m", iface_name);
@@ -2640,8 +2640,8 @@ static int setup_veth(pid_t pid, char iface_name[IFNAMSIZ], int *ifi) {
}
static int setup_bridge(const char veth_name[], int *ifi) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
int r, bridge;
if (!arg_private_network)
@@ -2659,7 +2659,7 @@ static int setup_bridge(const char veth_name[], int *ifi) {
*ifi = bridge;
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -2671,15 +2671,15 @@ static int setup_bridge(const char veth_name[], int *ifi) {
if (r < 0)
return log_error_errno(r, "Failed to set IFF_UP flag: %m");
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, veth_name);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, veth_name);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface name field: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_MASTER, bridge);
+ r = sd_netlink_message_append_u32(m, IFLA_MASTER, bridge);
if (r < 0)
return log_error_errno(r, "Failed to add netlink master field: %m");
- r = sd_rtnl_call(rtnl, m, 0, NULL);
+ r = sd_netlink_call(rtnl, m, 0, NULL);
if (r < 0)
return log_error_errno(r, "Failed to add veth interface to bridge: %m");
@@ -2710,7 +2710,7 @@ static int parse_interface(struct udev *udev, const char *name) {
static int move_network_interfaces(pid_t pid) {
_cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
char **i;
int r;
@@ -2720,7 +2720,7 @@ static int move_network_interfaces(pid_t pid) {
if (strv_isempty(arg_network_interfaces))
return 0;
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -2731,7 +2731,7 @@ static int move_network_interfaces(pid_t pid) {
}
STRV_FOREACH(i, arg_network_interfaces) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
int ifi;
ifi = parse_interface(udev, *i);
@@ -2742,11 +2742,11 @@ static int move_network_interfaces(pid_t pid) {
if (r < 0)
return log_error_errno(r, "Failed to allocate netlink message: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_NET_NS_PID, pid);
+ r = sd_netlink_message_append_u32(m, IFLA_NET_NS_PID, pid);
if (r < 0)
return log_error_errno(r, "Failed to append namespace PID to netlink message: %m");
- r = sd_rtnl_call(rtnl, m, 0, NULL);
+ r = sd_netlink_call(rtnl, m, 0, NULL);
if (r < 0)
return log_error_errno(r, "Failed to move interface %s to namespace: %m", *i);
}
@@ -2756,7 +2756,7 @@ static int move_network_interfaces(pid_t pid) {
static int setup_macvlan(pid_t pid) {
_cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
unsigned idx = 0;
char **i;
int r;
@@ -2767,7 +2767,7 @@ static int setup_macvlan(pid_t pid) {
if (strv_isempty(arg_network_macvlan))
return 0;
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -2778,7 +2778,7 @@ static int setup_macvlan(pid_t pid) {
}
STRV_FOREACH(i, arg_network_macvlan) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
_cleanup_free_ char *n = NULL;
struct ether_addr mac;
int ifi;
@@ -2795,7 +2795,7 @@ static int setup_macvlan(pid_t pid) {
if (r < 0)
return log_error_errno(r, "Failed to allocate netlink message: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_LINK, ifi);
+ r = sd_netlink_message_append_u32(m, IFLA_LINK, ifi);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface index: %m");
@@ -2805,39 +2805,39 @@ static int setup_macvlan(pid_t pid) {
strshorten(n, IFNAMSIZ-1);
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, n);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, n);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface name: %m");
- r = sd_rtnl_message_append_ether_addr(m, IFLA_ADDRESS, &mac);
+ r = sd_netlink_message_append_ether_addr(m, IFLA_ADDRESS, &mac);
if (r < 0)
return log_error_errno(r, "Failed to add netlink MAC address: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_NET_NS_PID, pid);
+ r = sd_netlink_message_append_u32(m, IFLA_NET_NS_PID, pid);
if (r < 0)
return log_error_errno(r, "Failed to add netlink namespace field: %m");
- r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
+ r = sd_netlink_message_open_container(m, IFLA_LINKINFO);
if (r < 0)
return log_error_errno(r, "Failed to open netlink container: %m");
- r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "macvlan");
+ r = sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, "macvlan");
if (r < 0)
return log_error_errno(r, "Failed to open netlink container: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_MACVLAN_MODE, MACVLAN_MODE_BRIDGE);
+ r = sd_netlink_message_append_u32(m, IFLA_MACVLAN_MODE, MACVLAN_MODE_BRIDGE);
if (r < 0)
return log_error_errno(r, "Failed to append macvlan mode: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_error_errno(r, "Failed to close netlink container: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_error_errno(r, "Failed to close netlink container: %m");
- r = sd_rtnl_call(rtnl, m, 0, NULL);
+ r = sd_netlink_call(rtnl, m, 0, NULL);
if (r < 0)
return log_error_errno(r, "Failed to add new macvlan interfaces: %m");
}
@@ -2847,7 +2847,7 @@ static int setup_macvlan(pid_t pid) {
static int setup_ipvlan(pid_t pid) {
_cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
char **i;
int r;
@@ -2857,7 +2857,7 @@ static int setup_ipvlan(pid_t pid) {
if (strv_isempty(arg_network_ipvlan))
return 0;
- r = sd_rtnl_open(&rtnl, 0);
+ r = sd_netlink_open(&rtnl);
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
@@ -2868,7 +2868,7 @@ static int setup_ipvlan(pid_t pid) {
}
STRV_FOREACH(i, arg_network_ipvlan) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ _cleanup_netlink_message_unref_ sd_netlink_message *m = NULL;
_cleanup_free_ char *n = NULL;
int ifi;
@@ -2880,7 +2880,7 @@ static int setup_ipvlan(pid_t pid) {
if (r < 0)
return log_error_errno(r, "Failed to allocate netlink message: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_LINK, ifi);
+ r = sd_netlink_message_append_u32(m, IFLA_LINK, ifi);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface index: %m");
@@ -2890,35 +2890,35 @@ static int setup_ipvlan(pid_t pid) {
strshorten(n, IFNAMSIZ-1);
- r = sd_rtnl_message_append_string(m, IFLA_IFNAME, n);
+ r = sd_netlink_message_append_string(m, IFLA_IFNAME, n);
if (r < 0)
return log_error_errno(r, "Failed to add netlink interface name: %m");
- r = sd_rtnl_message_append_u32(m, IFLA_NET_NS_PID, pid);
+ r = sd_netlink_message_append_u32(m, IFLA_NET_NS_PID, pid);
if (r < 0)
return log_error_errno(r, "Failed to add netlink namespace field: %m");
- r = sd_rtnl_message_open_container(m, IFLA_LINKINFO);
+ r = sd_netlink_message_open_container(m, IFLA_LINKINFO);
if (r < 0)
return log_error_errno(r, "Failed to open netlink container: %m");
- r = sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "ipvlan");
+ r = sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, "ipvlan");
if (r < 0)
return log_error_errno(r, "Failed to open netlink container: %m");
- r = sd_rtnl_message_append_u16(m, IFLA_IPVLAN_MODE, IPVLAN_MODE_L2);
+ r = sd_netlink_message_append_u16(m, IFLA_IPVLAN_MODE, IPVLAN_MODE_L2);
if (r < 0)
return log_error_errno(r, "Failed to add ipvlan mode: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_error_errno(r, "Failed to close netlink container: %m");
- r = sd_rtnl_message_close_container(m);
+ r = sd_netlink_message_close_container(m);
if (r < 0)
return log_error_errno(r, "Failed to close netlink container: %m");
- r = sd_rtnl_call(rtnl, m, 0, NULL);
+ r = sd_netlink_call(rtnl, m, 0, NULL);
if (r < 0)
return log_error_errno(r, "Failed to add new ipvlan interfaces: %m");
}
@@ -3002,8 +3002,15 @@ static int setup_seccomp(void) {
}
r = seccomp_load(seccomp);
- if (r < 0)
+ if (r == -EINVAL) {
+ log_debug_errno(r, "Kernel is probably not configured with CONFIG_SECCOMP. Disabling seccomp audit filter: %m");
+ r = 0;
+ goto finish;
+ }
+ if (r < 0) {
log_error_errno(r, "Failed to install seccomp audit filter: %m");
+ goto finish;
+ }
finish:
seccomp_release(seccomp);
@@ -4681,7 +4688,7 @@ int main(int argc, char *argv[]) {
ssize_t l;
_cleanup_event_unref_ sd_event *event = NULL;
_cleanup_(pty_forward_freep) PTYForward *forward = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
char last_char = 0;
r = barrier_create(&barrier);
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index 27d9129e00..ff8dc3a5bc 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -124,7 +124,7 @@ void link_add_rrs(Link *l, bool force_remove) {
link_address_add_rrs(a, force_remove);
}
-int link_update_rtnl(Link *l, sd_rtnl_message *m) {
+int link_update_rtnl(Link *l, sd_netlink_message *m) {
const char *n = NULL;
int r;
@@ -135,9 +135,9 @@ int link_update_rtnl(Link *l, sd_rtnl_message *m) {
if (r < 0)
return r;
- sd_rtnl_message_read_u32(m, IFLA_MTU, &l->mtu);
+ sd_netlink_message_read_u32(m, IFLA_MTU, &l->mtu);
- if (sd_rtnl_message_read_string(m, IFLA_IFNAME, &n) >= 0) {
+ if (sd_netlink_message_read_string(m, IFLA_IFNAME, &n) >= 0) {
strncpy(l->name, n, sizeof(l->name)-1);
char_array_0(l->name);
}
@@ -522,7 +522,7 @@ fail:
log_debug_errno(r, "Failed to update address RRs: %m");
}
-int link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m) {
+int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m) {
int r;
assert(a);
assert(m);
diff --git a/src/resolve/resolved-link.h b/src/resolve/resolved-link.h
index eee1846108..e3ab27c249 100644
--- a/src/resolve/resolved-link.h
+++ b/src/resolve/resolved-link.h
@@ -69,7 +69,7 @@ struct Link {
int link_new(Manager *m, Link **ret, int ifindex);
Link *link_free(Link *l);
-int link_update_rtnl(Link *l, sd_rtnl_message *m);
+int link_update_rtnl(Link *l, sd_netlink_message *m);
int link_update_monitor(Link *l);
bool link_relevant(Link *l, int family);
LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
@@ -82,7 +82,7 @@ void link_next_dns_server(Link *l);
int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
LinkAddress *link_address_free(LinkAddress *a);
-int link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m);
+int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m);
bool link_address_relevant(LinkAddress *l);
void link_address_add_rrs(LinkAddress *a, bool force_remove);
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index f8d4db7aad..dee5e61922 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -24,7 +24,7 @@
#include <poll.h>
#include <netinet/in.h>
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "network-internal.h"
#include "socket-util.h"
#include "af-list.h"
@@ -41,7 +41,7 @@
#define SEND_TIMEOUT_USEC (200 * USEC_PER_MSEC)
-static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
+static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
Manager *m = userdata;
uint16_t type;
Link *l;
@@ -51,7 +51,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda
assert(m);
assert(mm);
- r = sd_rtnl_message_get_type(mm, &type);
+ r = sd_netlink_message_get_type(mm, &type);
if (r < 0)
goto fail;
@@ -102,7 +102,7 @@ fail:
return 0;
}
-static int manager_process_address(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userdata) {
+static int manager_process_address(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
Manager *m = userdata;
union in_addr_union address;
uint16_t type;
@@ -114,7 +114,7 @@ static int manager_process_address(sd_rtnl *rtnl, sd_rtnl_message *mm, void *use
assert(mm);
assert(m);
- r = sd_rtnl_message_get_type(mm, &type);
+ r = sd_netlink_message_get_type(mm, &type);
if (r < 0)
goto fail;
@@ -133,9 +133,9 @@ static int manager_process_address(sd_rtnl *rtnl, sd_rtnl_message *mm, void *use
switch (family) {
case AF_INET:
- r = sd_rtnl_message_read_in_addr(mm, IFA_LOCAL, &address.in);
+ r = sd_netlink_message_read_in_addr(mm, IFA_LOCAL, &address.in);
if (r < 0) {
- r = sd_rtnl_message_read_in_addr(mm, IFA_ADDRESS, &address.in);
+ r = sd_netlink_message_read_in_addr(mm, IFA_ADDRESS, &address.in);
if (r < 0)
goto fail;
}
@@ -143,9 +143,9 @@ static int manager_process_address(sd_rtnl *rtnl, sd_rtnl_message *mm, void *use
break;
case AF_INET6:
- r = sd_rtnl_message_read_in6_addr(mm, IFA_LOCAL, &address.in6);
+ r = sd_netlink_message_read_in6_addr(mm, IFA_LOCAL, &address.in6);
if (r < 0) {
- r = sd_rtnl_message_read_in6_addr(mm, IFA_ADDRESS, &address.in6);
+ r = sd_netlink_message_read_in6_addr(mm, IFA_ADDRESS, &address.in6);
if (r < 0)
goto fail;
}
@@ -188,34 +188,34 @@ fail:
}
static int manager_rtnl_listen(Manager *m) {
- _cleanup_rtnl_message_unref_ sd_rtnl_message *req = NULL, *reply = NULL;
- sd_rtnl_message *i;
+ _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+ sd_netlink_message *i;
int r;
assert(m);
/* First, subscribe to interfaces coming and going */
- r = sd_rtnl_open(&m->rtnl, 3, RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR, RTNLGRP_IPV6_IFADDR);
+ r = sd_netlink_open(&m->rtnl);
if (r < 0)
return r;
- r = sd_rtnl_attach_event(m->rtnl, m->event, 0);
+ r = sd_netlink_attach_event(m->rtnl, m->event, 0);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWLINK, manager_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWLINK, manager_process_link, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELLINK, manager_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELLINK, manager_process_link, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_NEWADDR, manager_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_NEWADDR, manager_process_address, m);
if (r < 0)
return r;
- r = sd_rtnl_add_match(m->rtnl, RTM_DELADDR, manager_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, RTM_DELADDR, manager_process_address, m);
if (r < 0)
return r;
@@ -224,37 +224,37 @@ static int manager_rtnl_listen(Manager *m) {
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (i = reply; i; i = sd_rtnl_message_next(i)) {
+ for (i = reply; i; i = sd_netlink_message_next(i)) {
r = manager_process_link(m->rtnl, i, m);
if (r < 0)
return r;
}
- req = sd_rtnl_message_unref(req);
- reply = sd_rtnl_message_unref(reply);
+ req = sd_netlink_message_unref(req);
+ reply = sd_netlink_message_unref(reply);
/* Finally, enumerate all addresses, too */
r = sd_rtnl_message_new_addr(m->rtnl, &req, RTM_GETADDR, 0, AF_UNSPEC);
if (r < 0)
return r;
- r = sd_rtnl_message_request_dump(req, true);
+ r = sd_netlink_message_request_dump(req, true);
if (r < 0)
return r;
- r = sd_rtnl_call(m->rtnl, req, 0, &reply);
+ r = sd_netlink_call(m->rtnl, req, 0, &reply);
if (r < 0)
return r;
- for (i = reply; i; i = sd_rtnl_message_next(i)) {
+ for (i = reply; i; i = sd_netlink_message_next(i)) {
r = manager_process_address(m->rtnl, i, m);
if (r < 0)
return r;
diff --git a/src/resolve/resolved-manager.h b/src/resolve/resolved-manager.h
index 5a581cc13a..0f4ffad141 100644
--- a/src/resolve/resolved-manager.h
+++ b/src/resolve/resolved-manager.h
@@ -23,7 +23,7 @@
#include "sd-event.h"
#include "sd-network.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "list.h"
#include "hashmap.h"
@@ -50,7 +50,7 @@ struct Manager {
/* Network */
Hashmap *links;
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
sd_event_source *rtnl_event_source;
sd_network_monitor *network_monitor;
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/shared/bus-util.c
index 99937799b3..8fcc289957 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/shared/bus-util.c
@@ -1330,31 +1330,6 @@ int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
&u->job_path);
}
-int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error) {
- assert(m);
-
- if (r < 0) {
- if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL)
- sd_bus_reply_method_errno(m, r, error);
-
- } else if (sd_bus_error_is_set(error)) {
- if (m->header->type == SD_BUS_MESSAGE_METHOD_CALL)
- sd_bus_reply_method_error(m, error);
- } else
- return r;
-
- log_debug("Failed to process message [type=%s sender=%s path=%s interface=%s member=%s signature=%s]: %s",
- bus_message_type_to_string(m->header->type),
- strna(m->sender),
- strna(m->path),
- strna(m->interface),
- strna(m->member),
- strna(m->root_container.signature),
- bus_error_message(error, r));
-
- return 1;
-}
-
int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignment) {
const char *eq, *field;
int r;
diff --git a/src/libsystemd/sd-bus/bus-util.h b/src/shared/bus-util.h
index 999a372cdd..d8dba584d6 100644
--- a/src/libsystemd/sd-bus/bus-util.h
+++ b/src/shared/bus-util.h
@@ -188,8 +188,6 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_track*, sd_bus_track_unref);
SD_BUS_PROPERTY(name, "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, realtime), (flags)), \
SD_BUS_PROPERTY(name "Monotonic", "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, monotonic), (flags))
-int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
-
int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignment);
typedef struct BusWaitForJobs BusWaitForJobs;
diff --git a/src/shared/fw-util.c b/src/shared/firewall-util.c
index 6b3599d90d..effc6e8e70 100644
--- a/src/shared/fw-util.c
+++ b/src/shared/firewall-util.c
@@ -28,7 +28,7 @@
#include <libiptc/libiptc.h>
#include "util.h"
-#include "fw-util.h"
+#include "firewall-util.h"
DEFINE_TRIVIAL_CLEANUP_FUNC(struct xtc_handle*, iptc_free);
diff --git a/src/shared/fw-util.h b/src/shared/firewall-util.h
index 93152e3978..93152e3978 100644
--- a/src/shared/fw-util.h
+++ b/src/shared/firewall-util.h
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 5075e4e176..a2eb435fce 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1678,17 +1678,23 @@ static const struct bus_properties_map machine_info_property_map[] = {
{}
};
+static void machine_info_clear(struct machine_info *info) {
+ if (info) {
+ free(info->name);
+ free(info->state);
+ free(info->control_group);
+ zero(*info);
+ }
+}
+
static void free_machines_list(struct machine_info *machine_infos, int n) {
int i;
if (!machine_infos)
return;
- for (i = 0; i < n; i++) {
- free(machine_infos[i].name);
- free(machine_infos[i].state);
- free(machine_infos[i].control_group);
- }
+ for (i = 0; i < n; i++)
+ machine_info_clear(&machine_infos[i]);
free(machine_infos);
}
@@ -4402,7 +4408,7 @@ static int show_all(
static int show_system_status(sd_bus *bus) {
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], since2[FORMAT_TIMESTAMP_MAX];
_cleanup_free_ char *hn = NULL;
- struct machine_info mi = {};
+ _cleanup_(machine_info_clear) struct machine_info mi = {};
const char *on, *off;
int r;
@@ -4449,9 +4455,6 @@ static int show_system_status(sd_bus *bus) {
show_cgroup(SYSTEMD_CGROUP_CONTROLLER, strempty(mi.control_group), prefix, c, false, get_output_flags());
}
- free(mi.state);
- free(mi.control_group);
-
return 0;
}
diff --git a/src/systemd/sd-netlink.h b/src/systemd/sd-netlink.h
new file mode 100644
index 0000000000..24a9ed8e77
--- /dev/null
+++ b/src/systemd/sd-netlink.h
@@ -0,0 +1,150 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#ifndef foosdnetlinkhfoo
+#define foosdnetlinkhfoo
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Tom Gundersen <teg@jklm.no>
+
+ systemd 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.1 of the License, or
+ (at your option) any later version.
+
+ systemd 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+#include <netinet/in.h>
+#include <netinet/ether.h>
+#include <linux/rtnetlink.h>
+#include <linux/neighbour.h>
+
+#include "sd-event.h"
+#include "_sd-common.h"
+
+_SD_BEGIN_DECLARATIONS;
+
+typedef struct sd_netlink sd_netlink;
+typedef struct sd_netlink_message sd_netlink_message;
+
+/* callback */
+
+typedef int (*sd_netlink_message_handler_t)(sd_netlink *nl, sd_netlink_message *m, void *userdata);
+
+/* bus */
+int sd_netlink_new_from_netlink(sd_netlink **nl, int fd);
+int sd_netlink_open(sd_netlink **nl);
+int sd_netlink_open_fd(sd_netlink **nl, int fd);
+int sd_netlink_inc_rcvbuf(const sd_netlink *const rtnl, const int size);
+
+sd_netlink *sd_netlink_ref(sd_netlink *nl);
+sd_netlink *sd_netlink_unref(sd_netlink *nl);
+
+int sd_netlink_send(sd_netlink *nl, sd_netlink_message *message, uint32_t *serial);
+int sd_netlink_call_async(sd_netlink *nl, sd_netlink_message *message,
+ sd_netlink_message_handler_t callback,
+ void *userdata, uint64_t usec, uint32_t *serial);
+int sd_netlink_call_async_cancel(sd_netlink *nl, uint32_t serial);
+int sd_netlink_call(sd_netlink *nl, sd_netlink_message *message, uint64_t timeout,
+ sd_netlink_message **reply);
+
+int sd_netlink_get_events(sd_netlink *nl);
+int sd_netlink_get_timeout(sd_netlink *nl, uint64_t *timeout);
+int sd_netlink_process(sd_netlink *nl, sd_netlink_message **ret);
+int sd_netlink_wait(sd_netlink *nl, uint64_t timeout);
+
+int sd_netlink_add_match(sd_netlink *nl, uint16_t match, sd_netlink_message_handler_t c, void *userdata);
+int sd_netlink_remove_match(sd_netlink *nl, uint16_t match, sd_netlink_message_handler_t c, void *userdata);
+
+int sd_netlink_attach_event(sd_netlink *nl, sd_event *e, int priority);
+int sd_netlink_detach_event(sd_netlink *nl);
+
+int sd_netlink_message_append_string(sd_netlink_message *m, unsigned short type, const char *data);
+int sd_netlink_message_append_u8(sd_netlink_message *m, unsigned short type, uint8_t data);
+int sd_netlink_message_append_u16(sd_netlink_message *m, unsigned short type, uint16_t data);
+int sd_netlink_message_append_u32(sd_netlink_message *m, unsigned short type, uint32_t data);
+int sd_netlink_message_append_in_addr(sd_netlink_message *m, unsigned short type, const struct in_addr *data);
+int sd_netlink_message_append_in6_addr(sd_netlink_message *m, unsigned short type, const struct in6_addr *data);
+int sd_netlink_message_append_ether_addr(sd_netlink_message *m, unsigned short type, const struct ether_addr *data);
+int sd_netlink_message_append_cache_info(sd_netlink_message *m, unsigned short type, const struct ifa_cacheinfo *info);
+
+int sd_netlink_message_open_container(sd_netlink_message *m, unsigned short type);
+int sd_netlink_message_open_container_union(sd_netlink_message *m, unsigned short type, const char *key);
+int sd_netlink_message_close_container(sd_netlink_message *m);
+
+int sd_netlink_message_read_string(sd_netlink_message *m, unsigned short type, const char **data);
+int sd_netlink_message_read_u8(sd_netlink_message *m, unsigned short type, uint8_t *data);
+int sd_netlink_message_read_u16(sd_netlink_message *m, unsigned short type, uint16_t *data);
+int sd_netlink_message_read_u32(sd_netlink_message *m, unsigned short type, uint32_t *data);
+int sd_netlink_message_read_ether_addr(sd_netlink_message *m, unsigned short type, struct ether_addr *data);
+int sd_netlink_message_read_cache_info(sd_netlink_message *m, unsigned short type, struct ifa_cacheinfo *info);
+int sd_netlink_message_read_in_addr(sd_netlink_message *m, unsigned short type, struct in_addr *data);
+int sd_netlink_message_read_in6_addr(sd_netlink_message *m, unsigned short type, struct in6_addr *data);
+int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short type);
+int sd_netlink_message_exit_container(sd_netlink_message *m);
+
+int sd_netlink_message_rewind(sd_netlink_message *m);
+
+sd_netlink_message *sd_netlink_message_next(sd_netlink_message *m);
+
+sd_netlink_message *sd_netlink_message_ref(sd_netlink_message *m);
+sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m);
+
+int sd_netlink_message_request_dump(sd_netlink_message *m, int dump);
+int sd_netlink_message_is_error(sd_netlink_message *m);
+int sd_netlink_message_get_errno(sd_netlink_message *m);
+int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type);
+int sd_netlink_message_is_broadcast(sd_netlink_message *m);
+
+/* rtnl */
+
+int sd_rtnl_message_new_link(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index);
+int sd_rtnl_message_new_addr_update(sd_netlink *nl, sd_netlink_message **ret, int index, int family);
+int sd_rtnl_message_new_addr(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int family);
+int sd_rtnl_message_new_route(sd_netlink *nl, sd_netlink_message **ret, uint16_t nlmsg_type, int rtm_family, unsigned char rtm_protocol);
+int sd_rtnl_message_new_neigh(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int nda_family);
+
+int sd_rtnl_message_get_family(sd_netlink_message *m, int *family);
+
+int sd_rtnl_message_addr_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
+int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope);
+int sd_rtnl_message_addr_set_flags(sd_netlink_message *m, unsigned char flags);
+int sd_rtnl_message_addr_get_family(sd_netlink_message *m, int *family);
+int sd_rtnl_message_addr_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen);
+int sd_rtnl_message_addr_get_scope(sd_netlink_message *m, unsigned char *scope);
+int sd_rtnl_message_addr_get_flags(sd_netlink_message *m, unsigned char *flags);
+int sd_rtnl_message_addr_get_ifindex(sd_netlink_message *m, int *ifindex);
+
+int sd_rtnl_message_link_set_flags(sd_netlink_message *m, unsigned flags, unsigned change);
+int sd_rtnl_message_link_set_type(sd_netlink_message *m, unsigned type);
+int sd_rtnl_message_link_set_family(sd_netlink_message *m, unsigned family);
+int sd_rtnl_message_link_get_ifindex(sd_netlink_message *m, int *ifindex);
+int sd_rtnl_message_link_get_flags(sd_netlink_message *m, unsigned *flags);
+int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned *type);
+
+int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
+int sd_rtnl_message_route_set_src_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
+int sd_rtnl_message_route_set_scope(sd_netlink_message *m, unsigned char scope);
+int sd_rtnl_message_route_get_family(sd_netlink_message *m, int *family);
+int sd_rtnl_message_route_get_dst_prefixlen(sd_netlink_message *m, unsigned char *dst_len);
+int sd_rtnl_message_route_get_src_prefixlen(sd_netlink_message *m, unsigned char *src_len);
+
+int sd_rtnl_message_neigh_set_flags(sd_netlink_message *m, uint8_t flags);
+int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state);
+int sd_rtnl_message_neigh_get_family(sd_netlink_message *m, int *family);
+int sd_rtnl_message_neigh_get_ifindex(sd_netlink_message *m, int *family);
+int sd_rtnl_message_neigh_get_state(sd_netlink_message *m, uint16_t *state);
+int sd_rtnl_message_neigh_get_flags(sd_netlink_message *m, uint8_t *flags);
+
+_SD_END_DECLARATIONS;
+
+#endif
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
deleted file mode 100644
index be318e58a8..0000000000
--- a/src/systemd/sd-rtnl.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#ifndef foosdrtnlhfoo
-#define foosdrtnlhfoo
-
-/***
- This file is part of systemd.
-
- Copyright 2013 Tom Gundersen <teg@jklm.no>
-
- systemd 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.1 of the License, or
- (at your option) any later version.
-
- systemd 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <inttypes.h>
-#include <netinet/in.h>
-#include <netinet/ether.h>
-#include <linux/rtnetlink.h>
-#include <linux/neighbour.h>
-
-#include "sd-event.h"
-#include "_sd-common.h"
-
-_SD_BEGIN_DECLARATIONS;
-
-typedef struct sd_rtnl sd_rtnl;
-typedef struct sd_rtnl_message sd_rtnl_message;
-
-/* callback */
-
-typedef int (*sd_rtnl_message_handler_t)(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata);
-
-/* bus */
-int sd_rtnl_new_from_netlink(sd_rtnl **nl, int fd);
-int sd_rtnl_open(sd_rtnl **nl, unsigned n_groups, ...);
-int sd_rtnl_open_fd(sd_rtnl **nl, int fd, unsigned n_groups, ...);
-int sd_rtnl_inc_rcvbuf(const sd_rtnl *const rtnl, const int size);
-
-sd_rtnl *sd_rtnl_ref(sd_rtnl *nl);
-sd_rtnl *sd_rtnl_unref(sd_rtnl *nl);
-
-int sd_rtnl_send(sd_rtnl *nl, sd_rtnl_message *message, uint32_t *serial);
-int sd_rtnl_call_async(sd_rtnl *nl, sd_rtnl_message *message,
- sd_rtnl_message_handler_t callback,
- void *userdata, uint64_t usec, uint32_t *serial);
-int sd_rtnl_call_async_cancel(sd_rtnl *nl, uint32_t serial);
-int sd_rtnl_call(sd_rtnl *nl, sd_rtnl_message *message, uint64_t timeout,
- sd_rtnl_message **reply);
-
-
-int sd_rtnl_get_events(sd_rtnl *nl);
-int sd_rtnl_get_timeout(sd_rtnl *nl, uint64_t *timeout);
-int sd_rtnl_process(sd_rtnl *nl, sd_rtnl_message **ret);
-int sd_rtnl_wait(sd_rtnl *nl, uint64_t timeout);
-int sd_rtnl_flush(sd_rtnl *nl);
-
-int sd_rtnl_add_match(sd_rtnl *nl, uint16_t match, sd_rtnl_message_handler_t c, void *userdata);
-int sd_rtnl_remove_match(sd_rtnl *nl, uint16_t match, sd_rtnl_message_handler_t c, void *userdata);
-
-int sd_rtnl_attach_event(sd_rtnl *nl, sd_event *e, int priority);
-int sd_rtnl_detach_event(sd_rtnl *nl);
-
-/* messages */
-int sd_rtnl_message_new_link(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t msg_type, int index);
-int sd_rtnl_message_new_addr_update(sd_rtnl *rtnl, sd_rtnl_message **ret, int index, int family);
-int sd_rtnl_message_new_addr(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t msg_type, int index,
- int family);
-int sd_rtnl_message_new_route(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t nlmsg_type,
- int rtm_family, unsigned char rtm_protocol);
-int sd_rtnl_message_new_neigh(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t msg_type, int index, int nda_family);
-
-sd_rtnl_message *sd_rtnl_message_ref(sd_rtnl_message *m);
-sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m);
-
-int sd_rtnl_message_request_dump(sd_rtnl_message *m, int dump);
-int sd_rtnl_message_is_error(sd_rtnl_message *m);
-int sd_rtnl_message_get_errno(sd_rtnl_message *m);
-int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type);
-int sd_rtnl_message_is_broadcast(sd_rtnl_message *m);
-
-int sd_rtnl_message_get_family(sd_rtnl_message *m, int *family);
-
-int sd_rtnl_message_addr_set_prefixlen(sd_rtnl_message *m, unsigned char prefixlen);
-int sd_rtnl_message_addr_set_scope(sd_rtnl_message *m, unsigned char scope);
-int sd_rtnl_message_addr_set_flags(sd_rtnl_message *m, unsigned char flags);
-int sd_rtnl_message_addr_get_family(sd_rtnl_message *m, int *family);
-int sd_rtnl_message_addr_get_prefixlen(sd_rtnl_message *m, unsigned char *prefixlen);
-int sd_rtnl_message_addr_get_scope(sd_rtnl_message *m, unsigned char *scope);
-int sd_rtnl_message_addr_get_flags(sd_rtnl_message *m, unsigned char *flags);
-int sd_rtnl_message_addr_get_ifindex(sd_rtnl_message *m, int *ifindex);
-
-int sd_rtnl_message_link_set_flags(sd_rtnl_message *m, unsigned flags, unsigned change);
-int sd_rtnl_message_link_set_type(sd_rtnl_message *m, unsigned type);
-int sd_rtnl_message_link_set_family(sd_rtnl_message *m, unsigned family);
-int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex);
-int sd_rtnl_message_link_get_flags(sd_rtnl_message *m, unsigned *flags);
-int sd_rtnl_message_link_get_type(sd_rtnl_message *m, unsigned *type);
-
-int sd_rtnl_message_route_set_dst_prefixlen(sd_rtnl_message *m, unsigned char prefixlen);
-int sd_rtnl_message_route_set_src_prefixlen(sd_rtnl_message *m, unsigned char prefixlen);
-int sd_rtnl_message_route_set_scope(sd_rtnl_message *m, unsigned char scope);
-int sd_rtnl_message_route_get_family(sd_rtnl_message *m, int *family);
-int sd_rtnl_message_route_get_dst_prefixlen(sd_rtnl_message *m, unsigned char *dst_len);
-int sd_rtnl_message_route_get_src_prefixlen(sd_rtnl_message *m, unsigned char *src_len);
-
-int sd_rtnl_message_neigh_set_flags(sd_rtnl_message *m, uint8_t flags);
-int sd_rtnl_message_neigh_set_state(sd_rtnl_message *m, uint16_t state);
-int sd_rtnl_message_neigh_get_family(sd_rtnl_message *m, int *family);
-int sd_rtnl_message_neigh_get_ifindex(sd_rtnl_message *m, int *family);
-int sd_rtnl_message_neigh_get_state(sd_rtnl_message *m, uint16_t *state);
-int sd_rtnl_message_neigh_get_flags(sd_rtnl_message *m, uint8_t *flags);
-
-int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const char *data);
-int sd_rtnl_message_append_u8(sd_rtnl_message *m, unsigned short type, uint8_t data);
-int sd_rtnl_message_append_u16(sd_rtnl_message *m, unsigned short type, uint16_t data);
-int sd_rtnl_message_append_u32(sd_rtnl_message *m, unsigned short type, uint32_t data);
-int sd_rtnl_message_append_in_addr(sd_rtnl_message *m, unsigned short type, const struct in_addr *data);
-int sd_rtnl_message_append_in6_addr(sd_rtnl_message *m, unsigned short type, const struct in6_addr *data);
-int sd_rtnl_message_append_ether_addr(sd_rtnl_message *m, unsigned short type, const struct ether_addr *data);
-int sd_rtnl_message_append_cache_info(sd_rtnl_message *m, unsigned short type, const struct ifa_cacheinfo *info);
-
-int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type);
-int sd_rtnl_message_open_container_union(sd_rtnl_message *m, unsigned short type, const char *key);
-int sd_rtnl_message_close_container(sd_rtnl_message *m);
-
-int sd_rtnl_message_read_string(sd_rtnl_message *m, unsigned short type, const char **data);
-int sd_rtnl_message_read_u8(sd_rtnl_message *m, unsigned short type, uint8_t *data);
-int sd_rtnl_message_read_u16(sd_rtnl_message *m, unsigned short type, uint16_t *data);
-int sd_rtnl_message_read_u32(sd_rtnl_message *m, unsigned short type, uint32_t *data);
-int sd_rtnl_message_read_ether_addr(sd_rtnl_message *m, unsigned short type, struct ether_addr *data);
-int sd_rtnl_message_read_cache_info(sd_rtnl_message *m, unsigned short type, struct ifa_cacheinfo *info);
-int sd_rtnl_message_read_in_addr(sd_rtnl_message *m, unsigned short type, struct in_addr *data);
-int sd_rtnl_message_read_in6_addr(sd_rtnl_message *m, unsigned short type, struct in6_addr *data);
-int sd_rtnl_message_enter_container(sd_rtnl_message *m, unsigned short type);
-int sd_rtnl_message_exit_container(sd_rtnl_message *m);
-
-int sd_rtnl_message_rewind(sd_rtnl_message *m);
-
-sd_rtnl_message *sd_rtnl_message_next(sd_rtnl_message *m);
-
-_SD_END_DECLARATIONS;
-
-#endif
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index 4a89f64518..ecc9d70bf4 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -244,16 +244,16 @@ static void test_escape(void) {
}
static void test_controller_is_valid(void) {
- assert_se(cg_controller_is_valid("foobar", false));
- assert_se(cg_controller_is_valid("foo_bar", false));
- assert_se(cg_controller_is_valid("name=foo", true));
- assert_se(!cg_controller_is_valid("", false));
- assert_se(!cg_controller_is_valid("name=", true));
- assert_se(!cg_controller_is_valid("=", false));
- assert_se(!cg_controller_is_valid("cpu,cpuacct", false));
- assert_se(!cg_controller_is_valid("_", false));
- assert_se(!cg_controller_is_valid("_foobar", false));
- assert_se(!cg_controller_is_valid("tatü", false));
+ assert_se(cg_controller_is_valid("foobar"));
+ assert_se(cg_controller_is_valid("foo_bar"));
+ assert_se(cg_controller_is_valid("name=foo"));
+ assert_se(!cg_controller_is_valid(""));
+ assert_se(!cg_controller_is_valid("name="));
+ assert_se(!cg_controller_is_valid("="));
+ assert_se(!cg_controller_is_valid("cpu,cpuacct"));
+ assert_se(!cg_controller_is_valid("_"));
+ assert_se(!cg_controller_is_valid("_foobar"));
+ assert_se(!cg_controller_is_valid("tatü"));
}
static void test_slice_to_path_one(const char *unit, const char *path, int error) {
diff --git a/src/test/test-fw-util.c b/src/test/test-firewall-util.c
index ab891aa0c4..d636e427c4 100644
--- a/src/test/test-fw-util.c
+++ b/src/test/test-firewall-util.c
@@ -20,7 +20,7 @@
***/
#include "log.h"
-#include "fw-util.h"
+#include "firewall-util.h"
#define MAKE_IN_ADDR_UNION(a,b,c,d) (union in_addr_union) { .in.s_addr = htobe32((uint32_t) (a) << 24 | (uint32_t) (b) << 16 | (uint32_t) (c) << 8 | (uint32_t) (d))}
diff --git a/src/test/test-rtnl-manual.c b/src/test/test-netlink-manual.c
index c406454f77..2879d7450f 100644
--- a/src/test/test-rtnl-manual.c
+++ b/src/test/test-netlink-manual.c
@@ -27,7 +27,7 @@
#include "util.h"
#include "macro.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
static int load_module(const char *mod_name) {
struct kmod_ctx *ctx;
@@ -62,9 +62,9 @@ static int load_module(const char *mod_name) {
return r;
}
-static int test_tunnel_configure(sd_rtnl *rtnl) {
+static int test_tunnel_configure(sd_netlink *rtnl) {
int r;
- sd_rtnl_message *m, *n;
+ sd_netlink_message *m, *n;
struct in_addr local, remote;
/* skip test if module cannot be loaded */
@@ -79,25 +79,25 @@ static int test_tunnel_configure(sd_rtnl *rtnl) {
assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_NEWLINK, 0) >= 0);
assert_se(m);
- assert_se(sd_rtnl_message_append_string(m, IFLA_IFNAME, "ipip-tunnel") >= 0);
- assert_se(sd_rtnl_message_append_u32(m, IFLA_MTU, 1234)>= 0);
+ assert_se(sd_netlink_message_append_string(m, IFLA_IFNAME, "ipip-tunnel") >= 0);
+ assert_se(sd_netlink_message_append_u32(m, IFLA_MTU, 1234)>= 0);
- assert_se(sd_rtnl_message_open_container(m, IFLA_LINKINFO) >= 0);
+ assert_se(sd_netlink_message_open_container(m, IFLA_LINKINFO) >= 0);
- assert_se(sd_rtnl_message_open_container_union(m, IFLA_INFO_DATA, "ipip") >= 0);
+ assert_se(sd_netlink_message_open_container_union(m, IFLA_INFO_DATA, "ipip") >= 0);
inet_pton(AF_INET, "192.168.21.1", &local.s_addr);
- assert_se(sd_rtnl_message_append_u32(m, IFLA_IPTUN_LOCAL, local.s_addr) >= 0);
+ assert_se(sd_netlink_message_append_u32(m, IFLA_IPTUN_LOCAL, local.s_addr) >= 0);
inet_pton(AF_INET, "192.168.21.2", &remote.s_addr);
- assert_se(sd_rtnl_message_append_u32(m, IFLA_IPTUN_REMOTE, remote.s_addr) >= 0);
+ assert_se(sd_netlink_message_append_u32(m, IFLA_IPTUN_REMOTE, remote.s_addr) >= 0);
- assert_se(sd_rtnl_message_close_container(m) >= 0);
- assert_se(sd_rtnl_message_close_container(m) >= 0);
+ assert_se(sd_netlink_message_close_container(m) >= 0);
+ assert_se(sd_netlink_message_close_container(m) >= 0);
- assert_se(sd_rtnl_call(rtnl, m, -1, 0) == 1);
+ assert_se(sd_netlink_call(rtnl, m, -1, 0) == 1);
- assert_se((m = sd_rtnl_message_unref(m)) == NULL);
+ assert_se((m = sd_netlink_message_unref(m)) == NULL);
r = load_module("sit");
if(r < 0)
@@ -107,41 +107,41 @@ static int test_tunnel_configure(sd_rtnl *rtnl) {
assert_se(sd_rtnl_message_new_link(rtnl, &n, RTM_NEWLINK, 0) >= 0);
assert_se(n);
- assert_se(sd_rtnl_message_append_string(n, IFLA_IFNAME, "sit-tunnel") >= 0);
- assert_se(sd_rtnl_message_append_u32(n, IFLA_MTU, 1234)>= 0);
+ assert_se(sd_netlink_message_append_string(n, IFLA_IFNAME, "sit-tunnel") >= 0);
+ assert_se(sd_netlink_message_append_u32(n, IFLA_MTU, 1234)>= 0);
- assert_se(sd_rtnl_message_open_container(n, IFLA_LINKINFO) >= 0);
+ assert_se(sd_netlink_message_open_container(n, IFLA_LINKINFO) >= 0);
- assert_se(sd_rtnl_message_open_container_union(n, IFLA_INFO_DATA, "sit") >= 0);
+ assert_se(sd_netlink_message_open_container_union(n, IFLA_INFO_DATA, "sit") >= 0);
- assert_se(sd_rtnl_message_append_u8(n, IFLA_IPTUN_PROTO, IPPROTO_IPIP) >= 0);
+ assert_se(sd_netlink_message_append_u8(n, IFLA_IPTUN_PROTO, IPPROTO_IPIP) >= 0);
inet_pton(AF_INET, "192.168.21.3", &local.s_addr);
- assert_se(sd_rtnl_message_append_u32(n, IFLA_IPTUN_LOCAL, local.s_addr) >= 0);
+ assert_se(sd_netlink_message_append_u32(n, IFLA_IPTUN_LOCAL, local.s_addr) >= 0);
inet_pton(AF_INET, "192.168.21.4", &remote.s_addr);
- assert_se(sd_rtnl_message_append_u32(n, IFLA_IPTUN_REMOTE, remote.s_addr) >= 0);
+ assert_se(sd_netlink_message_append_u32(n, IFLA_IPTUN_REMOTE, remote.s_addr) >= 0);
- assert_se(sd_rtnl_message_close_container(n) >= 0);
- assert_se(sd_rtnl_message_close_container(n) >= 0);
+ assert_se(sd_netlink_message_close_container(n) >= 0);
+ assert_se(sd_netlink_message_close_container(n) >= 0);
- assert_se(sd_rtnl_call(rtnl, n, -1, 0) == 1);
+ assert_se(sd_netlink_call(rtnl, n, -1, 0) == 1);
- assert_se((m = sd_rtnl_message_unref(n)) == NULL);
+ assert_se((n = sd_netlink_message_unref(n)) == NULL);
return EXIT_SUCCESS;
}
int main(int argc, char *argv[]) {
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
int r;
- assert_se(sd_rtnl_open(&rtnl, 0) >= 0);
+ assert_se(sd_netlink_open(&rtnl) >= 0);
assert_se(rtnl);
r = test_tunnel_configure(rtnl);
- assert_se((rtnl = sd_rtnl_unref(rtnl)) == NULL);
+ assert_se((rtnl = sd_netlink_unref(rtnl)) == NULL);
return r;
}
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 61b6e765c7..195d5f3892 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -73,6 +73,13 @@ typedef struct StatusInfo {
bool ntp_synced;
} StatusInfo;
+static void status_info_clear(StatusInfo *info) {
+ if (info) {
+ free(info->timezone);
+ zero(*info);
+ }
+}
+
static void print_status_info(const StatusInfo *i) {
char a[FORMAT_TIMESTAMP_MAX];
struct tm tm;
@@ -155,7 +162,7 @@ static void print_status_info(const StatusInfo *i) {
}
static int show_status(sd_bus *bus, char **args, unsigned n) {
- StatusInfo info = {};
+ _cleanup_(status_info_clear) StatusInfo info = {};
static const struct bus_properties_map map[] = {
{ "Timezone", "s", NULL, offsetof(StatusInfo, timezone) },
{ "LocalRTC", "b", NULL, offsetof(StatusInfo, rtc_local) },
@@ -175,15 +182,11 @@ static int show_status(sd_bus *bus, char **args, unsigned n) {
"/org/freedesktop/timedate1",
map,
&info);
- if (r < 0) {
- log_error_errno(r, "Failed to query server: %m");
- goto fail;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to query server: %m");
print_status_info(&info);
-fail:
- free(info.timezone);
return r;
}
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 5610b2808e..63e54db56e 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -28,14 +28,14 @@
#include "ethtool-util.h"
#include "libudev-private.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "util.h"
#include "log.h"
#include "strv.h"
#include "path-util.h"
#include "conf-parser.h"
#include "conf-files.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "network-internal.h"
#include "random-util.h"
@@ -46,7 +46,7 @@ struct link_config_ctx {
bool enable_name_policy;
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
usec_t link_dirs_ts_usec;
};
@@ -103,7 +103,7 @@ void link_config_ctx_free(link_config_ctx *ctx) {
safe_close(ctx->ethtool_fd);
- sd_rtnl_unref(ctx->rtnl);
+ sd_netlink_unref(ctx->rtnl);
link_configs_free(ctx);
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 8d17c5e1e3..5516a792eb 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -30,7 +30,7 @@
#include <sys/wait.h>
#include <sys/signalfd.h>
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "event-util.h"
#include "formats-util.h"
#include "process-util.h"
@@ -42,6 +42,7 @@ typedef struct Spawn {
pid_t pid;
usec_t timeout_warn;
usec_t timeout;
+ bool accept_failure;
} Spawn;
struct udev_event *udev_event_new(struct udev_device *dev) {
@@ -62,7 +63,7 @@ struct udev_event *udev_event_new(struct udev_device *dev) {
void udev_event_unref(struct udev_event *event) {
if (event == NULL)
return;
- sd_rtnl_unref(event->rtnl);
+ sd_netlink_unref(event->rtnl);
udev_list_cleanup(&event->run_list);
udev_list_cleanup(&event->seclabel_list);
free(event->program_result);
@@ -583,23 +584,24 @@ static int on_spawn_sigchld(sd_event_source *s, const siginfo_t *si, void *userd
switch (si->si_code) {
case CLD_EXITED:
- if (si->si_status != 0)
- log_warning("process '%s' failed with exit code %i.", spawn->cmd, si->si_status);
- else {
- log_debug("process '%s' succeeded.", spawn->cmd);
+ if (si->si_status == 0) {
+ log_debug("Process '%s' succeeded.", spawn->cmd);
sd_event_exit(sd_event_source_get_event(s), 0);
return 1;
- }
+ } else if (spawn->accept_failure)
+ log_debug("Process '%s' failed with exit code %i.", spawn->cmd, si->si_status);
+ else
+ log_warning("Process '%s' failed with exit code %i.", spawn->cmd, si->si_status);
break;
case CLD_KILLED:
case CLD_DUMPED:
- log_warning("process '%s' terminated by signal %s.", spawn->cmd, signal_to_string(si->si_status));
+ log_warning("Process '%s' terminated by signal %s.", spawn->cmd, signal_to_string(si->si_status));
break;
default:
- log_error("process '%s' failed due to unknown reason.", spawn->cmd);
+ log_error("Process '%s' failed due to unknown reason.", spawn->cmd);
}
sd_event_exit(sd_event_source_get_event(s), -EIO);
@@ -610,10 +612,12 @@ static int on_spawn_sigchld(sd_event_source *s, const siginfo_t *si, void *userd
static int spawn_wait(struct udev_event *event,
usec_t timeout_usec,
usec_t timeout_warn_usec,
- const char *cmd, pid_t pid) {
+ const char *cmd, pid_t pid,
+ bool accept_failure) {
Spawn spawn = {
.cmd = cmd,
.pid = pid,
+ .accept_failure = accept_failure,
};
_cleanup_event_unref_ sd_event *e = NULL;
int r, ret;
@@ -698,6 +702,7 @@ out:
int udev_event_spawn(struct udev_event *event,
usec_t timeout_usec,
usec_t timeout_warn_usec,
+ bool accept_failure,
const char *cmd, char **envp,
char *result, size_t ressize) {
int outpipe[2] = {-1, -1};
@@ -773,7 +778,7 @@ int udev_event_spawn(struct udev_event *event,
outpipe[READ_END], errpipe[READ_END],
result, ressize);
- err = spawn_wait(event, timeout_usec, timeout_warn_usec, cmd, pid);
+ err = spawn_wait(event, timeout_usec, timeout_warn_usec, cmd, pid, accept_failure);
}
out:
@@ -930,7 +935,7 @@ void udev_event_execute_run(struct udev_event *event, usec_t timeout_usec, usec_
udev_event_apply_format(event, cmd, program, sizeof(program));
envp = udev_device_get_properties_envp(event->dev);
- udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, NULL, 0);
+ udev_event_spawn(event, timeout_usec, timeout_warn_usec, false, program, envp, NULL, 0);
}
}
}
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 7be9a2311a..8ebc061eb1 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -641,7 +641,7 @@ static int import_program_into_properties(struct udev_event *event,
int err;
envp = udev_device_get_properties_envp(dev);
- err = udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, result, sizeof(result));
+ err = udev_event_spawn(event, timeout_usec, timeout_warn_usec, true, program, envp, result, sizeof(result));
if (err < 0)
return err;
@@ -2131,7 +2131,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
- if (udev_event_spawn(event, timeout_usec, timeout_warn_usec, program, envp, result, sizeof(result)) < 0) {
+ if (udev_event_spawn(event, timeout_usec, timeout_warn_usec, true, program, envp, result, sizeof(result)) < 0) {
if (cur->key.op != OP_NOMATCH)
goto nomatch;
} else {
diff --git a/src/udev/udev.h b/src/udev/udev.h
index fd8504c424..3dca72e499 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -22,7 +22,7 @@
#include <sys/param.h>
#include "macro.h"
-#include "sd-rtnl.h"
+#include "sd-netlink.h"
#include "libudev.h"
#include "libudev-private.h"
#include "util.h"
@@ -43,7 +43,7 @@ struct udev_event {
struct udev_list run_list;
int exec_delay;
usec_t birth_usec;
- sd_rtnl *rtnl;
+ sd_netlink *rtnl;
unsigned int builtin_run;
unsigned int builtin_ret;
bool inotify_watch;
@@ -84,6 +84,7 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string,
int udev_event_spawn(struct udev_event *event,
usec_t timeout_usec,
usec_t timeout_warn_usec,
+ bool accept_failure,
const char *cmd, char **envp,
char *result, size_t ressize);
void udev_event_execute_rules(struct udev_event *event,
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 2affb5944a..2b1dbb8bf1 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -45,7 +45,7 @@
#include "signal-util.h"
#include "event-util.h"
-#include "rtnl-util.h"
+#include "netlink-util.h"
#include "cgroup-util.h"
#include "process-util.h"
#include "dev-setup.h"
@@ -339,7 +339,7 @@ static void worker_spawn(Manager *manager, struct event *event) {
switch (pid) {
case 0: {
struct udev_device *dev = NULL;
- _cleanup_rtnl_unref_ sd_rtnl *rtnl = NULL;
+ _cleanup_netlink_unref_ sd_netlink *rtnl = NULL;
int fd_monitor;
_cleanup_close_ int fd_signal = -1, fd_ep = -1;
struct epoll_event ep_signal = { .events = EPOLLIN };
@@ -455,7 +455,7 @@ static void worker_spawn(Manager *manager, struct event *event) {
if (udev_event->rtnl)
/* in case rtnl was initialized */
- rtnl = sd_rtnl_ref(udev_event->rtnl);
+ rtnl = sd_netlink_ref(udev_event->rtnl);
/* apply/restore inotify watch */
if (udev_event->inotify_watch) {
diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
index e74f8533c7..af0493b9a8 100644
--- a/test/sysv-generator-test.py
+++ b/test/sysv-generator-test.py
@@ -60,6 +60,7 @@ class SysvGeneratorTest(unittest.TestCase):
'''
env = os.environ.copy()
env['SYSTEMD_LOG_LEVEL'] = 'debug'
+ env['SYSTEMD_LOG_TARGET'] = 'console'
env['SYSTEMD_SYSVINIT_PATH'] = self.init_d_dir
env['SYSTEMD_SYSVRCND_PATH'] = self.rcnd_dir
env['SYSTEMD_UNIT_PATH'] = self.unit_dir