summary refs log tree commit diff
path: root/src/systemd
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-10-05 22:27:18 +0200
committerMichael Biebl <biebl@debian.org>2020-10-05 22:27:18 +0200
commitaafc1dbe4712c86189bbc1d4d54ad8cb4c69be7e (patch)
treea2a9bb4d007339a0b1304540388230ccedac32bd /src/systemd
parente7b44ef4c80907346ec7492a09c45277459924fc (diff)
New upstream version 1.27.90 upstream/1.27.90
Diffstat (limited to 'src/systemd')
-rw-r--r--src/systemd/nm-sd-utils-core.c14
-rw-r--r--src/systemd/nm-sd-utils-core.h4
-rw-r--r--src/systemd/nm-sd-utils-dhcp.c41
-rw-r--r--src/systemd/nm-sd-utils-dhcp.h11
-rw-r--r--src/systemd/nm-sd.c111
-rw-r--r--src/systemd/nm-sd.h5
-rw-r--r--src/systemd/sd-adapt-core/nm-sd-adapt-core.c10
-rw-r--r--src/systemd/sd-adapt-core/nm-sd-adapt-core.h93
-rw-r--r--src/systemd/src/libsystemd-network/arp-util.c2
-rw-r--r--src/systemd/src/libsystemd-network/dhcp-lease-internal.h3
-rw-r--r--src/systemd/src/libsystemd-network/dhcp-option.c5
-rw-r--r--src/systemd/src/libsystemd-network/dhcp6-internal.h2
-rw-r--r--src/systemd/src/libsystemd-network/dhcp6-network.c6
-rw-r--r--src/systemd/src/libsystemd-network/dhcp6-option.c3
-rw-r--r--src/systemd/src/libsystemd-network/lldp-network.c2
-rw-r--r--src/systemd/src/libsystemd-network/network-internal.h4
-rw-r--r--src/systemd/src/libsystemd-network/sd-dhcp-client.c13
-rw-r--r--src/systemd/src/libsystemd-network/sd-dhcp-lease.c4
-rw-r--r--src/systemd/src/libsystemd-network/sd-dhcp6-client.c15
-rw-r--r--src/systemd/src/libsystemd-network/sd-ipv4acd.c19
-rw-r--r--src/systemd/src/libsystemd-network/sd-lldp.c3
-rw-r--r--src/systemd/src/libsystemd/sd-event/sd-event.c58
-rw-r--r--src/systemd/src/systemd/_sd-common.h2
-rw-r--r--src/systemd/src/systemd/sd-event.h2
-rw-r--r--src/systemd/src/systemd/sd-lldp.h2
25 files changed, 242 insertions, 192 deletions
diff --git a/src/systemd/nm-sd-utils-core.c b/src/systemd/nm-sd-utils-core.c
index 4057c70a..804c7282 100644
--- a/src/systemd/nm-sd-utils-core.c
+++ b/src/systemd/nm-sd-utils-core.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: LGPL-2.1+
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /*
  * Copyright (C) 2018 Red Hat, Inc.
  */
@@ -16,12 +16,12 @@
 /*****************************************************************************/
 
 NMUuid *
-nm_sd_utils_id128_get_machine (NMUuid *out_uuid)
+nm_sd_utils_id128_get_machine(NMUuid *out_uuid)
 {
-	g_assert (out_uuid);
+    g_assert(out_uuid);
 
-	G_STATIC_ASSERT_EXPR (sizeof (*out_uuid) == sizeof (sd_id128_t));
-	if (sd_id128_get_machine ((sd_id128_t *) out_uuid) < 0)
-		return NULL;
-	return out_uuid;
+    G_STATIC_ASSERT_EXPR(sizeof(*out_uuid) == sizeof(sd_id128_t));
+    if (sd_id128_get_machine((sd_id128_t *) out_uuid) < 0)
+        return NULL;
+    return out_uuid;
 }
diff --git a/src/systemd/nm-sd-utils-core.h b/src/systemd/nm-sd-utils-core.h
index 3b0bc23b..440e6349 100644
--- a/src/systemd/nm-sd-utils-core.h
+++ b/src/systemd/nm-sd-utils-core.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: LGPL-2.1+
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /*
  * Copyright (C) 2018 Red Hat, Inc.
  */
@@ -10,7 +10,7 @@
 
 struct _NMUuid;
 
-struct _NMUuid *nm_sd_utils_id128_get_machine (struct _NMUuid *out_uuid);
+struct _NMUuid *nm_sd_utils_id128_get_machine(struct _NMUuid *out_uuid);
 
 /*****************************************************************************/
 
diff --git a/src/systemd/nm-sd-utils-dhcp.c b/src/systemd/nm-sd-utils-dhcp.c
index 4cfe054c..01be2308 100644
--- a/src/systemd/nm-sd-utils-dhcp.c
+++ b/src/systemd/nm-sd-utils-dhcp.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: LGPL-2.1+
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /*
  * Copyright (C) 2019 Red Hat, Inc.
  */
@@ -11,30 +11,31 @@
 #include "src/libsystemd-network/dhcp-lease-internal.h"
 
 int
-nm_sd_dhcp_lease_get_private_options (sd_dhcp_lease *lease, nm_sd_dhcp_option **out_options)
+nm_sd_dhcp_lease_get_private_options(sd_dhcp_lease *lease, nm_sd_dhcp_option **out_options)
 {
-	struct sd_dhcp_raw_option *raw_option;
-	int cnt = 0;
+    struct sd_dhcp_raw_option *raw_option;
+    int                        cnt = 0;
 
-	g_return_val_if_fail (lease, -EINVAL);
-	g_return_val_if_fail (out_options, -EINVAL);
-	g_return_val_if_fail (*out_options == NULL, -EINVAL);
+    g_return_val_if_fail(lease, -EINVAL);
+    g_return_val_if_fail(out_options, -EINVAL);
+    g_return_val_if_fail(*out_options == NULL, -EINVAL);
 
-	if (lease->private_options == NULL)
-		return -ENODATA;
+    if (lease->private_options == NULL)
+        return -ENODATA;
 
-	LIST_FOREACH (options, raw_option, lease->private_options)
-		cnt++;
+    LIST_FOREACH(options, raw_option, lease->private_options)
+    cnt++;
 
-	*out_options = g_new (nm_sd_dhcp_option, cnt);
-	cnt = 0;
+    *out_options = g_new(nm_sd_dhcp_option, cnt);
+    cnt          = 0;
 
-	LIST_FOREACH (options, raw_option, lease->private_options) {
-		(*out_options)[cnt].code = raw_option->tag;
-		(*out_options)[cnt].data = raw_option->data;
-		(*out_options)[cnt].data_len = raw_option->length;
-		cnt++;
-	}
+    LIST_FOREACH(options, raw_option, lease->private_options)
+    {
+        (*out_options)[cnt].code     = raw_option->tag;
+        (*out_options)[cnt].data     = raw_option->data;
+        (*out_options)[cnt].data_len = raw_option->length;
+        cnt++;
+    }
 
-	return cnt;
+    return cnt;
 }
diff --git a/src/systemd/nm-sd-utils-dhcp.h b/src/systemd/nm-sd-utils-dhcp.h
index 5228eb25..e456012b 100644
--- a/src/systemd/nm-sd-utils-dhcp.h
+++ b/src/systemd/nm-sd-utils-dhcp.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: LGPL-2.1+
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /*
  * Copyright (C) 2019 Red Hat, Inc.
  */
@@ -9,12 +9,11 @@
 #include "nm-sd.h"
 
 typedef struct {
-	uint8_t code;
-	uint8_t data_len;
-	void *data;
+    uint8_t code;
+    uint8_t data_len;
+    void *  data;
 } nm_sd_dhcp_option;
 
-int
-nm_sd_dhcp_lease_get_private_options (sd_dhcp_lease *lease, nm_sd_dhcp_option **out_options);
+int nm_sd_dhcp_lease_get_private_options(sd_dhcp_lease *lease, nm_sd_dhcp_option **out_options);
 
 #endif /* __NETWORKMANAGER_DHCP_SYSTEMD_UTILS_H__ */
diff --git a/src/systemd/nm-sd.c b/src/systemd/nm-sd.c
index a277f430..89c12337 100644
--- a/src/systemd/nm-sd.c
+++ b/src/systemd/nm-sd.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2014 - 2016 Red Hat, Inc.
  */
@@ -15,94 +15,92 @@
  *****************************************************************************/
 
 typedef struct SDEventSource {
-	GSource source;
-	GPollFD pollfd;
-	sd_event *event;
+    GSource   source;
+    GPollFD   pollfd;
+    sd_event *event;
 } SDEventSource;
 
 static gboolean
-event_prepare (GSource *source, int *timeout_)
+event_prepare(GSource *source, int *timeout_)
 {
-	return sd_event_prepare (((SDEventSource *) source)->event) > 0;
+    return sd_event_prepare(((SDEventSource *) source)->event) > 0;
 }
 
 static gboolean
-event_check (GSource *source)
+event_check(GSource *source)
 {
-	return sd_event_wait (((SDEventSource *) source)->event, 0) > 0;
+    return sd_event_wait(((SDEventSource *) source)->event, 0) > 0;
 }
 
 static gboolean
-event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
+event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
 {
-	return sd_event_dispatch (((SDEventSource *) source)->event) > 0;
+    return sd_event_dispatch(((SDEventSource *) source)->event) > 0;
 }
 
 static void
-event_finalize (GSource *source)
+event_finalize(GSource *source)
 {
-	SDEventSource *s = (SDEventSource *) source;
+    SDEventSource *s = (SDEventSource *) source;
 
-	sd_event_unref (s->event);
+    sd_event_unref(s->event);
 }
 
 static SDEventSource *
-event_create_source (sd_event *event)
+event_create_source(sd_event *event)
 {
-	static const GSourceFuncs event_funcs = {
-		.prepare = event_prepare,
-		.check = event_check,
-		.dispatch = event_dispatch,
-		.finalize = event_finalize,
-	};
-	SDEventSource *source;
-	gboolean is_default_event = FALSE;
-	int r;
-
-	if (!event) {
-		is_default_event = TRUE;
-		r = sd_event_default (&event);
-		if (r < 0)
-			g_return_val_if_reached (NULL);
-	}
-
-	source = (SDEventSource *) g_source_new ((GSourceFuncs *) &event_funcs, sizeof (SDEventSource));
-
-	source->event =   is_default_event
-	                ? g_steal_pointer (&event)
-	                : sd_event_ref (event);
-
-	source->pollfd = (GPollFD) {
-	    .fd     = sd_event_get_fd (source->event),
-	    .events = G_IO_IN | G_IO_HUP | G_IO_ERR,
-	};
-
-	g_source_add_poll (&source->source, &source->pollfd);
-
-	return source;
+    static const GSourceFuncs event_funcs = {
+        .prepare  = event_prepare,
+        .check    = event_check,
+        .dispatch = event_dispatch,
+        .finalize = event_finalize,
+    };
+    SDEventSource *source;
+    gboolean       is_default_event = FALSE;
+    int            r;
+
+    if (!event) {
+        is_default_event = TRUE;
+        r                = sd_event_default(&event);
+        if (r < 0)
+            g_return_val_if_reached(NULL);
+    }
+
+    source = (SDEventSource *) g_source_new((GSourceFuncs *) &event_funcs, sizeof(SDEventSource));
+
+    source->event = is_default_event ? g_steal_pointer(&event) : sd_event_ref(event);
+
+    source->pollfd = (GPollFD){
+        .fd     = sd_event_get_fd(source->event),
+        .events = G_IO_IN | G_IO_HUP | G_IO_ERR,
+    };
+
+    g_source_add_poll(&source->source, &source->pollfd);
+
+    return source;
 }
 
 static guint
-event_attach (sd_event *event, GMainContext *context)
+event_attach(sd_event *event, GMainContext *context)
 {
-	SDEventSource *source;
-	guint id;
+    SDEventSource *source;
+    guint          id;
 
-	source = event_create_source (event);
+    source = event_create_source(event);
 
-	g_return_val_if_fail (source, 0);
+    g_return_val_if_fail(source, 0);
 
-	id = g_source_attach ((GSource *) source, context);
-	g_source_unref ((GSource *) source);
+    id = g_source_attach((GSource *) source, context);
+    g_source_unref((GSource *) source);
 
-	nm_assert (id != 0);
-	return id;
+    nm_assert(id != 0);
+    return id;
 }
 
 guint
-nm_sd_event_attach_default (void)
+nm_sd_event_attach_default(void)
 {
-	return event_attach (NULL, NULL);
+    return event_attach(NULL, NULL);
 }
 
 /*****************************************************************************/
@@ -113,4 +111,3 @@ nm_sd_event_attach_default (void)
 #include "dhcp-lease-internal.h"
 
 /*****************************************************************************/
-
diff --git a/src/systemd/nm-sd.h b/src/systemd/nm-sd.h
index 99904243..7cea9b68 100644
--- a/src/systemd/nm-sd.h
+++ b/src/systemd/nm-sd.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2014 - 2016 Red Hat, Inc.
  */
@@ -13,7 +13,7 @@
 
 /*****************************************************************************/
 
-guint nm_sd_event_attach_default (void);
+guint nm_sd_event_attach_default(void);
 
 /*****************************************************************************
  * expose internal systemd API
@@ -27,4 +27,3 @@ int dhcp_lease_save(struct sd_dhcp_lease *lease, const char *lease_file);
 int dhcp_lease_load(struct sd_dhcp_lease **ret, const char *lease_file);
 
 #endif /* __NM_SD_H__ */
-
diff --git a/src/systemd/sd-adapt-core/nm-sd-adapt-core.c b/src/systemd/sd-adapt-core/nm-sd-adapt-core.c
index a9f8bd1c..f0f85c43 100644
--- a/src/systemd/sd-adapt-core/nm-sd-adapt-core.c
+++ b/src/systemd/sd-adapt-core/nm-sd-adapt-core.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2014 - 2016 Red Hat, Inc.
  */
@@ -12,10 +12,10 @@
 /*****************************************************************************/
 
 int
-asynchronous_close (int fd) {
-	safe_close (fd);
-	return -1;
+asynchronous_close(int fd)
+{
+    safe_close(fd);
+    return -1;
 }
 
 /*****************************************************************************/
-
diff --git a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h
index 81bc7320..0ec6ade1 100644
--- a/src/systemd/sd-adapt-core/nm-sd-adapt-core.h
+++ b/src/systemd/sd-adapt-core/nm-sd-adapt-core.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: LGPL-2.1+
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /*
  * Copyright (C) 2014 - 2018 Red Hat, Inc.
  */
@@ -15,7 +15,7 @@
 #include "systemd/sd-adapt-shared/nm-sd-adapt-shared.h"
 
 #ifndef HAVE_SYS_AUXV_H
-#define HAVE_SYS_AUXV_H 0
+    #define HAVE_SYS_AUXV_H 0
 #endif
 
 /*****************************************************************************
@@ -25,62 +25,61 @@
 
 #if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_SYSTEMD
 
-#include <netinet/in.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <elf.h>
-#ifdef HAVE_SYS_AUXV_H
-#include <sys/auxv.h>
-#endif
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <sys/ioctl.h>
-
-/* Missing in Linux 3.2.0, in Ubuntu 12.04 */
-#ifndef BPF_XOR
-#define BPF_XOR 0xa0
-#endif
-
-#ifndef ETHERTYPE_LLDP
-#define ETHERTYPE_LLDP 0x88cc
-#endif
-
-#ifndef HAVE_SECURE_GETENV
-#  ifdef HAVE___SECURE_GETENV
-#    define secure_getenv __secure_getenv
-#  else
-#    error neither secure_getenv nor __secure_getenv is available
-#  endif
-#endif
+    #include <netinet/in.h>
+    #include <string.h>
+    #include <stdio.h>
+    #include <errno.h>
+    #include <elf.h>
+    #ifdef HAVE_SYS_AUXV_H
+        #include <sys/auxv.h>
+    #endif
+    #include <unistd.h>
+    #include <sys/syscall.h>
+    #include <sys/ioctl.h>
+
+    /* Missing in Linux 3.2.0, in Ubuntu 12.04 */
+    #ifndef BPF_XOR
+        #define BPF_XOR 0xa0
+    #endif
+
+    #ifndef ETHERTYPE_LLDP
+        #define ETHERTYPE_LLDP 0x88cc
+    #endif
+
+    #ifndef HAVE_SECURE_GETENV
+        #ifdef HAVE___SECURE_GETENV
+            #define secure_getenv __secure_getenv
+        #else
+            #error neither secure_getenv nor __secure_getenv is available
+        #endif
+    #endif
 
 /*****************************************************************************/
 
 static inline int
-sd_notify (int unset_environment, const char *state)
+sd_notify(int unset_environment, const char *state)
 {
-	return 0;
+    return 0;
 }
 
-/* Can't include both net/if.h and linux/if.h; so have to define this here */
-#ifndef IF_NAMESIZE
-#define IF_NAMESIZE 16
-#endif
+    /* Can't include both net/if.h and linux/if.h; so have to define this here */
+    #ifndef IF_NAMESIZE
+        #define IF_NAMESIZE 16
+    #endif
 
-#ifndef IFNAMSIZ
-#define IFNAMSIZ IF_NAMESIZE
-#endif
+    #ifndef IFNAMSIZ
+        #define IFNAMSIZ IF_NAMESIZE
+    #endif
 
-#ifndef MAX_HANDLE_SZ
-#define MAX_HANDLE_SZ 128
-#endif
+    #ifndef MAX_HANDLE_SZ
+        #define MAX_HANDLE_SZ 128
+    #endif
 
-#include "sd-id128.h"
-#include "sparse-endian.h"
-#include "async.h"
-#include "util.h"
+    #include "sd-id128.h"
+    #include "sparse-endian.h"
+    #include "async.h"
+    #include "util.h"
 
 #endif /* (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_SYSTEMD */
 
 #endif /* __NM_SD_ADAPT_CORE_H__ */
-
diff --git a/src/systemd/src/libsystemd-network/arp-util.c b/src/systemd/src/libsystemd-network/arp-util.c
index e48e4bfe..b2ac2c9c 100644
--- a/src/systemd/src/libsystemd-network/arp-util.c
+++ b/src/systemd/src/libsystemd-network/arp-util.c
@@ -78,7 +78,7 @@ int arp_network_bind_raw_socket(int ifindex, be32_t address, const struct ether_
 
         assert(ifindex > 0);
 
-        s = socket(PF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
+        s = socket(AF_PACKET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
         if (s < 0)
                 return -errno;
 
diff --git a/src/systemd/src/libsystemd-network/dhcp-lease-internal.h b/src/systemd/src/libsystemd-network/dhcp-lease-internal.h
index aed30d61..66222ead 100644
--- a/src/systemd/src/libsystemd-network/dhcp-lease-internal.h
+++ b/src/systemd/src/libsystemd-network/dhcp-lease-internal.h
@@ -82,6 +82,3 @@ int dhcp_lease_insert_private_option(sd_dhcp_lease *lease, uint8_t tag, const vo
 int dhcp_lease_set_default_subnet_mask(sd_dhcp_lease *lease);
 
 int dhcp_lease_set_client_id(sd_dhcp_lease *lease, const void *client_id, size_t client_id_len);
-
-int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
-int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file);
diff --git a/src/systemd/src/libsystemd-network/dhcp-option.c b/src/systemd/src/libsystemd-network/dhcp-option.c
index 49193879..3a0f5155 100644
--- a/src/systemd/src/libsystemd-network/dhcp-option.c
+++ b/src/systemd/src/libsystemd-network/dhcp-option.c
@@ -83,9 +83,8 @@ static int option_append(uint8_t options[], size_t size, size_t *offset,
                 OrderedHashmap *s = (OrderedHashmap *) optval;
                 struct sd_dhcp_option *p;
                 size_t l = 0;
-                Iterator i;
 
-                ORDERED_HASHMAP_FOREACH(p, s, i)
+                ORDERED_HASHMAP_FOREACH(p, s)
                         l += p->length + 2;
 
                 if (*offset + l + 2 > size)
@@ -96,7 +95,7 @@ static int option_append(uint8_t options[], size_t size, size_t *offset,
 
                 *offset += 2;
 
-                ORDERED_HASHMAP_FOREACH(p, s, i) {
+                ORDERED_HASHMAP_FOREACH(p, s) {
                         options[*offset] = p->option;
                         options[*offset + 1] = p->length;
                         memcpy(&options[*offset + 2], p->data, p->length);
diff --git a/src/systemd/src/libsystemd-network/dhcp6-internal.h b/src/systemd/src/libsystemd-network/dhcp6-internal.h
index 068dcade..9ce6dcd0 100644
--- a/src/systemd/src/libsystemd-network/dhcp6-internal.h
+++ b/src/systemd/src/libsystemd-network/dhcp6-internal.h
@@ -113,7 +113,7 @@ int dhcp6_option_parse_domainname_list(const uint8_t *optval, uint16_t optlen,
                                        char ***str_arr);
 int dhcp6_option_parse_domainname(const uint8_t *optval, uint16_t optlen, char **str);
 
-int dhcp6_network_bind_udp_socket(int index, struct in6_addr *address);
+int dhcp6_network_bind_udp_socket(int ifindex, struct in6_addr *address);
 int dhcp6_network_send_udp_socket(int s, struct in6_addr *address,
                                   const void *packet, size_t len);
 
diff --git a/src/systemd/src/libsystemd-network/dhcp6-network.c b/src/systemd/src/libsystemd-network/dhcp6-network.c
index d43680a5..449ff6c4 100644
--- a/src/systemd/src/libsystemd-network/dhcp6-network.c
+++ b/src/systemd/src/libsystemd-network/dhcp6-network.c
@@ -19,16 +19,16 @@
 #include "fd-util.h"
 #include "socket-util.h"
 
-int dhcp6_network_bind_udp_socket(int index, struct in6_addr *local_address) {
+int dhcp6_network_bind_udp_socket(int ifindex, struct in6_addr *local_address) {
         union sockaddr_union src = {
                 .in6.sin6_family = AF_INET6,
                 .in6.sin6_port = htobe16(DHCP6_PORT_CLIENT),
-                .in6.sin6_scope_id = index,
+                .in6.sin6_scope_id = ifindex,
         };
         _cleanup_close_ int s = -1;
         int r;
 
-        assert(index > 0);
+        assert(ifindex > 0);
         assert(local_address);
 
         src.in6.sin6_addr = *local_address;
diff --git a/src/systemd/src/libsystemd-network/dhcp6-option.c b/src/systemd/src/libsystemd-network/dhcp6-option.c
index a6dad934..25da477d 100644
--- a/src/systemd/src/libsystemd-network/dhcp6-option.c
+++ b/src/systemd/src/libsystemd-network/dhcp6-option.c
@@ -83,7 +83,6 @@ int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code,
 
 int dhcp6_option_append_vendor_option(uint8_t **buf, size_t *buflen, OrderedHashmap *vendor_options) {
         sd_dhcp6_option *options;
-        Iterator i;
         int r;
 
         assert(buf);
@@ -91,7 +90,7 @@ int dhcp6_option_append_vendor_option(uint8_t **buf, size_t *buflen, OrderedHash
         assert(buflen);
         assert(vendor_options);
 
-        ORDERED_HASHMAP_FOREACH(options, vendor_options, i) {
+        ORDERED_HASHMAP_FOREACH(options, vendor_options) {
                 _cleanup_free_ uint8_t *p = NULL;
                 size_t total;
 
diff --git a/src/systemd/src/libsystemd-network/lldp-network.c b/src/systemd/src/libsystemd-network/lldp-network.c
index f4764dd1..85d53e71 100644
--- a/src/systemd/src/libsystemd-network/lldp-network.c
+++ b/src/systemd/src/libsystemd-network/lldp-network.c
@@ -49,7 +49,7 @@ int lldp_network_bind_raw_socket(int ifindex) {
 
         assert(ifindex > 0);
 
-        fd = socket(PF_PACKET, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK,
+        fd = socket(AF_PACKET, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK,
                     htobe16(ETHERTYPE_LLDP));
         if (fd < 0)
                 return -errno;
diff --git a/src/systemd/src/libsystemd-network/network-internal.h b/src/systemd/src/libsystemd-network/network-internal.h
index 8e6377e0..1959474e 100644
--- a/src/systemd/src/libsystemd-network/network-internal.h
+++ b/src/systemd/src/libsystemd-network/network-internal.h
@@ -62,9 +62,13 @@ int deserialize_in6_addrs(struct in6_addr **addresses, const char *string);
 
 /* don't include "dhcp-lease-internal.h" as it causes conflicts between netinet/ip.h and linux/ip.h */
 struct sd_dhcp_route;
+struct sd_dhcp_lease;
 
 void serialize_dhcp_routes(FILE *f, const char *key, sd_dhcp_route **routes, size_t size);
 int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t *ret_allocated, const char *string);
 
 /* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
 int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
+
+int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
+int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file);
diff --git a/src/systemd/src/libsystemd-network/sd-dhcp-client.c b/src/systemd/src/libsystemd-network/sd-dhcp-client.c
index 70821ac2..6849ed9e 100644
--- a/src/systemd/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/systemd/src/libsystemd-network/sd-dhcp-client.c
@@ -379,7 +379,7 @@ int sd_dhcp_client_set_client_id(
         /* For hardware types, log debug message about unexpected data length.
          *
          * Note that infiniband's INFINIBAND_ALEN is 20 bytes long, but only
-         * last last 8 bytes of the address are stable and suitable to put into
+         * the last 8 bytes of the address are stable and suitable to put into
          * the client-id. The caller is advised to account for that. */
         if ((type == ARPHRD_ETHER && data_len != ETH_ALEN) ||
             (type == ARPHRD_INFINIBAND && data_len != 8))
@@ -924,7 +924,6 @@ static int dhcp_client_send_raw(
 
 static int client_append_common_discover_request_options(sd_dhcp_client *client, DHCPPacket *packet, size_t *optoffset, size_t optlen) {
         sd_dhcp_option *j;
-        Iterator i;
         int r;
 
         assert(client);
@@ -975,7 +974,7 @@ static int client_append_common_discover_request_options(sd_dhcp_client *client,
                         return r;
         }
 
-        ORDERED_HASHMAP_FOREACH(j, client->extra_options, i) {
+        ORDERED_HASHMAP_FOREACH(j, client->extra_options) {
                 r = dhcp_option_append(&packet->dhcp, optlen, optoffset, 0,
                                        j->option, j->length, j->data);
                 if (r < 0)
@@ -1446,7 +1445,10 @@ static int client_timeout_t1(sd_event_source *s, uint64_t usec, void *userdata)
         sd_dhcp_client *client = userdata;
         DHCP_CLIENT_DONT_DESTROY(client);
 
-        client->state = DHCP_STATE_RENEWING;
+        if (client->lease)
+                client->state = DHCP_STATE_RENEWING;
+        else if (client->state != DHCP_STATE_INIT)
+                client->state = DHCP_STATE_INIT_REBOOT;
         client->attempt = 0;
 
         return client_initialize_time_events(client);
@@ -2017,6 +2019,9 @@ int sd_dhcp_client_send_renew(sd_dhcp_client *client) {
         assert_return(client, -EINVAL);
         assert_return(client->fd >= 0, -EINVAL);
 
+        if (!client->lease)
+                return 0;
+
         client->start_delay = 0;
         client->attempt = 1;
         client->state = DHCP_STATE_RENEWING;
diff --git a/src/systemd/src/libsystemd-network/sd-dhcp-lease.c b/src/systemd/src/libsystemd-network/sd-dhcp-lease.c
index ae581f91..c810877c 100644
--- a/src/systemd/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/systemd/src/libsystemd-network/sd-dhcp-lease.c
@@ -781,7 +781,7 @@ int dhcp_lease_parse_search_domains(const uint8_t *option, size_t len, char ***d
                                         return r;
 
                                 n += r;
-                        } else if ((c & 0xc0) == 0xc0) {
+                        } else if (FLAGS_SET(c, 0xc0)) {
                                 /* Pointer */
 
                                 uint8_t d;
@@ -1078,7 +1078,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
                            "ADDRESS", &address,
                            "ROUTER", &router,
                            "NETMASK", &netmask,
-                           "SERVER_IDENTIFIER", &server_address,
+                           "SERVER_ADDRESS", &server_address,
                            "NEXT_SERVER", &next_server,
                            "BROADCAST", &broadcast,
                            "DNS", &dns,
diff --git a/src/systemd/src/libsystemd-network/sd-dhcp6-client.c b/src/systemd/src/libsystemd-network/sd-dhcp6-client.c
index b80e4e54..ec7f1be2 100644
--- a/src/systemd/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/systemd/src/libsystemd-network/sd-dhcp6-client.c
@@ -161,7 +161,7 @@ int sd_dhcp6_client_set_callback(
 int sd_dhcp6_client_set_ifindex(sd_dhcp6_client *client, int ifindex) {
 
         assert_return(client, -EINVAL);
-        assert_return(ifindex >= -1, -EINVAL);
+        assert_return(ifindex > 0, -EINVAL);
         assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
 
         client->ifindex = ifindex;
@@ -272,7 +272,7 @@ static int dhcp6_client_set_duid_internal(
         assert_return(duid_len == 0 || duid != NULL, -EINVAL);
         assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);
 
-        if (duid != NULL) {
+        if (duid) {
                 r = dhcp_validate_duid_len(duid_type, duid_len, true);
                 if (r < 0) {
                         r = dhcp_validate_duid_len(duid_type, duid_len, false);
@@ -630,7 +630,6 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
                 IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT;
         struct sd_dhcp6_option *j;
         size_t len, optlen = 512;
-        Iterator i;
         uint8_t *opt;
         int r;
         usec_t elapsed_usec;
@@ -735,7 +734,7 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
                 if (r < 0)
                         return r;
 
-                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_NA)) {
+                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_NA) && client->lease->ia.addresses) {
                         r = dhcp6_option_append_ia(&opt, &optlen,
                                                    &client->lease->ia);
                         if (r < 0)
@@ -774,7 +773,7 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
                                 return r;
                 }
 
-                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD)) {
+                if (FLAGS_SET(client->request, DHCP6_REQUEST_IA_PD) && client->lease->pd.addresses) {
                         r = dhcp6_option_append_pd(opt, optlen, &client->lease->pd, NULL);
                         if (r < 0)
                                 return r;
@@ -865,7 +864,7 @@ static int client_send_message(sd_dhcp6_client *client, usec_t time_now) {
         if (r < 0)
                 return r;
 
-        ORDERED_HASHMAP_FOREACH(j, client->extra_options, i) {
+        ORDERED_HASHMAP_FOREACH(j, client->extra_options) {
                 r = dhcp6_option_append(&opt, &optlen, j->option, j->length, j->data);
                 if (r < 0)
                         return r;
@@ -1502,7 +1501,7 @@ static int client_receive_message(
                         break;
                 }
 
-                _fallthrough_; /* for Soliciation Rapid Commit option check */
+                _fallthrough_; /* for Solicitation Rapid Commit option check */
         case DHCP6_STATE_REQUEST:
         case DHCP6_STATE_RENEW:
         case DHCP6_STATE_REBIND:
@@ -1701,7 +1700,7 @@ int sd_dhcp6_client_is_running(sd_dhcp6_client *client) {
 
 int sd_dhcp6_client_start(sd_dhcp6_client *client) {
         enum DHCP6State state = DHCP6_STATE_SOLICITATION;
-        int r = 0;
+        int r;
 
         assert_return(client, -EINVAL);
         assert_return(client->event, -EINVAL);
diff --git a/src/systemd/src/libsystemd-network/sd-ipv4acd.c b/src/systemd/src/libsystemd-network/sd-ipv4acd.c
index 9f69088d..b9e3dce3 100644
--- a/src/systemd/src/libsystemd-network/sd-ipv4acd.c
+++ b/src/systemd/src/libsystemd-network/sd-ipv4acd.c
@@ -144,10 +144,17 @@ static void ipv4acd_client_notify(sd_ipv4acd *acd, int event) {
 }
 
 int sd_ipv4acd_stop(sd_ipv4acd *acd) {
+        IPv4ACDState old_state;
+
         assert_return(acd, -EINVAL);
 
+        old_state = acd->state;
+
         ipv4acd_reset(acd);
 
+        if (old_state == IPV4ACD_STATE_INIT)
+                return 0;
+
         log_ipv4acd(acd, "STOPPED");
 
         ipv4acd_client_notify(acd, SD_IPV4ACD_EVENT_STOP);
@@ -437,6 +444,15 @@ int sd_ipv4acd_set_address(sd_ipv4acd *acd, const struct in_addr *address) {
         return 0;
 }
 
+int sd_ipv4acd_get_address(sd_ipv4acd *acd, struct in_addr *address) {
+        assert_return(acd, -EINVAL);
+        assert_return(address, -EINVAL);
+
+        address->s_addr = acd->address;
+
+        return 0;
+}
+
 int sd_ipv4acd_is_running(sd_ipv4acd *acd) {
         assert_return(acd, false);
 
@@ -457,8 +473,7 @@ int sd_ipv4acd_start(sd_ipv4acd *acd, bool reset_conflicts) {
         if (r < 0)
                 return r;
 
-        safe_close(acd->fd);
-        acd->fd = r;
+        CLOSE_AND_REPLACE(acd->fd, r);
         acd->defend_window = 0;
 
         if (reset_conflicts)
diff --git a/src/systemd/src/libsystemd-network/sd-lldp.c b/src/systemd/src/libsystemd-network/sd-lldp.c
index eb083f5e..524b1bab 100644
--- a/src/systemd/src/libsystemd-network/sd-lldp.c
+++ b/src/systemd/src/libsystemd-network/sd-lldp.c
@@ -433,7 +433,6 @@ static int lldp_start_timer(sd_lldp *lldp, sd_lldp_neighbor *neighbor) {
 
 _public_ int sd_lldp_get_neighbors(sd_lldp *lldp, sd_lldp_neighbor ***ret) {
         sd_lldp_neighbor **l = NULL, *n;
-        Iterator i;
         int k = 0, r;
 
         assert_return(lldp, -EINVAL);
@@ -454,7 +453,7 @@ _public_ int sd_lldp_get_neighbors(sd_lldp *lldp, sd_lldp_neighbor ***ret) {
                 return r;
         }
 
-        HASHMAP_FOREACH(n, lldp->neighbor_by_id, i)
+        HASHMAP_FOREACH(n, lldp->neighbor_by_id)
                 l[k++] = sd_lldp_neighbor_ref(n);
 
         assert((size_t) k == hashmap_size(lldp->neighbor_by_id));
diff --git a/src/systemd/src/libsystemd/sd-event/sd-event.c b/src/systemd/src/libsystemd/sd-event/sd-event.c
index 3e56e807..d5993a22 100644
--- a/src/systemd/src/libsystemd/sd-event/sd-event.c
+++ b/src/systemd/src/libsystemd/sd-event/sd-event.c
@@ -1149,6 +1149,31 @@ _public_ int sd_event_add_time(
 }
 
 #if 0 /* NM_IGNORED */
+_public_ int sd_event_add_time_relative(
+                sd_event *e,
+                sd_event_source **ret,
+                clockid_t clock,
+                uint64_t usec,
+                uint64_t accuracy,
+                sd_event_time_handler_t callback,
+                void *userdata) {
+
+        usec_t t;
+        int r;
+
+        /* Same as sd_event_add_time() but operates relative to the event loop's current point in time, and
+         * checks for overflow. */
+
+        r = sd_event_now(e, clock, &t);
+        if (r < 0)
+                return r;
+
+        if (usec >= USEC_INFINITY - t)
+                return -EOVERFLOW;
+
+        return sd_event_add_time(e, ret, clock, t + usec, accuracy, callback, userdata);
+}
+
 static int signal_exit_callback(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
         assert(s);
 
@@ -1454,10 +1479,6 @@ _public_ int sd_event_add_post(
         assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
         assert_return(!event_pid_changed(e), -ECHILD);
 
-        r = set_ensure_allocated(&e->post_sources, NULL);
-        if (r < 0)
-                return r;
-
         s = source_new(e, !ret, SOURCE_POST);
         if (!s)
                 return -ENOMEM;
@@ -1466,9 +1487,10 @@ _public_ int sd_event_add_post(
         s->userdata = userdata;
         s->enabled = SD_EVENT_ON;
 
-        r = set_put(e->post_sources, s);
+        r = set_ensure_put(&e->post_sources, NULL, s);
         if (r < 0)
                 return r;
+        assert(r > 0);
 
         if (ret)
                 *ret = s;
@@ -2409,6 +2431,23 @@ _public_ int sd_event_source_set_time(sd_event_source *s, uint64_t usec) {
         return 0;
 }
 
+_public_ int sd_event_source_set_time_relative(sd_event_source *s, uint64_t usec) {
+        usec_t t;
+        int r;
+
+        assert_return(s, -EINVAL);
+        assert_return(EVENT_SOURCE_IS_TIME(s->type), -EDOM);
+
+        r = sd_event_now(s->event, event_source_type_to_clock(s->type), &t);
+        if (r < 0)
+                return r;
+
+        if (usec >= USEC_INFINITY - t)
+                return -EOVERFLOW;
+
+        return sd_event_source_set_time(s, t + usec);
+}
+
 _public_ int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec) {
         assert_return(s, -EINVAL);
         assert_return(usec, -EINVAL);
@@ -2835,7 +2874,6 @@ static int process_timer(
 
 static int process_child(sd_event *e) {
         sd_event_source *s;
-        Iterator i;
         int r;
 
         assert(e);
@@ -2860,7 +2898,7 @@ static int process_child(sd_event *e) {
            the callback still sees the process as a zombie.
         */
 
-        HASHMAP_FOREACH(s, e->child_sources, i) {
+        HASHMAP_FOREACH(s, e->child_sources) {
                 assert(s->type == SOURCE_CHILD);
 
                 if (s->pending)
@@ -3065,12 +3103,11 @@ static int event_inotify_data_process(sd_event *e, struct inotify_data *d) {
 
                 if (d->buffer.ev.mask & IN_Q_OVERFLOW) {
                         struct inode_data *inode_data;
-                        Iterator i;
 
                         /* The queue overran, let's pass this event to all event sources connected to this inotify
                          * object */
 
-                        HASHMAP_FOREACH(inode_data, d->inodes, i) {
+                        HASHMAP_FOREACH(inode_data, d->inodes) {
                                 sd_event_source *s;
 
                                 LIST_FOREACH(inotify.by_inode_data, s, inode_data->event_sources) {
@@ -3168,12 +3205,11 @@ static int source_dispatch(sd_event_source *s) {
 
         if (s->type != SOURCE_POST) {
                 sd_event_source *z;
-                Iterator i;
 
                 /* If we execute a non-post source, let's mark all
                  * post sources as pending */
 
-                SET_FOREACH(z, s->event->post_sources, i) {
+                SET_FOREACH(z, s->event->post_sources) {
                         if (z->enabled == SD_EVENT_OFF)
                                 continue;
 
diff --git a/src/systemd/src/systemd/_sd-common.h b/src/systemd/src/systemd/_sd-common.h
index 8158ee73..1055b00d 100644
--- a/src/systemd/src/systemd/_sd-common.h
+++ b/src/systemd/src/systemd/_sd-common.h
@@ -19,7 +19,7 @@
 
 /* This is a private header; never even think of including this directly! */
 
-#if defined(__INCLUDE_LEVEL__) && __INCLUDE_LEVEL__ <= 1
+#if defined(__INCLUDE_LEVEL__) && __INCLUDE_LEVEL__ <= 1 && !defined(__COVERITY__)
 #  error "Do not include _sd-common.h directly; it is a private header."
 #endif
 
diff --git a/src/systemd/src/systemd/sd-event.h b/src/systemd/src/systemd/sd-event.h
index 2ec726a8..dc96bfa6 100644
--- a/src/systemd/src/systemd/sd-event.h
+++ b/src/systemd/src/systemd/sd-event.h
@@ -88,6 +88,7 @@ sd_event* sd_event_unref(sd_event *e);
 
 int sd_event_add_io(sd_event *e, sd_event_source **s, int fd, uint32_t events, sd_event_io_handler_t callback, void *userdata);
 int sd_event_add_time(sd_event *e, sd_event_source **s, clockid_t clock, uint64_t usec, uint64_t accuracy, sd_event_time_handler_t callback, void *userdata);
+int sd_event_add_time_relative(sd_event *e, sd_event_source **s, clockid_t clock, uint64_t usec, uint64_t accuracy, sd_event_time_handler_t callback, void *userdata);
 int sd_event_add_signal(sd_event *e, sd_event_source **s, int sig, sd_event_signal_handler_t callback, void *userdata);
 int sd_event_add_child(sd_event *e, sd_event_source **s, pid_t pid, int options, sd_event_child_handler_t callback, void *userdata);
 int sd_event_add_child_pidfd(sd_event *e, sd_event_source **s, int pidfd, int options, sd_event_child_handler_t callback, void *userdata);
@@ -138,6 +139,7 @@ int sd_event_source_set_io_events(sd_event_source *s, uint32_t events);
 int sd_event_source_get_io_revents(sd_event_source *s, uint32_t* revents);
 int sd_event_source_get_time(sd_event_source *s, uint64_t *usec);
 int sd_event_source_set_time(sd_event_source *s, uint64_t usec);
+int sd_event_source_set_time_relative(sd_event_source *s, uint64_t usec);
 int sd_event_source_get_time_accuracy(sd_event_source *s, uint64_t *usec);
 int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec);
 int sd_event_source_get_time_clock(sd_event_source *s, clockid_t *clock);
diff --git a/src/systemd/src/systemd/sd-lldp.h b/src/systemd/src/systemd/sd-lldp.h
index 2dc9f632..c2abc201 100644
--- a/src/systemd/src/systemd/sd-lldp.h
+++ b/src/systemd/src/systemd/sd-lldp.h
@@ -176,7 +176,7 @@ int sd_lldp_neighbor_get_mud_url(sd_lldp_neighbor *n, const char **ret);
 int sd_lldp_neighbor_get_system_capabilities(sd_lldp_neighbor *n, uint16_t *ret);
 int sd_lldp_neighbor_get_enabled_capabilities(sd_lldp_neighbor *n, uint16_t *ret);
 
-/* Low-level, iterative TLV access. This is for evertyhing else, it iteratively goes through all available TLVs
+/* Low-level, iterative TLV access. This is for everything else, it iteratively goes through all available TLVs
  * (including the ones covered with the calls above), and allows multiple TLVs for the same fields. */
 int sd_lldp_neighbor_tlv_rewind(sd_lldp_neighbor *n);
 int sd_lldp_neighbor_tlv_next(sd_lldp_neighbor *n);