diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | man/systemd.link.xml | 4 | ||||
-rw-r--r-- | man/systemd.network.xml | 7 | ||||
-rw-r--r-- | rules/60-block.rules | 2 | ||||
-rw-r--r-- | rules/60-persistent-storage.rules | 2 | ||||
-rw-r--r-- | src/core/busname.c | 2 | ||||
-rw-r--r-- | src/core/kmod-setup.c | 20 | ||||
-rw-r--r-- | src/core/manager.c | 2 | ||||
-rw-r--r-- | src/core/socket.c | 4 | ||||
-rw-r--r-- | src/hwdb/hwdb.c | 1 | ||||
-rw-r--r-- | src/libsystemd-network/lldp-tlv.c | 2 | ||||
-rw-r--r-- | src/network/networkctl.c | 2 | ||||
-rw-r--r-- | src/network/networkd-dhcp4.c | 2 | ||||
-rw-r--r-- | src/network/networkd-ipv4ll.c | 4 | ||||
-rw-r--r-- | src/network/networkd-link.c | 18 | ||||
-rw-r--r-- | src/network/networkd-manager.c | 4 | ||||
-rw-r--r-- | src/network/networkd.h | 1 | ||||
-rw-r--r-- | src/nss-resolve/nss-resolve.c | 14 | ||||
-rw-r--r-- | src/shared/efivars.c | 2 | ||||
-rw-r--r-- | src/shared/util.c | 17 | ||||
-rw-r--r-- | src/udev/udev-event.c | 6 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 2 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 1 | ||||
-rw-r--r-- | src/udev/udevd.c | 2 | ||||
-rw-r--r-- | units/systemd-hwdb-update.service.in | 1 |
25 files changed, 63 insertions, 62 deletions
@@ -1,6 +1,7 @@ # systemd - System and Service Manager -[![Build Status](https://semaphoreci.com/api/v1/projects/28a5a3ca-3c56-4078-8b5e-7ed6ef912e14/443470/shields_badge.svg)](https://semaphoreci.com/systemd/systemd) +[![Build Status](https://semaphoreci.com/api/v1/projects/28a5a3ca-3c56-4078-8b5e-7ed6ef912e14/443470/shields_badge.svg)](https://semaphoreci.com/systemd/systemd)<br/> +[![Coverity Scan Status](https://scan.coverity.com/projects/350/badge.svg)](https://scan.coverity.com/projects/350) ## Details diff --git a/man/systemd.link.xml b/man/systemd.link.xml index 5db06842bd..723364f4d1 100644 --- a/man/systemd.link.xml +++ b/man/systemd.link.xml @@ -232,7 +232,9 @@ <para>If the kernel is using a random MAC address, nothing is done. Otherwise, a new address is randomly generated each time the device appears, typically at - boot.</para> + boot. Either way the random address will have the + <literal>unicast</literal> and + <literal>locally administered</literal> bits set.</para> </listitem> </varlistentry> </variablelist> diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 54fef4c9c4..bd061c270a 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -366,8 +366,7 @@ 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, or <literal>kernel</literal>, which preserves existing sysctl settings. - This controls the + family. This controls the <filename>net.ipv4.conf.<interface>.forwarding</filename> and <filename>net.ipv6.conf.<interface>.forwarding</filename> @@ -376,8 +375,8 @@ for details about sysctl options). Defaults to <literal>no</literal>.</para> - <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 + <para>Note: unless this option is turned on, 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/rules/60-block.rules b/rules/60-block.rules index a69d648023..c74caca49f 100644 --- a/rules/60-block.rules +++ b/rules/60-block.rules @@ -8,4 +8,4 @@ ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_ ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" # watch metadata changes, caused by tools closing the device node which was opened for writing -ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*|nvme*|sd*|vd*", OPTIONS+="watch" +ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*|nvme*|sd*|vd*|xvd*", OPTIONS+="watch" diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules index 64c5f1cfdd..2daeb6db42 100644 --- a/rules/60-persistent-storage.rules +++ b/rules/60-persistent-storage.rules @@ -6,7 +6,7 @@ ACTION=="remove", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" -KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|bcache*|xvd*", GOTO="persistent_storage_end" +KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*", GOTO="persistent_storage_end" # ignore partitions that span the entire disk TEST=="whole_disk", GOTO="persistent_storage_end" diff --git a/src/core/busname.c b/src/core/busname.c index 11f3b98009..3f5abbcb24 100644 --- a/src/core/busname.c +++ b/src/core/busname.c @@ -125,7 +125,7 @@ static int busname_arm_timer(BusName *n) { return sd_event_source_set_enabled(n->timer_event_source, SD_EVENT_ONESHOT); } - r = sd_event_add_time( + r = sd_event_add_time( UNIT(n)->manager->event, &n->timer_event_source, CLOCK_MONOTONIC, diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c index 96379058a1..cf543c81a3 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -53,26 +53,27 @@ int kmod_setup(void) { static const struct { const char *module; const char *path; - bool warn; + bool warn_if_unavailable:1; + bool warn_if_module:1; bool (*condition_fn)(void); } kmod_table[] = { /* auto-loading on use doesn't work before udev is up */ - { "autofs4", "/sys/class/misc/autofs", true, NULL }, + { "autofs4", "/sys/class/misc/autofs", true, false, NULL }, /* early configure of ::1 on the loopback device */ - { "ipv6", "/sys/module/ipv6", false, NULL }, + { "ipv6", "/sys/module/ipv6", false, true, NULL }, /* this should never be a module */ - { "unix", "/proc/net/unix", true, NULL }, + { "unix", "/proc/net/unix", true, true, NULL }, #ifdef ENABLE_KDBUS /* IPC is needed before we bring up any other services */ - { "kdbus", "/sys/fs/kdbus", false, is_kdbus_wanted }, + { "kdbus", "/sys/fs/kdbus", false, false, is_kdbus_wanted }, #endif #ifdef HAVE_LIBIPTC /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */ - { "ip_tables", "/proc/net/ip_tables_names", false, NULL }, + { "ip_tables", "/proc/net/ip_tables_names", false, false, NULL }, #endif }; struct kmod_ctx *ctx = NULL; @@ -91,7 +92,7 @@ int kmod_setup(void) { if (kmod_table[i].condition_fn && !kmod_table[i].condition_fn()) continue; - if (kmod_table[i].warn) + if (kmod_table[i].warn_if_module) log_debug("Your kernel apparently lacks built-in %s support. Might be " "a good idea to compile it in. We'll now try to work around " "this by loading the module...", kmod_table[i].module); @@ -116,8 +117,9 @@ 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 if (kmod_table[i].warn) - log_error("Failed to insert module '%s'", 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)); kmod_module_unref(mod); } diff --git a/src/core/manager.c b/src/core/manager.c index a1c54339ea..564fb5d579 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -665,7 +665,7 @@ static int manager_setup_notify(Manager *m) { if (m->notify_fd < 0) { _cleanup_close_ int fd = -1; - union sockaddr_union sa = { + union sockaddr_union sa = { .sa.sa_family = AF_UNIX, }; static const int one = 1; diff --git a/src/core/socket.c b/src/core/socket.c index fc5eb1464a..0239962055 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -832,7 +832,7 @@ static void socket_apply_socket_options(Socket *s, int fd) { } if (s->keep_alive_interval) { - int value = s->keep_alive_interval / USEC_PER_SEC; + int value = s->keep_alive_interval / USEC_PER_SEC; if (setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &value, sizeof(value)) < 0) log_unit_warning_errno(UNIT(s), errno, "TCP_KEEPINTVL failed: %m"); } @@ -2589,7 +2589,7 @@ static void socket_trigger_notify(Unit *u, Unit *other) { /* Don't propagate state changes from the service if we are already down or accepting connections */ - if ((s->state != SOCKET_RUNNING && + if ((s->state != SOCKET_RUNNING && s->state != SOCKET_LISTENING) || s->accept) return; diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c index 446de3a2fc..62b76c9e89 100644 --- a/src/hwdb/hwdb.c +++ b/src/hwdb/hwdb.c @@ -43,6 +43,7 @@ static const char *arg_root = ""; static const char * const conf_file_dirs[] = { "/etc/udev/hwdb.d", + "/run/udev/hwdb.d", UDEVLIBEXECDIR "/hwdb.d", NULL }; diff --git a/src/libsystemd-network/lldp-tlv.c b/src/libsystemd-network/lldp-tlv.c index e32783f3eb..0cea5b10a6 100644 --- a/src/libsystemd-network/lldp-tlv.c +++ b/src/libsystemd-network/lldp-tlv.c @@ -221,7 +221,7 @@ int tlv_packet_read_string(tlv_packet *m, char **data, uint16_t *data_length) { return r; *data = (char *) val; - *data_length = m->container->length; + *data_length = m->container->length; m->container->read_pos += m->container->length; diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 3454394977..68925debe6 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -814,7 +814,7 @@ static char *lldp_system_caps(uint16_t cap) { } if (cap & LLDP_SYSTEM_CAPABILITIES_ROUTER) { - s = strjoin(t, lldp_system_capability_to_string(LLDP_SYSTEM_CAPABILITIES_ROUTER), " ", NULL); + s = strjoin(t, lldp_system_capability_to_string(LLDP_SYSTEM_CAPABILITIES_ROUTER), " ", NULL); if (!s) return NULL; diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index 20aee53d6e..71cc722bcc 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -561,7 +561,7 @@ int dhcp4_configure(Link *link) { assert(link); assert(link->network); - assert(IN_SET(link->network->dhcp, ADDRESS_FAMILY_YES, ADDRESS_FAMILY_IPV4)); + assert(link->network->dhcp & ADDRESS_FAMILY_IPV4); r = sd_dhcp_client_new(&link->dhcp_client); if (r < 0) diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c index 8050801e19..14b8770429 100644 --- a/src/network/networkd-ipv4ll.c +++ b/src/network/networkd-ipv4ll.c @@ -34,7 +34,7 @@ static int ipv4ll_address_lost(Link *link) { assert(link); link->ipv4ll_route = false; - link->ipv4ll_address = false; + link->ipv4ll_address = false; r = sd_ipv4ll_get_address(link->ipv4ll, &addr); if (r < 0) @@ -209,7 +209,7 @@ int ipv4ll_configure(Link *link) { assert(link); assert(link->network); - assert(IN_SET(link->network->link_local, ADDRESS_FAMILY_IPV4, ADDRESS_FAMILY_YES)); + assert(link->network->link_local & ADDRESS_FAMILY_IPV4); r = sd_ipv4ll_new(&link->ipv4ll); if (r < 0) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index b30fd7ae89..127bc1249a 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -40,7 +40,7 @@ bool link_dhcp6_enabled(Link *link) { if (!link->network) return false; - return IN_SET(link->network->dhcp, ADDRESS_FAMILY_IPV6, ADDRESS_FAMILY_YES); + return link->network->dhcp & ADDRESS_FAMILY_IPV6; } bool link_dhcp4_enabled(Link *link) { @@ -50,7 +50,7 @@ bool link_dhcp4_enabled(Link *link) { if (!link->network) return false; - return IN_SET(link->network->dhcp, ADDRESS_FAMILY_IPV4, ADDRESS_FAMILY_YES); + return link->network->dhcp & ADDRESS_FAMILY_IPV4; } bool link_dhcp4_server_enabled(Link *link) { @@ -70,7 +70,7 @@ bool link_ipv4ll_enabled(Link *link) { if (!link->network) return false; - return IN_SET(link->network->link_local, ADDRESS_FAMILY_IPV4, ADDRESS_FAMILY_YES); + return link->network->link_local & ADDRESS_FAMILY_IPV4; } bool link_ipv6ll_enabled(Link *link) { @@ -80,7 +80,7 @@ bool link_ipv6ll_enabled(Link *link) { if (!link->network) return false; - return IN_SET(link->network->link_local, ADDRESS_FAMILY_IPV6, ADDRESS_FAMILY_YES); + return link->network->link_local & ADDRESS_FAMILY_IPV6; } bool link_lldp_enabled(Link *link) { @@ -103,7 +103,7 @@ static bool link_ipv4_forward_enabled(Link *link) { if (!link->network) return false; - return IN_SET(link->network->ip_forward, ADDRESS_FAMILY_IPV4, ADDRESS_FAMILY_YES); + return link->network->ip_forward & ADDRESS_FAMILY_IPV4; } static bool link_ipv6_forward_enabled(Link *link) { @@ -113,7 +113,7 @@ static bool link_ipv6_forward_enabled(Link *link) { if (!link->network) return false; - return IN_SET(link->network->ip_forward, ADDRESS_FAMILY_IPV6, ADDRESS_FAMILY_YES); + return link->network->ip_forward & ADDRESS_FAMILY_IPV6; } #define FLAG_STRING(string, flag, old, new) \ @@ -1481,9 +1481,6 @@ static int link_set_ipv4_forward(Link *link) { const char *p = NULL; int r; - if (link->network->ip_forward == ADDRESS_FAMILY_KERNEL) - 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) @@ -1500,9 +1497,6 @@ static int link_set_ipv6_forward(Link *link) { if (!socket_ipv6_is_supported()) return 0; - if (link->network->ip_forward == ADDRESS_FAMILY_KERNEL) - 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) diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 2cc53df4b1..db737ad484 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -853,8 +853,6 @@ const char *address_family_boolean_to_string(AddressFamilyBoolean b) { return "ipv4"; if (b == ADDRESS_FAMILY_IPV6) return "ipv6"; - if (b == ADDRESS_FAMILY_KERNEL) - return "kernel"; return NULL; } @@ -874,8 +872,6 @@ AddressFamilyBoolean address_family_boolean_from_string(const char *s) { return ADDRESS_FAMILY_IPV4; if (streq(s, "ipv6")) return ADDRESS_FAMILY_IPV6; - if (streq(s, "kernel")) - return ADDRESS_FAMILY_KERNEL; return _ADDRESS_FAMILY_BOOLEAN_INVALID; } diff --git a/src/network/networkd.h b/src/network/networkd.h index 49afeffe81..4b13d4aed1 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -60,7 +60,6 @@ typedef enum AddressFamilyBoolean { ADDRESS_FAMILY_IPV4 = 1, ADDRESS_FAMILY_IPV6 = 2, ADDRESS_FAMILY_YES = 3, - ADDRESS_FAMILY_KERNEL = 4, _ADDRESS_FAMILY_BOOLEAN_MAX, _ADDRESS_FAMILY_BOOLEAN_INVALID = -1, } AddressFamilyBoolean; diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c index bc6c5dc2a0..8f181a6c72 100644 --- a/src/nss-resolve/nss-resolve.c +++ b/src/nss-resolve/nss-resolve.c @@ -365,13 +365,13 @@ enum nss_status _nss_resolve_gethostbyname3_r( int32_t *ttlp, char **canonp); - fallback = (enum nss_status (*)(const char *name, - int af, - struct hostent *result, - char *buffer, size_t buflen, - int *errnop, int *h_errnop, - int32_t *ttlp, - char **canonp)) + fallback = (enum nss_status (*)(const char *name, + int af, + struct hostent *result, + char *buffer, size_t buflen, + int *errnop, int *h_errnop, + int32_t *ttlp, + char **canonp)) find_fallback("libnss_dns.so.2", "_nss_dns_gethostbyname3_r"); if (fallback) return fallback(name, af, result, buffer, buflen, errnop, h_errnop, ttlp, canonp); diff --git a/src/shared/efivars.c b/src/shared/efivars.c index d34d977b9a..0d6ecf52cf 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -483,7 +483,7 @@ int efi_add_boot_option(uint16_t id, const char *title, devicep->length = offsetof(struct device_path, drive) + sizeof(struct drive_path); devicep->drive.part_nr = part; devicep->drive.part_start = pstart; - devicep->drive.part_size = psize; + devicep->drive.part_size = psize; devicep->drive.signature_type = SIGNATURE_TYPE_GUID; devicep->drive.mbr_type = MBR_TYPE_EFI_PARTITION_TABLE_HEADER; id128_to_efi_guid(part_uuid, devicep->drive.signature); diff --git a/src/shared/util.c b/src/shared/util.c index 311acbb349..1442301cd7 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4931,11 +4931,15 @@ int bind_remount_recursive(const char *prefix, bool ro) { while ((x = set_steal_first(todo))) { - r = set_consume(done, x); - if (r == -EEXIST) + r = set_put(done, x); + if (r == -EEXIST) { + free(x); continue; - if (r < 0) + } + if (r < 0) { + free(x); return r; + } /* Try to reuse the original flag set, but * don't care for errors, in case of @@ -4945,14 +4949,15 @@ int bind_remount_recursive(const char *prefix, bool ro) { orig_flags &= ~MS_RDONLY; if (mount(NULL, x, NULL, orig_flags|MS_BIND|MS_REMOUNT|(ro ? MS_RDONLY : 0), NULL) < 0) { - /* Deal with mount points that are * obstructed by a later mount */ - if (errno != ENOENT) + if (errno != ENOENT) { + free(x); return -errno; + } } - + free(x); } } } diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 4dcf8f2e1c..8d17c5e1e3 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -631,9 +631,9 @@ static int spawn_wait(struct udev_event *event, if (timeout_warn_usec > 0 && timeout_warn_usec < timeout_usec && age_usec < timeout_warn_usec) { spawn.timeout_warn = timeout_warn_usec - age_usec; - r = sd_event_add_time(e, NULL, clock_boottime_or_monotonic(), - usec + spawn.timeout_warn, USEC_PER_SEC, - on_spawn_timeout_warning, &spawn); + r = sd_event_add_time(e, NULL, clock_boottime_or_monotonic(), + usec + spawn.timeout_warn, USEC_PER_SEC, + on_spawn_timeout_warning, &spawn); if (r < 0) return r; } diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 915371525f..7be9a2311a 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1941,7 +1941,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { const char *devlink; - devlink = udev_list_entry_get_name(list_entry) + strlen("/dev/"); + devlink = udev_list_entry_get_name(list_entry) + strlen("/dev/"); if (match_key(rules, cur, devlink) == 0) { match = true; break; diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 00609e31b5..4c933de696 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -37,6 +37,7 @@ static const char * const conf_file_dirs[] = { "/etc/udev/hwdb.d", + "/run/udev/hwdb.d", UDEVLIBEXECDIR "/hwdb.d", NULL }; diff --git a/src/udev/udevd.c b/src/udev/udevd.c index eb43091190..26aae89990 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1638,7 +1638,7 @@ int main(int argc, char *argv[]) { arg_children_max = 8; if (sched_getaffinity(0, sizeof (cpu_set), &cpu_set) == 0) { - arg_children_max += CPU_COUNT(&cpu_set) * 2; + arg_children_max += CPU_COUNT(&cpu_set) * 2; } log_debug("set children_max to %u", arg_children_max); diff --git a/units/systemd-hwdb-update.service.in b/units/systemd-hwdb-update.service.in index 7135cff3d9..d13383d55d 100644 --- a/units/systemd-hwdb-update.service.in +++ b/units/systemd-hwdb-update.service.in @@ -16,6 +16,7 @@ ConditionNeedsUpdate=/etc ConditionPathExists=|!@udevlibexecdir@/hwdb.bin ConditionPathExists=|/etc/udev/hwdb.bin ConditionDirectoryNotEmpty=|/etc/udev/hwdb.d/ +ConditionDirectoryNotEmpty=|/run/udev/hwdb.d/ [Service] Type=oneshot |