summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd/sd-rtnl/test-rtnl.c1
-rw-r--r--src/network/networkd.h17
-rw-r--r--src/shared/socket-util.h6
3 files changed, 10 insertions, 14 deletions
diff --git a/src/libsystemd/sd-rtnl/test-rtnl.c b/src/libsystemd/sd-rtnl/test-rtnl.c
index 78f5cca665..e6ba08e076 100644
--- a/src/libsystemd/sd-rtnl/test-rtnl.c
+++ b/src/libsystemd/sd-rtnl/test-rtnl.c
@@ -20,6 +20,7 @@
***/
#include <netinet/ether.h>
+#include <net/if.h>
#include "util.h"
#include "macro.h"
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 3b081d5276..308be832e1 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -36,6 +36,7 @@
#include "list.h"
#include "set.h"
#include "condition-util.h"
+#include "socket-util.h"
#define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
#define VXLAN_VID_MAX (1u << 24) - 1
@@ -184,10 +185,7 @@ struct Address {
struct in_addr broadcast;
struct ifa_cacheinfo cinfo;
- union {
- struct in_addr in;
- struct in6_addr in6;
- } in_addr;
+ union in_addr_union in_addr;
LIST_FIELDS(Address, addresses);
};
@@ -201,15 +199,8 @@ struct Route {
unsigned char scope;
uint32_t metrics;
- union {
- struct in_addr in;
- struct in6_addr in6;
- } in_addr;
-
- union {
- struct in_addr in;
- struct in6_addr in6;
- } dst_addr;
+ union in_addr_union in_addr;
+ union in_addr_union dst_addr;
LIST_FIELDS(Route, routes);
};
diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h
index f938f86200..d125fca83f 100644
--- a/src/shared/socket-util.h
+++ b/src/shared/socket-util.h
@@ -24,7 +24,6 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
-#include <net/if.h>
#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/if_packet.h>
@@ -42,6 +41,11 @@ union sockaddr_union {
struct sockaddr_ll ll;
};
+union in_addr_union {
+ struct in_addr in;
+ struct in6_addr in6;
+};
+
typedef struct SocketAddress {
union sockaddr_union sockaddr;