summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-06-10 19:10:47 +0200
committerLennart Poettering <lennart@poettering.net>2015-06-10 19:29:47 +0200
commit2a1288ff89322a2f49c79f6d1832c8164c14a05c (patch)
tree02cc41ade7b814d258b183c0ac88670163194913 /src/libsystemd-network
parent5410b2ed62289d8ab6575e64951ac7b6bda51d40 (diff)
util: introduce CMSG_FOREACH() macro and make use of it everywhere
It's only marginally shorter then the usual for() loop, but certainly more readable.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c2
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 0193e42d65..6853038b67 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -1588,7 +1588,7 @@ static int client_receive_message_raw(sd_event_source *s, int fd,
} else if ((size_t)len < sizeof(DHCPPacket))
return 0;
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ CMSG_FOREACH(cmsg, &msg) {
if (cmsg->cmsg_level == SOL_PACKET &&
cmsg->cmsg_type == PACKET_AUXDATA &&
cmsg->cmsg_len == CMSG_LEN(sizeof(struct tpacket_auxdata))) {
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index a0a2320efa..cc5e032344 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -902,7 +902,7 @@ static int server_receive_message(sd_event_source *s, int fd,
else if ((size_t)len < sizeof(DHCPMessage))
return 0;
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ CMSG_FOREACH(cmsg, &msg) {
if (cmsg->cmsg_level == IPPROTO_IP &&
cmsg->cmsg_type == IP_PKTINFO &&
cmsg->cmsg_len == CMSG_LEN(sizeof(struct in_pktinfo))) {