mirror of
https://github.com/systemd/systemd
synced 2025-10-01 17:54:45 +02:00
Compare commits
No commits in common. "1f3315b8bdbc9240f70f90373f2b9043f2087ac5" and "0eaee8281d4699903b8b2cce18c836d4a144aee3" have entirely different histories.
1f3315b8bd
...
0eaee8281d
126
NEWS
126
NEWS
@ -28,38 +28,26 @@ CHANGES WITH 248:
|
||||
used to configure dm-verity behaviour for the root device.
|
||||
|
||||
* The key file specified in /etc/crypttab (the third field) may now
|
||||
refer to an AF_UNIX/SOCK_STREAM socket in the file system. The key is
|
||||
acquired by connecting to that socket and reading from it. This
|
||||
allows the implementation of a service to provide key information
|
||||
dynamically, at the moment when it is needed.
|
||||
refer to a UNIX socket path. The key is acquired by connecting to
|
||||
that socket and reading from it. This allows the implementation of a
|
||||
service to provide key information dynamically, at the moment when it
|
||||
is needed.
|
||||
|
||||
* Support has been added to systemd-cryptsetup for extracting the
|
||||
PKCS#11 token URI and encrypted key from the LUKS2 JSON embedded
|
||||
metadata header. This allows the information how to open the
|
||||
encrypted device to be embedded directly in the device and obviates
|
||||
the need for configuration in an external file.
|
||||
* Support has been added for extracting the PKCS#11 token URI and
|
||||
encrypted key from the LUKS2 JSON embedded metadata header. This
|
||||
allows the information how to open the encrypted device to be
|
||||
embedded directly in the device and obviates the need for
|
||||
configuration in an external file.
|
||||
|
||||
* systemd-cryptsetup gained support for unlocking LUKS2 volumes using
|
||||
TPM2 hardware, as well as FIDO2 security tokens.
|
||||
* LUKS devices may now be unlocked using TPM2 hardware.
|
||||
|
||||
* systemd-repart may lock partitions using TPM2 hardware. This may be
|
||||
useful for example to create an encrypted /var partition bound to the
|
||||
machine on first boot.
|
||||
|
||||
* A new systemd-cryptenroll tool has been added to enroll TPM2, FIDO2
|
||||
and PKCS#11 security tokens to LUKS volumes, list and destroy
|
||||
them. See:
|
||||
|
||||
http://0pointer.net/blog/unlocking-luks2-volumes-with-tpm2-fido2-pkcs11-security-hardware-on-systemd-248.html
|
||||
|
||||
It also supports enrolling "recovery keys" and regular passphrases.
|
||||
|
||||
* The libfido2 dependency is now based on dlopen(), so that the library
|
||||
is used at runtime when installed, but not if not.
|
||||
|
||||
* systemd-cryptsetup gained support for two new options in
|
||||
/etc/crypttab: no-write-workqueue and no-read-workqueue which request
|
||||
synchronous processing of encryption/decryption IO.
|
||||
* A new systemd-cryptenroll tool has been added to enroll FIDO2+PKCS#11
|
||||
security tokens to LUKS volumes, list and destroy them. See
|
||||
https://www.freedesktop.org/software/systemd/man/systemd-cryptenroll.html.
|
||||
|
||||
* The manager may be configured at compile time to use fexecve instead
|
||||
of execve when spawning children. Using fexecve closes a window
|
||||
@ -70,8 +58,8 @@ CHANGES WITH 248:
|
||||
* The configuration option -Dcompat-gateway-hostname has been dropped.
|
||||
"_gateway" is now the only supported name.
|
||||
|
||||
* The ConditionSecurity=tpm2 unit file setting may be used to check if
|
||||
the system has at least one TPM2 (tpmrm class) device.
|
||||
* The ConditionSecurity=tpm2 unit file setting may be used to check
|
||||
if the system has at least one TPM2 (tpmrm class) device.
|
||||
|
||||
* The tables of system calls in seccomps filters are now automatically
|
||||
generated from kernel lists exported on
|
||||
@ -101,25 +89,13 @@ CHANGES WITH 248:
|
||||
* The ExecPaths= and NoExecPaths= settings may be used to specify
|
||||
noexec for parts of the file system.
|
||||
|
||||
* sd-bus has a new function sd_bus_open_user_machine() to open a
|
||||
* sd-bus has a new function sd_bus_open_use_machine() to open a
|
||||
connection to the session bus of a specific user in a local container
|
||||
or on the local host. This is exposed in the -M switch to systemctl
|
||||
and similar tools:
|
||||
or on the local host. It also gained a convenience function
|
||||
sd_bus_reply() to call sd_bus_send() with an existing reply message.
|
||||
|
||||
systemctl --user -M lennart@foobar start foo
|
||||
|
||||
This will connect to the user bus of a user "lennart" in container
|
||||
"foobar". If no container name is specified, the specified user on
|
||||
the host itself is connected to
|
||||
|
||||
systemctl --user -M lennart@ start quux
|
||||
|
||||
* sd-bus also gained a convenience function sd_bus_reply() to call
|
||||
sd_bus_send() with an existing reply message.
|
||||
|
||||
* sd-event allows rate limits to be set on event sources, for dealing
|
||||
with high-priority event sources that might starve out others. See
|
||||
the new man page sd_event_source_set_ratelimit(3) for details.
|
||||
* sd-event allows rate limits to be set on event sources. See the new
|
||||
man page sd_event_source_set_ratelimit(3) for details.
|
||||
|
||||
* systemd.link files gained a [Link] Promiscuous= switch, which allows
|
||||
the device to be raised in promiscuous mode.
|
||||
@ -152,11 +128,6 @@ CHANGES WITH 248:
|
||||
systemd.network files gained a [DHCPv6PrefixDelegation]
|
||||
ManageTemporaryAddress= switch.
|
||||
|
||||
.network files gained a new ActivationPolicy= setting which allows
|
||||
configuraiton how the UP state of an interface shall be managed,
|
||||
i.e. whether the iterface is always upped, always downed, or may be
|
||||
upped/downed by the user using "ip dev".
|
||||
|
||||
* systemd.netdev files gained a [VLAN] Protocol=, IngressQOSMaps=,
|
||||
EgressQOSMaps=, and [MACVLAN] BroadcastMulticastQueueLength=
|
||||
configuration options for VLAN packet handling.
|
||||
@ -168,10 +139,10 @@ CHANGES WITH 248:
|
||||
* udev now exports the VOLUME_ID, LOGICAL_VOLUME_ID, VOLUME_SET_ID, and
|
||||
DATA_PREPARED_ID attributes for block devices (when available).
|
||||
|
||||
* udev now exports decoded DMI information about used memory slots as
|
||||
device properties under the /sys/class/dmi/id/ pseudo device.
|
||||
* udev now exports decoded DMI information about memory under the
|
||||
/sys/class/dmi/id/ pseudo device.
|
||||
|
||||
* /dev/ is not mounted noexec any more. This didn't provide any
|
||||
* /dev is not mounted noexec any more. This didn't provide any
|
||||
significant security benefits and would conflicts with the executable
|
||||
mappings used with /dev/sgx device nodes.
|
||||
|
||||
@ -187,27 +158,12 @@ CHANGES WITH 248:
|
||||
DNS query and respond with a mostly unmodified packet received from
|
||||
the upstream server.
|
||||
|
||||
* systemd-resolved learnt a new boolean option CacheFromLocalhost= in
|
||||
resolved.conf. If true the service will provide caching even for DNS
|
||||
lookups made to an upstream DNS server on the 127.0.0.1/::1
|
||||
addresses. By default (and when the option is false) systemd-resolved
|
||||
will not cache such lookups, in order to avoid duplicate local
|
||||
caching, under the assumption the local upstream server caches
|
||||
anyway.
|
||||
|
||||
* systemd-nspawn gained a new --ambient-capability= setting
|
||||
(AmbientCapability= in .nspawn files) to configure ambient
|
||||
capabilities passed to the container payload.
|
||||
|
||||
* systemd-nspawn gained the ability to configure the firewall using the
|
||||
nftables subsystem (in addition to the existing iptables
|
||||
support). Similar, systemd-networkd's IPMasquerade= option now
|
||||
supports nftables as backend, too. In both cases NAT on IPv6 is now
|
||||
supported too, in addition to IPv4 (the iptables backend still is
|
||||
IPv4-only).
|
||||
|
||||
* systemd-importd will now download .verity and .roothash.p7s files
|
||||
along with the machine image (as exposed via machinectl pull-raw).
|
||||
nft subsystem (in addition to the existing iptables support).
|
||||
|
||||
* systemd-oomd now gained a new DefaultMemoryPressureDurationSec=
|
||||
setting to configure the time a unit's cgroup needs to exceed memory
|
||||
@ -232,20 +188,15 @@ CHANGES WITH 248:
|
||||
the configured hostname ("static", "transient", or "fallback") as
|
||||
D-Bus properties.
|
||||
|
||||
* systemd-hostnamed now exports the "HardwareVendor" and
|
||||
"HardwareModel" D-Bus properties, which are supposed to contain a
|
||||
pair of cleaned up, human readable strings describing the system
|
||||
vendor and model. It's typically source from the firmware's DMI
|
||||
tables, but may be augmented from a new hwdb database. hostnamectl
|
||||
shows this in the status output.
|
||||
* systemd-hostnamed now exports the HardwareVendor and HardwareModel
|
||||
D-Bus properties. hostnamectl shows this in the status output.
|
||||
|
||||
* systemd-localed may now call locale-gen to generate missing locales
|
||||
on-demand (UTF-8-only). This improves integration with Debian-based
|
||||
distributions (Debian/Ubuntu/PureOS/Tanglu/...) and Arch Linux.
|
||||
|
||||
* systemctl --check-inhibitors=true may now be used to obey inhibitors
|
||||
even when invoked non-interactively. The old --ignore-inhibitors
|
||||
switch is now deprecated and replaced by --check-inhibitors=false.
|
||||
* systemctl --check-inhibitors may now be used to obey inhibitors even
|
||||
when invoked non-interactively.
|
||||
|
||||
* systemctl import-environment will now emit a warning when called
|
||||
without any arguments (i.e. to import the full environment block of
|
||||
@ -260,11 +211,6 @@ CHANGES WITH 248:
|
||||
directly calling the D-Bus API of the manager, should also push
|
||||
specific variables, and not the full inherited environment.
|
||||
|
||||
* systemctl's status output now shows unit state with a more careful
|
||||
selection of Unicode characters: units in maintainance show a "○"
|
||||
symbol instead of the usual "●", failed units show "×", and services
|
||||
being reloaded "↻".
|
||||
|
||||
* coredumpctl gained a --debugger-arguments= switch to pass arguments
|
||||
to the debugger.
|
||||
|
||||
@ -273,13 +219,12 @@ CHANGES WITH 248:
|
||||
* Various tools gained --pager/--no-pager/--json switches to
|
||||
enable/disable the pager and provide JSON output.
|
||||
|
||||
* Various tools now accept SYSTEMD_COLORS=16|256 to configure how
|
||||
many terminal colours are used in output.
|
||||
* Various tools now accept SYSTEMD_COLORS=16|256 to configure what
|
||||
colours are used in output.
|
||||
|
||||
* less 568 or newer is now required. Hyperlink ANSI sequences in
|
||||
termina output are now used even if a pager is used, and older
|
||||
versions of less are not able to display these sequences
|
||||
correctly. SYSTEMD_URLIFY=0 may be used to disable it.
|
||||
* less 568 or newer is now required. Link markup is now always used,
|
||||
and older versions will not display it properly. SYSTEMD_URLIFY=0 may
|
||||
be used to disable it.
|
||||
|
||||
* Builds with support for separate / and /usr hierarchies (split-usr
|
||||
builds, non-merged-usr builds) are now officially deprecated. A
|
||||
@ -292,11 +237,6 @@ CHANGES WITH 248:
|
||||
for partitions, as in the vast majority of cases they contain none
|
||||
and are used internally by the bootloader (eg: uboot).
|
||||
|
||||
* systemd will now set the $SYSTEMD_EXEC_PID environment variable for
|
||||
spawned processes to the PID of the process itself. This may be used
|
||||
by programs for detecting whether they were forked off by the service
|
||||
manager itself or are a process forked off further down the tree.
|
||||
|
||||
CHANGES WITH 247:
|
||||
|
||||
* KERNEL API INCOMPATIBILITY: Linux 4.14 introduced two new uevents
|
||||
|
12
TODO
12
TODO
@ -20,18 +20,6 @@ Janitorial Clean-ups:
|
||||
|
||||
Features:
|
||||
|
||||
* add an Open= setting to service unit files that can open arbitrary file
|
||||
system paths at service startup time and pass them to the service process via
|
||||
our usual socket activation protocol. If passed path refers to AF_UNIX
|
||||
socket: connect() to it.
|
||||
|
||||
* add a ConnectSocket= setting to service unit files, that may reference a
|
||||
socket unit, and which will connect to the socket defined therein, and pass
|
||||
the resulting fd to the service program via socket activation proto.
|
||||
|
||||
* Add a concept of ListenStream=anonymous to socket units: listen on a socket
|
||||
that is deleted in the fs. Usecase would be with ConnectSocket= above.
|
||||
|
||||
* Hook up journald's FSS logic with TPM2: seal the verification disk by
|
||||
time-based policy, so that the verification key can remain on host and ve
|
||||
validated via TPM.
|
||||
|
@ -1463,29 +1463,17 @@ evdev:input:b0003v047FpC006*
|
||||
# Purism
|
||||
###########################################################
|
||||
|
||||
# If you're using an us layout keyboard in one of the below models of
|
||||
# Purism Librem 13 consider copying this file to /etc/systemd/hwdb.d/
|
||||
# to enable the following rule acording to your model.
|
||||
#
|
||||
# There's a bug in the keyboards firmware and the additional rule
|
||||
# will make your keyboard behave as expected.
|
||||
#
|
||||
# More info:
|
||||
# - https://github.com/systemd/systemd/issues/15360
|
||||
# - https://github.com/systemd/systemd/pull/11516
|
||||
# - https://tracker.pureos.net/T888
|
||||
#
|
||||
# # Purism Librem 13 V2
|
||||
# evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v2*:*
|
||||
# KEYBOARD_KEY_56=backslash
|
||||
#
|
||||
# # Purism Librem 13 V3
|
||||
# evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v3*:*
|
||||
# KEYBOARD_KEY_56=backslash
|
||||
#
|
||||
# # Purism Librem 13 V4
|
||||
# evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v4*:*
|
||||
# KEYBOARD_KEY_56=backslash
|
||||
# Purism Librem 13 V2
|
||||
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v2*:*
|
||||
KEYBOARD_KEY_56=backslash
|
||||
|
||||
# Purism Librem 13 V3
|
||||
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v3*:*
|
||||
KEYBOARD_KEY_56=backslash
|
||||
|
||||
# Purism Librem 13 V4
|
||||
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnPurism*:pn*Librem13v4*:*
|
||||
KEYBOARD_KEY_56=backslash
|
||||
|
||||
###########################################################
|
||||
# Quanta
|
||||
|
@ -1935,12 +1935,18 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
<varlistentry>
|
||||
<term><varname>UseDNS=</varname></term>
|
||||
<term><varname>UseNTP=</varname></term>
|
||||
<term><varname>UseHostname=</varname></term>
|
||||
<listitem>
|
||||
<para>As in the [DHCPv4] section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>UseFQDN=</varname></term>
|
||||
<listitem>
|
||||
<para>Equivalent of <varname>UseHostname=</varname> in the [DHCPv4] section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>RouteMetric=</varname></term>
|
||||
<listitem>
|
||||
|
@ -495,7 +495,7 @@ int random_write_entropy(int fd, const void *seed, size_t size, bool credit) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint64_t random_u64_range(uint64_t m) {
|
||||
int random_u64_range(uint64_t m) {
|
||||
uint64_t x, remainder;
|
||||
|
||||
/* Generates a random number in the range 0…m-1, unbiased. (Java's algorithm) */
|
||||
|
@ -41,4 +41,4 @@ size_t random_pool_size(void);
|
||||
|
||||
int random_write_entropy(int fd, const void *seed, size_t size, bool credit);
|
||||
|
||||
uint64_t random_u64_range(uint64_t max);
|
||||
int random_u64_range(uint64_t max);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "bus-error.h"
|
||||
#include "dbus-device.h"
|
||||
#include "dbus-unit.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
#include "device.h"
|
||||
#include "log.h"
|
||||
@ -915,8 +916,8 @@ static int device_remove_old(Manager *m, sd_device *dev) {
|
||||
}
|
||||
|
||||
static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void *userdata) {
|
||||
sd_device_action_t action;
|
||||
Manager *m = userdata;
|
||||
DeviceAction action;
|
||||
const char *sysfs;
|
||||
int r;
|
||||
|
||||
@ -929,22 +930,22 @@ static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void *
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = sd_device_get_action(dev, &action);
|
||||
r = device_get_action(dev, &action);
|
||||
if (r < 0) {
|
||||
log_device_error_errno(dev, r, "Failed to get udev action: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!IN_SET(action, SD_DEVICE_ADD, SD_DEVICE_REMOVE, SD_DEVICE_MOVE))
|
||||
if (!IN_SET(action, DEVICE_ACTION_ADD, DEVICE_ACTION_REMOVE, DEVICE_ACTION_MOVE))
|
||||
device_propagate_reload_by_sysfs(m, sysfs);
|
||||
|
||||
if (action == SD_DEVICE_MOVE)
|
||||
if (action == DEVICE_ACTION_MOVE)
|
||||
(void) device_remove_old(m, dev);
|
||||
|
||||
/* A change event can signal that a device is becoming ready, in particular if the device is using
|
||||
* the SYSTEMD_READY logic in udev so we need to reach the else block of the following if, even for
|
||||
* change events */
|
||||
if (action == SD_DEVICE_REMOVE) {
|
||||
if (action == DEVICE_ACTION_REMOVE) {
|
||||
r = swap_process_device_remove(m, dev);
|
||||
if (r < 0)
|
||||
log_device_warning_errno(dev, r, "Failed to process swap device remove event, ignoring: %m");
|
||||
@ -1012,7 +1013,7 @@ static int validate_node(Manager *m, const char *node, sd_device **ret) {
|
||||
} else {
|
||||
_cleanup_(sd_device_unrefp) sd_device *dev = NULL;
|
||||
|
||||
r = sd_device_new_from_stat_rdev(&dev, &st);
|
||||
r = device_new_from_stat_rdev(&dev, &st);
|
||||
if (r == -ENOENT) {
|
||||
*ret = NULL;
|
||||
return 1; /* good! (though missing) */
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "dbus-swap.h"
|
||||
#include "dbus-unit.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
#include "device.h"
|
||||
#include "escape.h"
|
||||
@ -306,7 +307,7 @@ static int swap_load_devnode(Swap *s) {
|
||||
if (stat(s->what, &st) < 0 || !S_ISBLK(st.st_mode))
|
||||
return 0;
|
||||
|
||||
r = sd_device_new_from_stat_rdev(&d, &st);
|
||||
r = device_new_from_stat_rdev(&d, &st);
|
||||
if (r < 0) {
|
||||
log_unit_full_errno(UNIT(s), r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r,
|
||||
"Failed to allocate device for swap %s: %m", s->what);
|
||||
@ -509,7 +510,7 @@ static int swap_process_new(Manager *m, const char *device, int prio, bool set_f
|
||||
if (stat(device, &st) < 0 || !S_ISBLK(st.st_mode))
|
||||
return 0;
|
||||
|
||||
r = sd_device_new_from_stat_rdev(&d, &st);
|
||||
r = device_new_from_stat_rdev(&d, &st);
|
||||
if (r < 0) {
|
||||
log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_WARNING, r,
|
||||
"Failed to allocate device for swap %s: %m", device);
|
||||
|
@ -1234,7 +1234,7 @@ static int manager_on_device(sd_device_monitor *monitor, sd_device *d, void *use
|
||||
assert(m);
|
||||
assert(d);
|
||||
|
||||
if (device_for_action(d, SD_DEVICE_REMOVE)) {
|
||||
if (device_for_action(d, DEVICE_ACTION_REMOVE)) {
|
||||
const char *sysfs;
|
||||
Home *h;
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "catalog.h"
|
||||
#include "chattr-util.h"
|
||||
#include "def.h"
|
||||
#include "device-private.h"
|
||||
#include "dissect-image.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
@ -206,7 +207,7 @@ static int add_matches_for_device(sd_journal *j, const char *devpath) {
|
||||
if (stat(devpath, &st) < 0)
|
||||
return log_error_errno(errno, "Couldn't stat file: %m");
|
||||
|
||||
r = sd_device_new_from_stat_rdev(&device, &st);
|
||||
r = device_new_from_stat_rdev(&device, &st);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get device from devnum %u:%u: %m", major(st.st_rdev), minor(st.st_rdev));
|
||||
|
||||
|
@ -35,5 +35,5 @@ struct sd_lldp {
|
||||
#define log_lldp_errno(error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "LLDP: " fmt, ##__VA_ARGS__)
|
||||
#define log_lldp(fmt, ...) log_lldp_errno(0, fmt, ##__VA_ARGS__)
|
||||
|
||||
const char* lldp_event_to_string(sd_lldp_event_t e) _const_;
|
||||
sd_lldp_event_t lldp_event_from_string(const char *s) _pure_;
|
||||
const char* lldp_event_to_string(sd_lldp_event e) _const_;
|
||||
sd_lldp_event lldp_event_from_string(const char *s) _pure_;
|
||||
|
@ -40,5 +40,5 @@ struct sd_ndisc {
|
||||
#define log_ndisc_errno(error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "NDISC: " fmt, ##__VA_ARGS__)
|
||||
#define log_ndisc(fmt, ...) log_ndisc_errno(0, fmt, ##__VA_ARGS__)
|
||||
|
||||
const char* ndisc_event_to_string(sd_ndisc_event_t e) _const_;
|
||||
sd_ndisc_event_t ndisc_event_from_string(const char *s) _pure_;
|
||||
const char* ndisc_event_to_string(sd_ndisc_event e) _const_;
|
||||
sd_ndisc_event ndisc_event_from_string(const char *s) _pure_;
|
||||
|
@ -99,7 +99,7 @@ int sd_dhcp_lease_get_mtu(sd_dhcp_lease *lease, uint16_t *mtu) {
|
||||
|
||||
int sd_dhcp_lease_get_servers(
|
||||
sd_dhcp_lease *lease,
|
||||
sd_dhcp_lease_server_type_t what,
|
||||
sd_dhcp_lease_server_type what,
|
||||
const struct in_addr **addr) {
|
||||
|
||||
assert_return(lease, -EINVAL);
|
||||
@ -281,7 +281,7 @@ static sd_dhcp_lease *dhcp_lease_free(sd_dhcp_lease *lease) {
|
||||
free(lease->hostname);
|
||||
free(lease->domainname);
|
||||
|
||||
for (sd_dhcp_lease_server_type_t i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++)
|
||||
for (sd_dhcp_lease_server_type i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++)
|
||||
free(lease->servers[i].addr);
|
||||
|
||||
free(lease->static_route);
|
||||
|
@ -149,7 +149,7 @@ static sd_dhcp_server *dhcp_server_free(sd_dhcp_server *server) {
|
||||
|
||||
free(server->timezone);
|
||||
|
||||
for (sd_dhcp_lease_server_type_t i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++)
|
||||
for (sd_dhcp_lease_server_type i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++)
|
||||
free(server->servers[i].addr);
|
||||
|
||||
hashmap_free(server->leases_by_client_id);
|
||||
@ -509,7 +509,7 @@ static int server_send_ack(
|
||||
return r;
|
||||
}
|
||||
|
||||
for (sd_dhcp_lease_server_type_t k = 0; k < _SD_DHCP_LEASE_SERVER_TYPE_MAX; k++) {
|
||||
for (sd_dhcp_lease_server_type k = 0; k < _SD_DHCP_LEASE_SERVER_TYPE_MAX; k++) {
|
||||
|
||||
if (server->servers[k].size <= 0)
|
||||
continue;
|
||||
@ -1118,7 +1118,7 @@ int sd_dhcp_server_set_default_lease_time(sd_dhcp_server *server, uint32_t t) {
|
||||
|
||||
int sd_dhcp_server_set_servers(
|
||||
sd_dhcp_server *server,
|
||||
sd_dhcp_lease_server_type_t what,
|
||||
sd_dhcp_lease_server_type what,
|
||||
const struct in_addr addresses[],
|
||||
size_t n_addresses) {
|
||||
|
||||
|
@ -27,7 +27,7 @@ static const char * const lldp_event_table[_SD_LLDP_EVENT_MAX] = {
|
||||
[SD_LLDP_EVENT_REFRESHED] = "refreshed",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(lldp_event, sd_lldp_event_t);
|
||||
DEFINE_STRING_TABLE_LOOKUP(lldp_event, sd_lldp_event);
|
||||
|
||||
static void lldp_flush_neighbors(sd_lldp *lldp) {
|
||||
assert(lldp);
|
||||
@ -35,7 +35,7 @@ static void lldp_flush_neighbors(sd_lldp *lldp) {
|
||||
hashmap_clear(lldp->neighbor_by_id);
|
||||
}
|
||||
|
||||
static void lldp_callback(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n) {
|
||||
static void lldp_callback(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n) {
|
||||
assert(lldp);
|
||||
assert(event >= 0 && event < _SD_LLDP_EVENT_MAX);
|
||||
|
||||
|
@ -28,9 +28,9 @@ static const char * const ndisc_event_table[_SD_NDISC_EVENT_MAX] = {
|
||||
[SD_NDISC_EVENT_ROUTER] = "router",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(ndisc_event, sd_ndisc_event_t);
|
||||
DEFINE_STRING_TABLE_LOOKUP(ndisc_event, sd_ndisc_event);
|
||||
|
||||
static void ndisc_callback(sd_ndisc *ndisc, sd_ndisc_event_t event, sd_ndisc_router *rt) {
|
||||
static void ndisc_callback(sd_ndisc *ndisc, sd_ndisc_event event, sd_ndisc_router *rt) {
|
||||
assert(ndisc);
|
||||
assert(event >= 0 && event < _SD_NDISC_EVENT_MAX);
|
||||
|
||||
|
@ -30,7 +30,7 @@ int lldp_network_bind_raw_socket(int ifindex) {
|
||||
return test_fd[0];
|
||||
}
|
||||
|
||||
static void lldp_handler(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n, void *userdata) {
|
||||
static void lldp_handler(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata) {
|
||||
lldp_handler_calls++;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ int icmp6_send_router_solicitation(int s, const struct ether_addr *ether_addr) {
|
||||
return send_ra_function(0);
|
||||
}
|
||||
|
||||
static void test_callback(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata) {
|
||||
static void test_callback(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata) {
|
||||
sd_event *e = userdata;
|
||||
static unsigned idx = 0;
|
||||
uint64_t flags_array[] = {
|
||||
|
@ -745,8 +745,4 @@ global:
|
||||
sd_event_source_set_ratelimit;
|
||||
sd_event_source_get_ratelimit;
|
||||
sd_event_source_is_ratelimited;
|
||||
|
||||
sd_device_get_action;
|
||||
sd_device_get_seqnum;
|
||||
sd_device_new_from_stat_rdev;
|
||||
} LIBSYSTEMD_247;
|
||||
|
@ -76,7 +76,7 @@ struct sd_device {
|
||||
gid_t devgid;
|
||||
|
||||
/* only set when device is passed through netlink */
|
||||
sd_device_action_t action;
|
||||
DeviceAction action;
|
||||
uint64_t seqnum;
|
||||
|
||||
bool parent_set:1; /* no need to try to reload parent */
|
||||
|
@ -183,8 +183,20 @@ static int device_set_devgid(sd_device *device, const char *gid) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int device_get_action(sd_device *device, DeviceAction *action) {
|
||||
assert(device);
|
||||
|
||||
if (device->action < 0)
|
||||
return -ENOENT;
|
||||
|
||||
if (action)
|
||||
*action = device->action;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int device_set_action(sd_device *device, const char *action) {
|
||||
sd_device_action_t a;
|
||||
DeviceAction a;
|
||||
int r;
|
||||
|
||||
assert(device);
|
||||
@ -194,7 +206,7 @@ static int device_set_action(sd_device *device, const char *action) {
|
||||
if (a < 0)
|
||||
return a;
|
||||
|
||||
r = device_add_property_internal(device, "ACTION", device_action_to_string(a));
|
||||
r = device_add_property_internal(device, "ACTION", action);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -203,6 +215,18 @@ static int device_set_action(sd_device *device, const char *action) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int device_get_seqnum(sd_device *device, uint64_t *seqnum) {
|
||||
assert(device);
|
||||
|
||||
if (device->seqnum == 0)
|
||||
return -ENOENT;
|
||||
|
||||
if (seqnum)
|
||||
*seqnum = device->seqnum;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int device_set_seqnum(sd_device *device, const char *str) {
|
||||
uint64_t seqnum;
|
||||
int r;
|
||||
@ -331,12 +355,7 @@ static int device_amend(sd_device *device, const char *key, const char *value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int device_append(
|
||||
sd_device *device,
|
||||
char *key,
|
||||
const char **_major,
|
||||
const char **_minor) {
|
||||
|
||||
static int device_append(sd_device *device, char *key, const char **_major, const char **_minor) {
|
||||
const char *major = NULL, *minor = NULL;
|
||||
char *value;
|
||||
int r;
|
||||
@ -365,10 +384,10 @@ static int device_append(
|
||||
return r;
|
||||
}
|
||||
|
||||
if (major)
|
||||
if (major != 0)
|
||||
*_major = major;
|
||||
|
||||
if (minor)
|
||||
if (minor != 0)
|
||||
*_minor = minor;
|
||||
|
||||
return 0;
|
||||
@ -700,6 +719,22 @@ int device_new_from_synthetic_event(sd_device **new_device, const char *syspath,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int device_new_from_stat_rdev(sd_device **ret, const struct stat *st) {
|
||||
char type;
|
||||
|
||||
assert(ret);
|
||||
assert(st);
|
||||
|
||||
if (S_ISBLK(st->st_mode))
|
||||
type = 'b';
|
||||
else if (S_ISCHR(st->st_mode))
|
||||
type = 'c';
|
||||
else
|
||||
return -ENOTTY;
|
||||
|
||||
return sd_device_new_from_devnum(ret, type, st->st_rdev);
|
||||
}
|
||||
|
||||
int device_copy_properties(sd_device *device_dst, sd_device *device_src) {
|
||||
const char *property, *value;
|
||||
int r;
|
||||
@ -963,19 +998,19 @@ int device_delete_db(sd_device *device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char* const device_action_table[_SD_DEVICE_ACTION_MAX] = {
|
||||
[SD_DEVICE_ADD] = "add",
|
||||
[SD_DEVICE_REMOVE] = "remove",
|
||||
[SD_DEVICE_CHANGE] = "change",
|
||||
[SD_DEVICE_MOVE] = "move",
|
||||
[SD_DEVICE_ONLINE] = "online",
|
||||
[SD_DEVICE_OFFLINE] = "offline",
|
||||
[SD_DEVICE_BIND] = "bind",
|
||||
[SD_DEVICE_UNBIND] = "unbind",
|
||||
static const char* const device_action_table[_DEVICE_ACTION_MAX] = {
|
||||
[DEVICE_ACTION_ADD] = "add",
|
||||
[DEVICE_ACTION_REMOVE] = "remove",
|
||||
[DEVICE_ACTION_CHANGE] = "change",
|
||||
[DEVICE_ACTION_MOVE] = "move",
|
||||
[DEVICE_ACTION_ONLINE] = "online",
|
||||
[DEVICE_ACTION_OFFLINE] = "offline",
|
||||
[DEVICE_ACTION_BIND] = "bind",
|
||||
[DEVICE_ACTION_UNBIND] = "unbind",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(device_action, sd_device_action_t);
|
||||
DEFINE_STRING_TABLE_LOOKUP(device_action, DeviceAction);
|
||||
|
||||
void dump_device_action_table(void) {
|
||||
DUMP_STRING_TABLE(device_action, sd_device_action_t, _SD_DEVICE_ACTION_MAX);
|
||||
DUMP_STRING_TABLE(device_action, DeviceAction, _DEVICE_ACTION_MAX);
|
||||
}
|
||||
|
@ -10,8 +10,22 @@
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
typedef enum DeviceAction {
|
||||
DEVICE_ACTION_ADD,
|
||||
DEVICE_ACTION_REMOVE,
|
||||
DEVICE_ACTION_CHANGE,
|
||||
DEVICE_ACTION_MOVE,
|
||||
DEVICE_ACTION_ONLINE,
|
||||
DEVICE_ACTION_OFFLINE,
|
||||
DEVICE_ACTION_BIND,
|
||||
DEVICE_ACTION_UNBIND,
|
||||
_DEVICE_ACTION_MAX,
|
||||
_DEVICE_ACTION_INVALID = -EINVAL,
|
||||
} DeviceAction;
|
||||
|
||||
int device_new_from_nulstr(sd_device **ret, uint8_t *nulstr, size_t len);
|
||||
int device_new_from_strv(sd_device **ret, char **strv);
|
||||
int device_new_from_stat_rdev(sd_device **ret, const struct stat *st);
|
||||
|
||||
int device_get_id_filename(sd_device *device, const char **ret);
|
||||
|
||||
@ -20,6 +34,8 @@ int device_get_watch_handle(sd_device *device, int *handle);
|
||||
int device_get_devnode_mode(sd_device *device, mode_t *mode);
|
||||
int device_get_devnode_uid(sd_device *device, uid_t *uid);
|
||||
int device_get_devnode_gid(sd_device *device, gid_t *gid);
|
||||
int device_get_action(sd_device *device, DeviceAction *action);
|
||||
int device_get_seqnum(sd_device *device, uint64_t *seqnum);
|
||||
|
||||
void device_seal(sd_device *device);
|
||||
void device_set_is_initialized(sd_device *device);
|
||||
@ -57,6 +73,6 @@ static inline int device_read_db(sd_device *device) {
|
||||
return device_read_db_internal(device, false);
|
||||
}
|
||||
|
||||
sd_device_action_t device_action_from_string(const char *s) _pure_;
|
||||
const char *device_action_to_string(sd_device_action_t a) _const_;
|
||||
DeviceAction device_action_from_string(const char *s) _pure_;
|
||||
const char *device_action_to_string(DeviceAction a) _const_;
|
||||
void dump_device_action_table(void);
|
||||
|
@ -43,7 +43,7 @@ int device_new_aux(sd_device **ret) {
|
||||
.devmode = (mode_t) -1,
|
||||
.devuid = (uid_t) -1,
|
||||
.devgid = (gid_t) -1,
|
||||
.action = _SD_DEVICE_ACTION_INVALID,
|
||||
.action = _DEVICE_ACTION_INVALID,
|
||||
};
|
||||
|
||||
*ret = device;
|
||||
@ -316,22 +316,6 @@ _public_ int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *s
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
_public_ int sd_device_new_from_stat_rdev(sd_device **ret, const struct stat *st) {
|
||||
char type;
|
||||
|
||||
assert_return(ret, -EINVAL);
|
||||
assert_return(st, -EINVAL);
|
||||
|
||||
if (S_ISBLK(st->st_mode))
|
||||
type = 'b';
|
||||
else if (S_ISCHR(st->st_mode))
|
||||
type = 'c';
|
||||
else
|
||||
return -ENOTTY;
|
||||
|
||||
return sd_device_new_from_devnum(ret, type, st->st_rdev);
|
||||
}
|
||||
|
||||
int device_set_devtype(sd_device *device, const char *devtype) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
int r;
|
||||
@ -1068,30 +1052,6 @@ _public_ int sd_device_get_sysnum(sd_device *device, const char **ret) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ int sd_device_get_action(sd_device *device, sd_device_action_t *ret) {
|
||||
assert_return(device, -EINVAL);
|
||||
|
||||
if (device->action < 0)
|
||||
return -ENOENT;
|
||||
|
||||
if (ret)
|
||||
*ret = device->action;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ int sd_device_get_seqnum(sd_device *device, uint64_t *ret) {
|
||||
assert_return(device, -EINVAL);
|
||||
|
||||
if (device->seqnum == 0)
|
||||
return -ENOENT;
|
||||
|
||||
if (ret)
|
||||
*ret = device->seqnum;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool is_valid_tag(const char *tag) {
|
||||
assert(tag);
|
||||
|
||||
|
@ -25,9 +25,9 @@ static const genl_family genl_families[] = {
|
||||
int sd_genl_socket_open(sd_netlink **ret) {
|
||||
return netlink_open_family(ret, NETLINK_GENERIC);
|
||||
}
|
||||
static int lookup_id(sd_netlink *nl, sd_genl_family_t family, uint16_t *id);
|
||||
static int lookup_id(sd_netlink *nl, sd_genl_family family, uint16_t *id);
|
||||
|
||||
static int genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint16_t nlmsg_type, uint8_t cmd, sd_netlink_message **ret) {
|
||||
static int genl_message_new(sd_netlink *nl, sd_genl_family family, uint16_t nlmsg_type, uint8_t cmd, sd_netlink_message **ret) {
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
const NLType *genl_cmd_type, *nl_type;
|
||||
const NLTypeSystem *type_system;
|
||||
@ -71,7 +71,7 @@ static int genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint16_t nl
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint8_t cmd, sd_netlink_message **ret) {
|
||||
int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **ret) {
|
||||
uint16_t id;
|
||||
int r;
|
||||
|
||||
@ -82,7 +82,7 @@ int sd_genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint8_t cmd, sd
|
||||
return genl_message_new(nl, family, id, cmd, ret);
|
||||
}
|
||||
|
||||
static int lookup_id(sd_netlink *nl, sd_genl_family_t family, uint16_t *id) {
|
||||
static int lookup_id(sd_netlink *nl, sd_genl_family family, uint16_t *id) {
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL, *reply = NULL;
|
||||
uint16_t u;
|
||||
void *v;
|
||||
@ -127,7 +127,7 @@ static int lookup_id(sd_netlink *nl, sd_genl_family_t family, uint16_t *id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family_t *ret) {
|
||||
int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family *ret) {
|
||||
void *p;
|
||||
|
||||
assert_return(nl, -EINVAL);
|
||||
@ -151,7 +151,7 @@ int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_famil
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family_t *family) {
|
||||
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family *family) {
|
||||
uint16_t type;
|
||||
int r;
|
||||
|
||||
|
@ -3,4 +3,4 @@
|
||||
|
||||
#include "sd-netlink.h"
|
||||
|
||||
int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family_t *ret);
|
||||
int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family *ret);
|
||||
|
@ -1636,7 +1636,7 @@ const NLTypeSystem *type_system_get_root(int protocol) {
|
||||
}
|
||||
|
||||
int type_system_root_get_type(sd_netlink *nl, const NLType **ret, uint16_t type) {
|
||||
sd_genl_family_t family;
|
||||
sd_genl_family family;
|
||||
const NLType *nl_type;
|
||||
int r;
|
||||
|
||||
|
@ -82,7 +82,7 @@ _public_ unsigned long long udev_device_get_seqnum(struct udev_device *udev_devi
|
||||
|
||||
assert_return_errno(udev_device, 0, EINVAL);
|
||||
|
||||
if (sd_device_get_seqnum(udev_device->device, &seqnum) < 0)
|
||||
if (device_get_seqnum(udev_device->device, &seqnum) < 0)
|
||||
return 0;
|
||||
|
||||
return seqnum;
|
||||
@ -693,11 +693,11 @@ _public_ struct udev_list_entry *udev_device_get_properties_list_entry(struct ud
|
||||
* Returns: the kernel action value, or #NULL if there is no action value available.
|
||||
**/
|
||||
_public_ const char *udev_device_get_action(struct udev_device *udev_device) {
|
||||
sd_device_action_t action;
|
||||
DeviceAction action;
|
||||
|
||||
assert_return_errno(udev_device, NULL, EINVAL);
|
||||
|
||||
if (sd_device_get_action(udev_device->device, &action) < 0)
|
||||
if (device_get_action(udev_device->device, &action) < 0)
|
||||
return NULL;
|
||||
|
||||
return device_action_to_string(action);
|
||||
|
@ -246,7 +246,7 @@ int manager_process_seat_device(Manager *m, sd_device *d) {
|
||||
|
||||
assert(m);
|
||||
|
||||
if (device_for_action(d, SD_DEVICE_REMOVE) ||
|
||||
if (device_for_action(d, DEVICE_ACTION_REMOVE) ||
|
||||
sd_device_has_current_tag(d, "seat") <= 0) {
|
||||
const char *syspath;
|
||||
|
||||
@ -317,7 +317,7 @@ int manager_process_button_device(Manager *m, sd_device *d) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (device_for_action(d, SD_DEVICE_REMOVE) ||
|
||||
if (device_for_action(d, DEVICE_ACTION_REMOVE) ||
|
||||
sd_device_has_current_tag(d, "power-switch") <= 0) {
|
||||
|
||||
b = hashmap_get(m->buttons, sysname);
|
||||
|
@ -578,7 +578,7 @@ static int manager_dispatch_vcsa_udev(sd_device_monitor *monitor, sd_device *dev
|
||||
|
||||
if (sd_device_get_sysname(device, &name) >= 0 &&
|
||||
startswith(name, "vcsa") &&
|
||||
device_for_action(device, SD_DEVICE_REMOVE))
|
||||
device_for_action(device, DEVICE_ACTION_REMOVE))
|
||||
seat_preallocate_vts(m->seat0);
|
||||
|
||||
return 0;
|
||||
|
@ -60,7 +60,7 @@ static Address* link_find_dhcp_server_address(Link *link) {
|
||||
|
||||
static int link_push_uplink_to_dhcp_server(
|
||||
Link *link,
|
||||
sd_dhcp_lease_server_type_t what,
|
||||
sd_dhcp_lease_server_type what,
|
||||
sd_dhcp_server *s) {
|
||||
|
||||
_cleanup_free_ struct in_addr *addresses = NULL;
|
||||
@ -307,7 +307,7 @@ int dhcp4_server_configure(Link *link) {
|
||||
return log_link_error_errno(link, r, "Failed to set default lease time for DHCPv4 server instance: %m");
|
||||
}
|
||||
|
||||
for (sd_dhcp_lease_server_type_t type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type ++) {
|
||||
for (sd_dhcp_lease_server_type type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type ++) {
|
||||
|
||||
if (!link->network->dhcp_server_emit[type].emit)
|
||||
continue;
|
||||
|
@ -1076,10 +1076,9 @@ static int dhcp6_address_acquired(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
if (link->network->dhcp6_use_hostname) {
|
||||
if (link->network->dhcp6_use_fqdn) {
|
||||
const char *dhcpname = NULL;
|
||||
_cleanup_free_ char *hostname = NULL;
|
||||
|
||||
(void) sd_dhcp6_lease_get_fqdn(link->dhcp6_lease, &dhcpname);
|
||||
|
||||
if (dhcpname) {
|
||||
|
@ -2823,7 +2823,7 @@ static void serialize_addresses(
|
||||
char **addresses,
|
||||
sd_dhcp_lease *lease,
|
||||
bool conditional,
|
||||
sd_dhcp_lease_server_type_t what,
|
||||
sd_dhcp_lease_server_type what,
|
||||
sd_dhcp6_lease *lease6,
|
||||
bool conditional6,
|
||||
int (*lease6_get_addr)(sd_dhcp6_lease*, const struct in6_addr**),
|
||||
|
@ -47,7 +47,7 @@ static bool link_lldp_rx_enabled(Link *link) {
|
||||
return link->network->lldp_mode != LLDP_MODE_NO;
|
||||
}
|
||||
|
||||
static void lldp_handler(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n, void *userdata) {
|
||||
static void lldp_handler(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata) {
|
||||
Link *link = userdata;
|
||||
int r;
|
||||
|
||||
|
@ -182,15 +182,15 @@ int manager_connect_bus(Manager *m) {
|
||||
}
|
||||
|
||||
static int manager_udev_process_link(sd_device_monitor *monitor, sd_device *device, void *userdata) {
|
||||
sd_device_action_t action;
|
||||
Manager *m = userdata;
|
||||
DeviceAction action;
|
||||
Link *link = NULL;
|
||||
int r, ifindex;
|
||||
|
||||
assert(m);
|
||||
assert(device);
|
||||
|
||||
r = sd_device_get_action(device, &action);
|
||||
r = device_get_action(device, &action);
|
||||
if (r < 0) {
|
||||
log_device_debug_errno(device, r, "Failed to get udev action, ignoring device: %m");
|
||||
return 0;
|
||||
@ -199,7 +199,7 @@ static int manager_udev_process_link(sd_device_monitor *monitor, sd_device *devi
|
||||
/* Ignore the "remove" uevent — let's remove a device only if rtnetlink says so. All other uevents
|
||||
* are "positive" events in some form, i.e. inform us about a changed or new network interface, that
|
||||
* still exists — and we are interested in that. */
|
||||
if (action == SD_DEVICE_REMOVE)
|
||||
if (action == DEVICE_ACTION_REMOVE)
|
||||
return 0;
|
||||
|
||||
r = sd_device_get_ifindex(device, &ifindex);
|
||||
|
@ -1274,7 +1274,7 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata) {
|
||||
static void ndisc_handler(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata) {
|
||||
Link *link = userdata;
|
||||
int r;
|
||||
|
||||
|
@ -225,7 +225,7 @@ DHCPv4.RouteMTUBytes, config_parse_mtu,
|
||||
DHCPv4.FallbackLeaseLifetimeSec, config_parse_dhcp_fallback_lease_lifetime, 0, 0
|
||||
DHCPv6.UseAddress, config_parse_bool, 0, offsetof(Network, dhcp6_use_address)
|
||||
DHCPv6.UseDNS, config_parse_dhcp_use_dns, 0, 0
|
||||
DHCPv6.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp6_use_hostname)
|
||||
DHCPv6.UseFQDN, config_parse_bool, 0, offsetof(Network, dhcp6_use_fqdn)
|
||||
DHCPv6.UseNTP, config_parse_dhcp_use_ntp, 0, 0
|
||||
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, dhcp6_rapid_commit)
|
||||
DHCPv6.MUDURL, config_parse_dhcp6_mud_url, 0, 0
|
||||
|
@ -373,7 +373,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||
|
||||
.dhcp6_use_address = true,
|
||||
.dhcp6_use_dns = true,
|
||||
.dhcp6_use_hostname = true,
|
||||
.dhcp6_use_fqdn = true,
|
||||
.dhcp6_use_ntp = true,
|
||||
.dhcp6_rapid_commit = true,
|
||||
.dhcp6_route_metric = DHCP_ROUTE_METRIC,
|
||||
@ -664,7 +664,7 @@ static Network *network_free(Network *network) {
|
||||
|
||||
free(network->dhcp_server_timezone);
|
||||
|
||||
for (sd_dhcp_lease_server_type_t t = 0; t < _SD_DHCP_LEASE_SERVER_TYPE_MAX; t++)
|
||||
for (sd_dhcp_lease_server_type t = 0; t < _SD_DHCP_LEASE_SERVER_TYPE_MAX; t++)
|
||||
free(network->dhcp_server_emit[t].addresses);
|
||||
|
||||
set_free_free(network->dnssec_negative_trust_anchors);
|
||||
|
@ -159,7 +159,7 @@ struct Network {
|
||||
bool dhcp6_use_address;
|
||||
bool dhcp6_use_dns;
|
||||
bool dhcp6_use_dns_set;
|
||||
bool dhcp6_use_hostname;
|
||||
bool dhcp6_use_fqdn;
|
||||
bool dhcp6_use_ntp;
|
||||
bool dhcp6_use_ntp_set;
|
||||
bool dhcp6_rapid_commit;
|
||||
|
@ -65,7 +65,7 @@ DEFINE_STRING_TABLE_LOOKUP(duplicate_address_detection_address_family, AddressFa
|
||||
DEFINE_CONFIG_PARSE_ENUM(config_parse_link_local_address_family, link_local_address_family,
|
||||
AddressFamily, "Failed to parse option");
|
||||
DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_deprecated_address_family, AddressFamily);
|
||||
DEFINE_STRING_TABLE_LOOKUP(dhcp_lease_server_type, sd_dhcp_lease_server_type_t);
|
||||
DEFINE_STRING_TABLE_LOOKUP(dhcp_lease_server_type, sd_dhcp_lease_server_type);
|
||||
|
||||
static AddressFamily address_family_compat_from_string(const char *s) {
|
||||
if (streq_ptr(s, "yes")) /* compat name */
|
||||
|
@ -46,8 +46,8 @@ AddressFamily duplicate_address_detection_address_family_from_string(const char
|
||||
|
||||
AddressFamily dhcp_deprecated_address_family_from_string(const char *s) _pure_;
|
||||
|
||||
const char *dhcp_lease_server_type_to_string(sd_dhcp_lease_server_type_t t) _const_;
|
||||
sd_dhcp_lease_server_type_t dhcp_lease_server_type_from_string(const char *s) _pure_;
|
||||
const char *dhcp_lease_server_type_to_string(sd_dhcp_lease_server_type t) _const_;
|
||||
sd_dhcp_lease_server_type dhcp_lease_server_type_from_string(const char *s) _pure_;
|
||||
|
||||
int kernel_route_expiration_supported(void);
|
||||
|
||||
|
@ -46,10 +46,10 @@ int main(int argc, char **argv) {
|
||||
test_table_sparse(macvlan_mode, NETDEV_MACVLAN_MODE);
|
||||
test_table_sparse(address_family, ADDRESS_FAMILY);
|
||||
|
||||
assert_cc(sizeof(sd_lldp_event_t) == sizeof(int64_t));
|
||||
assert_cc(sizeof(sd_ndisc_event_t) == sizeof(int64_t));
|
||||
assert_cc(sizeof(sd_dhcp_lease_server_type_t) == sizeof(int64_t));
|
||||
assert_cc(sizeof(sd_genl_family_t) == sizeof(int64_t));
|
||||
assert_cc(sizeof(sd_lldp_event) == sizeof(int64_t));
|
||||
assert_cc(sizeof(sd_ndisc_event) == sizeof(int64_t));
|
||||
assert_cc(sizeof(sd_dhcp_lease_server_type) == sizeof(int64_t));
|
||||
assert_cc(sizeof(sd_genl_family) == sizeof(int64_t));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -1046,8 +1046,7 @@ void dns_transaction_process_reply(DnsTransaction *t, DnsPacket *p, bool encrypt
|
||||
* should hence not attempt to access the query or transaction
|
||||
* after calling this function. */
|
||||
|
||||
log_debug("Processing incoming packet of size %zu on transaction %" PRIu16" (rcode=%s).",
|
||||
p->size,
|
||||
log_debug("Processing incoming packet on transaction %" PRIu16" (rcode=%s).",
|
||||
t->id, dns_rcode_to_string(DNS_PACKET_RCODE(p)));
|
||||
|
||||
switch (t->scope->protocol) {
|
||||
@ -1212,8 +1211,7 @@ void dns_transaction_process_reply(DnsTransaction *t, DnsPacket *p, bool encrypt
|
||||
* servers often do not implement TCP, hence falling back to TCP on fragmentation is
|
||||
* counter-productive there.) */
|
||||
|
||||
log_debug("Reply fragmented, retrying via TCP. (Largest fragment size: %zu; Datagram size: %zu)",
|
||||
p->fragsize, p->size);
|
||||
log_debug("Reply fragmented, retrying via TCP.");
|
||||
retry_with_tcp = true;
|
||||
}
|
||||
}
|
||||
|
@ -926,10 +926,8 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
|
||||
p->ifindex = manager_find_ifindex(m, p->family, &p->destination);
|
||||
}
|
||||
|
||||
log_debug("Received %s UDP packet of size %zu, ifindex=%i, ttl=%i, fragsize=%zu",
|
||||
dns_protocol_to_string(protocol), p->size, p->ifindex, p->ttl, p->fragsize);
|
||||
|
||||
*ret = TAKE_PTR(p);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,8 @@ static int determine_state_file(
|
||||
|
||||
static int load_state(Context *c, const struct rfkill_event *event) {
|
||||
_cleanup_free_ char *state_file = NULL, *value = NULL;
|
||||
struct rfkill_event we;
|
||||
ssize_t l;
|
||||
int b, r;
|
||||
|
||||
assert(c);
|
||||
@ -166,22 +168,18 @@ static int load_state(Context *c, const struct rfkill_event *event) {
|
||||
if (b < 0)
|
||||
return log_error_errno(b, "Failed to parse state file %s: %m", state_file);
|
||||
|
||||
struct rfkill_event we = {
|
||||
.idx = event->idx,
|
||||
we = (struct rfkill_event) {
|
||||
.op = RFKILL_OP_CHANGE,
|
||||
.idx = event->idx,
|
||||
.soft = b,
|
||||
};
|
||||
assert_cc(offsetof(struct rfkill_event, op) < RFKILL_EVENT_SIZE_V1);
|
||||
assert_cc(offsetof(struct rfkill_event, soft) < RFKILL_EVENT_SIZE_V1);
|
||||
|
||||
ssize_t l = write(c->rfkill_fd, &we, sizeof we);
|
||||
l = write(c->rfkill_fd, &we, sizeof(we));
|
||||
if (l < 0)
|
||||
return log_error_errno(errno, "Failed to restore rfkill state for %i: %m", event->idx);
|
||||
if (l < RFKILL_EVENT_SIZE_V1)
|
||||
if (l != sizeof(we))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EIO),
|
||||
"Couldn't write rfkill event structure, too short (wrote %zd of %zu bytes).",
|
||||
l, sizeof we);
|
||||
log_debug("Writing struct rfkill_event successful (%zd of %zu bytes).", l, sizeof we);
|
||||
"Couldn't write rfkill event structure, too short.");
|
||||
|
||||
log_debug("Loaded state '%s' from %s.", one_zero(b), state_file);
|
||||
return 0;
|
||||
@ -307,15 +305,18 @@ static int run(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
struct rfkill_event event = {};
|
||||
struct rfkill_event event;
|
||||
const char *type;
|
||||
ssize_t l;
|
||||
|
||||
ssize_t l = read(c.rfkill_fd, &event, sizeof event);
|
||||
l = read(c.rfkill_fd, &event, sizeof(event));
|
||||
if (l < 0) {
|
||||
if (errno != EAGAIN)
|
||||
return log_error_errno(errno, "Failed to read from /dev/rfkill: %m");
|
||||
if (errno == EAGAIN) {
|
||||
|
||||
if (!ready) {
|
||||
/* Notify manager that we are now finished with processing whatever was
|
||||
/* Notify manager that we are
|
||||
* now finished with
|
||||
* processing whatever was
|
||||
* queued */
|
||||
(void) sd_notify(false, "READY=1");
|
||||
ready = true;
|
||||
@ -335,17 +336,13 @@ static int run(int argc, char *argv[]) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (l < RFKILL_EVENT_SIZE_V1)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short read of struct rfkill_event: (%zd < %d)",
|
||||
l, RFKILL_EVENT_SIZE_V1);
|
||||
log_debug("Reading struct rfkill_event: got %zd bytes.", l);
|
||||
log_error_errno(errno, "Failed to read from /dev/rfkill: %m");
|
||||
}
|
||||
|
||||
/* The event structure has more fields. We only care about the first few, so it's OK if we
|
||||
* don't read the full structure. */
|
||||
assert_cc(offsetof(struct rfkill_event, op) < RFKILL_EVENT_SIZE_V1);
|
||||
assert_cc(offsetof(struct rfkill_event, type) < RFKILL_EVENT_SIZE_V1);
|
||||
if (l != RFKILL_EVENT_SIZE_V1)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Read event structure of invalid size.");
|
||||
|
||||
const char *type = rfkill_type_to_string(event.type);
|
||||
type = rfkill_type_to_string(event.type);
|
||||
if (!type) {
|
||||
log_debug("An rfkill device of unknown type %i discovered, ignoring.", event.type);
|
||||
continue;
|
||||
|
@ -247,7 +247,7 @@ static int device_monitor_handler(sd_device_monitor *monitor, sd_device *device,
|
||||
|
||||
assert(w);
|
||||
|
||||
if (device_for_action(device, SD_DEVICE_REMOVE))
|
||||
if (device_for_action(device, DEVICE_ACTION_REMOVE))
|
||||
return 0;
|
||||
|
||||
r = sd_device_get_parent(device, &pp);
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "device-nodes.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
#include "env-file.h"
|
||||
#include "escape.h"
|
||||
@ -176,7 +175,7 @@ static int device_monitor_handler(sd_device_monitor *monitor, sd_device *device,
|
||||
* (And yes, we only need to special case REMOVE. It's the only "negative" event type, where a device
|
||||
* ceases to exist. All other event types are "positive": the device exists and is registered in the
|
||||
* udev database, thus whenever we see the event, we can consider it initialized.) */
|
||||
if (device_for_action(device, SD_DEVICE_REMOVE))
|
||||
if (device_for_action(device, DEVICE_ACTION_REMOVE))
|
||||
return 0;
|
||||
|
||||
if (data->sysname && sd_device_get_sysname(device, &sysname) >= 0 && streq(sysname, data->sysname))
|
||||
@ -319,29 +318,26 @@ int device_is_renaming(sd_device *dev) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool device_for_action(sd_device *dev, sd_device_action_t a) {
|
||||
sd_device_action_t b;
|
||||
bool device_for_action(sd_device *dev, DeviceAction action) {
|
||||
DeviceAction a;
|
||||
|
||||
assert(dev);
|
||||
|
||||
if (a < 0)
|
||||
if (device_get_action(dev, &a) < 0)
|
||||
return false;
|
||||
|
||||
if (sd_device_get_action(dev, &b) < 0)
|
||||
return false;
|
||||
|
||||
return a == b;
|
||||
return a == action;
|
||||
}
|
||||
|
||||
void log_device_uevent(sd_device *device, const char *str) {
|
||||
sd_device_action_t action = _SD_DEVICE_ACTION_INVALID;
|
||||
DeviceAction action = _DEVICE_ACTION_INVALID;
|
||||
uint64_t seqnum = 0;
|
||||
|
||||
if (!DEBUG_LOGGING)
|
||||
return;
|
||||
|
||||
(void) sd_device_get_seqnum(device, &seqnum);
|
||||
(void) sd_device_get_action(device, &action);
|
||||
(void) device_get_seqnum(device, &seqnum);
|
||||
(void) device_get_action(device, &action);
|
||||
log_device_debug(device, "%s%s(SEQNUM=%"PRIu64", ACTION=%s)",
|
||||
strempty(str), isempty(str) ? "" : " ",
|
||||
seqnum, strna(device_action_to_string(action)));
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "sd-device.h"
|
||||
|
||||
#include "device-private.h"
|
||||
#include "time-util.h"
|
||||
|
||||
#define UDEV_NAME_SIZE 512
|
||||
@ -34,8 +35,7 @@ static inline int udev_parse_config(void) {
|
||||
int device_wait_for_initialization(sd_device *device, const char *subsystem, usec_t deadline, sd_device **ret);
|
||||
int device_wait_for_devlink(const char *path, const char *subsystem, usec_t deadline, sd_device **ret);
|
||||
int device_is_renaming(sd_device *dev);
|
||||
|
||||
bool device_for_action(sd_device *dev, sd_device_action_t action);
|
||||
bool device_for_action(sd_device *dev, DeviceAction action);
|
||||
|
||||
void log_device_uevent(sd_device *device, const char *str);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid) {
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL;
|
||||
sd_genl_family_t family;
|
||||
sd_genl_family family;
|
||||
int r;
|
||||
|
||||
assert(genl);
|
||||
@ -75,7 +75,7 @@ nodata:
|
||||
|
||||
int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid) {
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL;
|
||||
sd_genl_family_t family;
|
||||
sd_genl_family family;
|
||||
int r;
|
||||
|
||||
assert(genl);
|
||||
|
@ -17,9 +17,7 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@ -33,20 +31,6 @@ typedef struct sd_device sd_device;
|
||||
typedef struct sd_device_enumerator sd_device_enumerator;
|
||||
typedef struct sd_device_monitor sd_device_monitor;
|
||||
|
||||
typedef enum sd_device_action_t {
|
||||
SD_DEVICE_ADD,
|
||||
SD_DEVICE_REMOVE,
|
||||
SD_DEVICE_CHANGE,
|
||||
SD_DEVICE_MOVE,
|
||||
SD_DEVICE_ONLINE,
|
||||
SD_DEVICE_OFFLINE,
|
||||
SD_DEVICE_BIND,
|
||||
SD_DEVICE_UNBIND,
|
||||
_SD_DEVICE_ACTION_MAX,
|
||||
_SD_DEVICE_ACTION_INVALID = -EINVAL,
|
||||
_SD_ENUM_FORCE_S64(DEVICE_ACTION),
|
||||
} sd_device_action_t;
|
||||
|
||||
/* callback */
|
||||
|
||||
typedef int (*sd_device_monitor_handler_t)(sd_device_monitor *m, sd_device *device, void *userdata);
|
||||
@ -60,7 +44,6 @@ int sd_device_new_from_syspath(sd_device **ret, const char *syspath);
|
||||
int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum);
|
||||
int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *subsystem, const char *sysname);
|
||||
int sd_device_new_from_device_id(sd_device **ret, const char *id);
|
||||
int sd_device_new_from_stat_rdev(sd_device **ret, const struct stat *st);
|
||||
|
||||
int sd_device_get_parent(sd_device *child, sd_device **ret);
|
||||
int sd_device_get_parent_with_subsystem_devtype(sd_device *child, const char *subsystem, const char *devtype, sd_device **ret);
|
||||
@ -75,8 +58,6 @@ int sd_device_get_devpath(sd_device *device, const char **ret);
|
||||
int sd_device_get_devname(sd_device *device, const char **ret);
|
||||
int sd_device_get_sysname(sd_device *device, const char **ret);
|
||||
int sd_device_get_sysnum(sd_device *device, const char **ret);
|
||||
int sd_device_get_action(sd_device *device, sd_device_action_t *ret);
|
||||
int sd_device_get_seqnum(sd_device *device, uint64_t *ret);
|
||||
|
||||
int sd_device_get_is_initialized(sd_device *device);
|
||||
int sd_device_get_usec_since_initialized(sd_device *device, uint64_t *usec);
|
||||
|
@ -34,7 +34,7 @@ typedef struct sd_dhcp_route sd_dhcp_route;
|
||||
sd_dhcp_lease *sd_dhcp_lease_ref(sd_dhcp_lease *lease);
|
||||
sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease);
|
||||
|
||||
typedef enum sd_dhcp_lease_server_type_t {
|
||||
typedef enum sd_dhcp_lease_server_type {
|
||||
SD_DHCP_LEASE_DNS,
|
||||
SD_DHCP_LEASE_NTP,
|
||||
SD_DHCP_LEASE_SIP,
|
||||
@ -44,7 +44,7 @@ typedef enum sd_dhcp_lease_server_type_t {
|
||||
_SD_DHCP_LEASE_SERVER_TYPE_MAX,
|
||||
_SD_DHCP_LEASE_SERVER_TYPE_INVALID = -EINVAL,
|
||||
_SD_ENUM_FORCE_S64(DHCP_LEASE_SERVER_TYPE),
|
||||
} sd_dhcp_lease_server_type_t;
|
||||
} sd_dhcp_lease_server_type;
|
||||
|
||||
int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr);
|
||||
int sd_dhcp_lease_get_lifetime(sd_dhcp_lease *lease, uint32_t *lifetime);
|
||||
@ -55,7 +55,7 @@ int sd_dhcp_lease_get_netmask(sd_dhcp_lease *lease, struct in_addr *addr);
|
||||
int sd_dhcp_lease_get_router(sd_dhcp_lease *lease, const struct in_addr **addr);
|
||||
int sd_dhcp_lease_get_next_server(sd_dhcp_lease *lease, struct in_addr *addr);
|
||||
int sd_dhcp_lease_get_server_identifier(sd_dhcp_lease *lease, struct in_addr *addr);
|
||||
int sd_dhcp_lease_get_servers(sd_dhcp_lease *lease, sd_dhcp_lease_server_type_t what, const struct in_addr **addr);
|
||||
int sd_dhcp_lease_get_servers(sd_dhcp_lease *lease, sd_dhcp_lease_server_type what, const struct in_addr **addr);
|
||||
int sd_dhcp_lease_get_dns(sd_dhcp_lease *lease, const struct in_addr **addr);
|
||||
int sd_dhcp_lease_get_ntp(sd_dhcp_lease *lease, const struct in_addr **addr);
|
||||
int sd_dhcp_lease_get_sip(sd_dhcp_lease *lease, const struct in_addr **addr);
|
||||
|
@ -60,7 +60,7 @@ int sd_dhcp_server_set_emit_router(sd_dhcp_server *server, int enabled);
|
||||
|
||||
int sd_dhcp_server_set_servers(
|
||||
sd_dhcp_server *server,
|
||||
sd_dhcp_lease_server_type_t what,
|
||||
sd_dhcp_lease_server_type what,
|
||||
const struct in_addr addresses[],
|
||||
size_t n_addresses);
|
||||
|
||||
|
@ -122,7 +122,7 @@ enum {
|
||||
typedef struct sd_lldp sd_lldp;
|
||||
typedef struct sd_lldp_neighbor sd_lldp_neighbor;
|
||||
|
||||
typedef enum sd_lldp_event_t {
|
||||
typedef enum sd_lldp_event {
|
||||
SD_LLDP_EVENT_ADDED,
|
||||
SD_LLDP_EVENT_REMOVED,
|
||||
SD_LLDP_EVENT_UPDATED,
|
||||
@ -130,9 +130,9 @@ typedef enum sd_lldp_event_t {
|
||||
_SD_LLDP_EVENT_MAX,
|
||||
_SD_LLDP_EVENT_INVALID = -EINVAL,
|
||||
_SD_ENUM_FORCE_S64(LLDP_EVENT),
|
||||
} sd_lldp_event_t;
|
||||
} sd_lldp_event;
|
||||
|
||||
typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event_t event, sd_lldp_neighbor *n, void *userdata);
|
||||
typedef void (*sd_lldp_callback_t)(sd_lldp *lldp, sd_lldp_event event, sd_lldp_neighbor *n, void *userdata);
|
||||
|
||||
int sd_lldp_new(sd_lldp **ret);
|
||||
sd_lldp* sd_lldp_ref(sd_lldp *lldp);
|
||||
|
@ -55,15 +55,15 @@ enum {
|
||||
typedef struct sd_ndisc sd_ndisc;
|
||||
typedef struct sd_ndisc_router sd_ndisc_router;
|
||||
|
||||
typedef enum sd_ndisc_event_t {
|
||||
typedef enum sd_ndisc_event {
|
||||
SD_NDISC_EVENT_TIMEOUT,
|
||||
SD_NDISC_EVENT_ROUTER,
|
||||
_SD_NDISC_EVENT_MAX,
|
||||
_SD_NDISC_EVENT_INVALID = -EINVAL,
|
||||
_SD_ENUM_FORCE_S64(NDISC_EVENT),
|
||||
} sd_ndisc_event_t;
|
||||
} sd_ndisc_event;
|
||||
|
||||
typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event_t event, sd_ndisc_router *rt, void *userdata);
|
||||
typedef void (*sd_ndisc_callback_t)(sd_ndisc *nd, sd_ndisc_event event, sd_ndisc_router *rt, void *userdata);
|
||||
|
||||
int sd_ndisc_new(sd_ndisc **ret);
|
||||
sd_ndisc *sd_ndisc_ref(sd_ndisc *nd);
|
||||
|
@ -35,7 +35,7 @@ typedef struct sd_genl_socket sd_genl_socket;
|
||||
typedef struct sd_netlink_message sd_netlink_message;
|
||||
typedef struct sd_netlink_slot sd_netlink_slot;
|
||||
|
||||
typedef enum sd_genl_family_t {
|
||||
typedef enum sd_genl_family {
|
||||
SD_GENL_ERROR,
|
||||
SD_GENL_DONE,
|
||||
SD_GENL_ID_CTRL,
|
||||
@ -47,7 +47,7 @@ typedef enum sd_genl_family_t {
|
||||
_SD_GENL_FAMILY_MAX,
|
||||
_SD_GENL_FAMILY_INVALID = -EINVAL,
|
||||
_SD_ENUM_FORCE_S64(GENL_FAMILY)
|
||||
} sd_genl_family_t;
|
||||
} sd_genl_family;
|
||||
|
||||
/* callback */
|
||||
|
||||
@ -249,8 +249,8 @@ int sd_nfnl_nft_message_add_setelem_end(sd_netlink_message *m);
|
||||
|
||||
/* genl */
|
||||
int sd_genl_socket_open(sd_netlink **nl);
|
||||
int sd_genl_message_new(sd_netlink *nl, sd_genl_family_t family, uint8_t cmd, sd_netlink_message **m);
|
||||
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family_t *family);
|
||||
int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **m);
|
||||
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family *family);
|
||||
|
||||
/* slot */
|
||||
sd_netlink_slot *sd_netlink_slot_ref(sd_netlink_slot *nl);
|
||||
|
@ -50,7 +50,7 @@ int main(int argc, char **argv) {
|
||||
test_table(collect_mode, COLLECT_MODE);
|
||||
test_table(condition_result, CONDITION_RESULT);
|
||||
test_table(condition_type, CONDITION_TYPE);
|
||||
test_table(device_action, SD_DEVICE_ACTION);
|
||||
test_table(device_action, DEVICE_ACTION);
|
||||
test_table(device_state, DEVICE_STATE);
|
||||
test_table(dns_over_tls_mode, DNS_OVER_TLS_MODE);
|
||||
test_table(dnssec_mode, DNSSEC_MODE);
|
||||
@ -125,7 +125,5 @@ int main(int argc, char **argv) {
|
||||
|
||||
test_table_sparse(object_compressed, OBJECT_COMPRESSED);
|
||||
|
||||
assert_cc(sizeof(sd_device_action_t) == sizeof(int64_t));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "device-internal.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -594,7 +594,7 @@ static int link_config_apply_alternative_names(sd_netlink **rtnl, const link_con
|
||||
|
||||
int link_config_apply(link_config_ctx *ctx, const link_config *config, sd_device *device, const char **ret_name) {
|
||||
const char *new_name;
|
||||
sd_device_action_t a;
|
||||
DeviceAction a;
|
||||
int r;
|
||||
|
||||
assert(ctx);
|
||||
@ -602,11 +602,11 @@ int link_config_apply(link_config_ctx *ctx, const link_config *config, sd_device
|
||||
assert(device);
|
||||
assert(ret_name);
|
||||
|
||||
r = sd_device_get_action(device, &a);
|
||||
r = device_get_action(device, &a);
|
||||
if (r < 0)
|
||||
return log_device_error_errno(device, r, "Failed to get ACTION= property: %m");
|
||||
|
||||
if (!IN_SET(a, SD_DEVICE_ADD, SD_DEVICE_BIND, SD_DEVICE_MOVE)) {
|
||||
if (!IN_SET(a, DEVICE_ACTION_ADD, DEVICE_ACTION_BIND, DEVICE_ACTION_MOVE)) {
|
||||
log_device_debug(device, "Skipping to apply .link settings on '%s' uevent.", device_action_to_string(a));
|
||||
|
||||
r = sd_device_get_sysname(device, ret_name);
|
||||
@ -624,7 +624,7 @@ int link_config_apply(link_config_ctx *ctx, const link_config *config, sd_device
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (a == SD_DEVICE_MOVE) {
|
||||
if (a == DEVICE_ACTION_MOVE) {
|
||||
log_device_debug(device, "Skipping to apply Name= and NamePolicy= on '%s' uevent.", device_action_to_string(a));
|
||||
|
||||
r = sd_device_get_sysname(device, &new_name);
|
||||
|
@ -831,7 +831,7 @@ static int rename_netif(UdevEvent *event) {
|
||||
if (streq(event->name, oldname))
|
||||
return 0; /* The interface name is already requested name. */
|
||||
|
||||
if (!device_for_action(dev, SD_DEVICE_ADD))
|
||||
if (!device_for_action(dev, DEVICE_ACTION_ADD))
|
||||
return 0; /* Rename the interface only when it is added. */
|
||||
|
||||
r = sd_device_get_ifindex(dev, &ifindex);
|
||||
@ -904,7 +904,7 @@ static int update_devnode(UdevEvent *event) {
|
||||
/* If group is set, but mode is not set, "upgrade" mode for the group. */
|
||||
event->mode = 0660;
|
||||
|
||||
bool apply_mac = device_for_action(dev, SD_DEVICE_ADD);
|
||||
bool apply_mac = device_for_action(dev, DEVICE_ACTION_ADD);
|
||||
|
||||
return udev_node_add(dev, apply_mac, event->mode, event->uid, event->gid, event->seclabel_list);
|
||||
}
|
||||
@ -975,7 +975,7 @@ int udev_event_execute_rules(UdevEvent *event,
|
||||
Hashmap *properties_list,
|
||||
UdevRules *rules) {
|
||||
const char *subsystem;
|
||||
sd_device_action_t action;
|
||||
DeviceAction action;
|
||||
sd_device *dev;
|
||||
int r;
|
||||
|
||||
@ -988,11 +988,11 @@ int udev_event_execute_rules(UdevEvent *event,
|
||||
if (r < 0)
|
||||
return log_device_error_errno(dev, r, "Failed to get subsystem: %m");
|
||||
|
||||
r = sd_device_get_action(dev, &action);
|
||||
r = device_get_action(dev, &action);
|
||||
if (r < 0)
|
||||
return log_device_error_errno(dev, r, "Failed to get ACTION: %m");
|
||||
|
||||
if (action == SD_DEVICE_REMOVE) {
|
||||
if (action == DEVICE_ACTION_REMOVE) {
|
||||
event_execute_rules_on_remove(event, timeout_usec, timeout_signal, properties_list, rules);
|
||||
return 0;
|
||||
}
|
||||
@ -1009,7 +1009,7 @@ int udev_event_execute_rules(UdevEvent *event,
|
||||
/* Disable watch during event processing. */
|
||||
(void) udev_watch_end(event->dev_db_clone);
|
||||
|
||||
if (action == SD_DEVICE_MOVE) {
|
||||
if (action == DEVICE_ACTION_MOVE) {
|
||||
r = udev_event_on_move(event->dev);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "architecture.h"
|
||||
#include "conf-files.h"
|
||||
#include "def.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
#include "dirent-util.h"
|
||||
#include "escape.h"
|
||||
@ -1546,9 +1545,9 @@ static int udev_rule_apply_token_to_event(
|
||||
|
||||
switch (token->type) {
|
||||
case TK_M_ACTION: {
|
||||
sd_device_action_t a;
|
||||
DeviceAction a;
|
||||
|
||||
r = sd_device_get_action(dev, &a);
|
||||
r = device_get_action(dev, &a);
|
||||
if (r < 0)
|
||||
return log_rule_error_errno(dev, rules, r, "Failed to get uevent action type: %m");
|
||||
|
||||
@ -2227,14 +2226,14 @@ static int udev_rule_apply_line_to_event(
|
||||
UdevRuleLineType mask = LINE_HAS_GOTO | LINE_UPDATE_SOMETHING;
|
||||
UdevRuleToken *token, *next_token;
|
||||
bool parents_done = false;
|
||||
sd_device_action_t action;
|
||||
DeviceAction action;
|
||||
int r;
|
||||
|
||||
r = sd_device_get_action(event->dev, &action);
|
||||
r = device_get_action(event->dev, &action);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (action != SD_DEVICE_REMOVE) {
|
||||
if (action != DEVICE_ACTION_REMOVE) {
|
||||
if (sd_device_get_devnum(event->dev, NULL) >= 0)
|
||||
mask |= LINE_HAS_DEVLINK;
|
||||
|
||||
|
@ -27,7 +27,7 @@ static Set *arg_tag_filter = NULL;
|
||||
static Hashmap *arg_subsystem_filter = NULL;
|
||||
|
||||
static int device_monitor_handler(sd_device_monitor *monitor, sd_device *device, void *userdata) {
|
||||
sd_device_action_t action = _SD_DEVICE_ACTION_INVALID;
|
||||
DeviceAction action = _DEVICE_ACTION_INVALID;
|
||||
const char *devpath = NULL, *subsystem = NULL;
|
||||
MonitorNetlinkGroup group = PTR_TO_INT(userdata);
|
||||
struct timespec ts;
|
||||
@ -35,7 +35,7 @@ static int device_monitor_handler(sd_device_monitor *monitor, sd_device *device,
|
||||
assert(device);
|
||||
assert(IN_SET(group, MONITOR_GROUP_UDEV, MONITOR_GROUP_KERNEL));
|
||||
|
||||
(void) sd_device_get_action(device, &action);
|
||||
(void) device_get_action(device, &action);
|
||||
(void) sd_device_get_devpath(device, &devpath);
|
||||
(void) sd_device_get_subsystem(device, &subsystem);
|
||||
|
||||
|
@ -54,7 +54,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
while ((c = getopt_long(argc, argv, "a:N:Vh", options, NULL)) >= 0)
|
||||
switch (c) {
|
||||
case 'a': {
|
||||
sd_device_action_t a;
|
||||
DeviceAction a;
|
||||
|
||||
if (streq(optarg, "help")) {
|
||||
dump_device_action_table();
|
||||
@ -63,9 +63,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
a = device_action_from_string(optarg);
|
||||
if (a < 0)
|
||||
return log_error_errno(a, "Invalid action '%s'", optarg);
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Invalid action '%s'", optarg);
|
||||
|
||||
arg_action = device_action_to_string(a);
|
||||
arg_action = optarg;
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
|
@ -211,7 +211,7 @@ int trigger_main(int argc, char *argv[], void *userdata) {
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown type --type=%s", optarg);
|
||||
break;
|
||||
case 'c': {
|
||||
sd_device_action_t a;
|
||||
DeviceAction a;
|
||||
|
||||
if (streq(optarg, "help")) {
|
||||
dump_device_action_table();
|
||||
@ -222,7 +222,7 @@ int trigger_main(int argc, char *argv[], void *userdata) {
|
||||
if (a < 0)
|
||||
return log_error_errno(a, "Unknown action '%s'", optarg);
|
||||
|
||||
action = device_action_to_string(a);
|
||||
action = optarg;
|
||||
break;
|
||||
}
|
||||
case 's':
|
||||
|
@ -20,7 +20,7 @@ static int find_device_from_path(const char *path, sd_device **ret) {
|
||||
if (stat(path, &st) < 0)
|
||||
return -errno;
|
||||
|
||||
return sd_device_new_from_stat_rdev(ret, &st);
|
||||
return device_new_from_stat_rdev(ret, &st);
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
|
@ -325,12 +325,16 @@ static int worker_lock_block_device(sd_device *dev, int *ret_fd) {
|
||||
assert(dev);
|
||||
assert(ret_fd);
|
||||
|
||||
/* Take a shared lock on the device node; this establishes a concept of device "ownership" to
|
||||
* serialize device access. External processes holding an exclusive lock will cause udev to skip the
|
||||
* event handling; in the case udev acquired the lock, the external process can block until udev has
|
||||
* finished its event handling. */
|
||||
/*
|
||||
* Take a shared lock on the device node; this establishes
|
||||
* a concept of device "ownership" to serialize device
|
||||
* access. External processes holding an exclusive lock will
|
||||
* cause udev to skip the event handling; in the case udev
|
||||
* acquired the lock, the external process can block until
|
||||
* udev has finished its event handling.
|
||||
*/
|
||||
|
||||
if (device_for_action(dev, SD_DEVICE_REMOVE))
|
||||
if (device_for_action(dev, DEVICE_ACTION_REMOVE))
|
||||
return 0;
|
||||
|
||||
r = sd_device_get_subsystem(dev, &val);
|
||||
@ -388,7 +392,7 @@ static int worker_mark_block_device_read_only(sd_device *dev) {
|
||||
/* Do this only once, when the block device is new. If the device is later retriggered let's not
|
||||
* toggle the bit again, so that people can boot up with full read-only mode and then unset the bit
|
||||
* for specific devices only. */
|
||||
if (!device_for_action(dev, SD_DEVICE_ADD))
|
||||
if (!device_for_action(dev, DEVICE_ACTION_ADD))
|
||||
return 0;
|
||||
|
||||
r = sd_device_get_subsystem(dev, &val);
|
||||
@ -690,7 +694,7 @@ static int event_queue_insert(Manager *manager, sd_device *dev) {
|
||||
assert(manager->pid == getpid_cached());
|
||||
|
||||
/* We only accepts devices received by device monitor. */
|
||||
r = sd_device_get_seqnum(dev, &seqnum);
|
||||
r = device_get_seqnum(dev, &seqnum);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -127,7 +127,7 @@ FallbackLeaseLifetimeSec=
|
||||
UseAddress=
|
||||
UseNTP=
|
||||
UseDNS=
|
||||
UseHostname=
|
||||
UseFQDN=
|
||||
RapidCommit=
|
||||
ForceDHCPv6PDOtherInformation=
|
||||
PrefixDelegationHint=
|
||||
|
Loading…
x
Reference in New Issue
Block a user