summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-18 12:34:02 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-18 18:28:29 +0200
commit5d3de3fe9cc452f1bfe3c2dcafecbd7f904da4dc (patch)
tree624cc09d6594add462d1323b9c95f16252c4b9ce /src
parent03966da2ca04ca96dd0a1852d7fa423aaf18eba6 (diff)
socket-util: introduce in_addr_union similar to sockaddr_union and make use of it everywhere
Diffstat (limited to 'src')
-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;