summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-04-26 21:05:06 +0100
committerRoy Marples <roy@marples.name>2020-04-26 21:05:06 +0100
commit1e29ac03a30a4da556e1e9ad16af7b7872d6d7b0 (patch)
treeffb90913287a48c1610eb1d7096f3d9246e16a8a /src
parent9c817dc5a5567ca735a713a76f5b62f8bb954ea9 (diff)
downloaddhcpcd-1e29ac03a30a4da556e1e9ad16af7b7872d6d7b0.tar.xz
Align more CMSG foo.
Diffstat (limited to 'src')
-rw-r--r--src/dhcp6.c9
-rw-r--r--src/if-linux.c9
-rw-r--r--src/ipv6nd.c14
3 files changed, 22 insertions, 10 deletions
diff --git a/src/dhcp6.c b/src/dhcp6.c
index 2956f683..0f2f324b 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -1219,7 +1219,10 @@ dhcp6_sendmessage(struct interface *ifp, void (*callback)(void *))
struct iovec iov = {
.iov_base = state->send, .iov_len = state->send_len,
};
- unsigned char ctl[CMSG_SPACE(sizeof(struct in6_pktinfo))] = { 0 };
+ union {
+ struct cmsghdr hdr;
+ uint8_t buf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+ } cmsgbuf = { .buf = { 0 } };
struct msghdr msg = {
.msg_name = &dst, .msg_namelen = sizeof(dst),
.msg_iov = &iov, .msg_iovlen = 1,
@@ -1328,8 +1331,8 @@ dhcp6_sendmessage(struct interface *ifp, void (*callback)(void *))
struct in6_pktinfo pi = { .ipi6_ifindex = ifp->index };
dst.sin6_scope_id = ifp->index;
- msg.msg_control = ctl;
- msg.msg_controllen = sizeof(ctl);
+ msg.msg_control = cmsgbuf.buf;
+ msg.msg_controllen = sizeof(cmsgbuf.buf);
cm = CMSG_FIRSTHDR(&msg);
if (cm == NULL) /* unlikely */
return -1;
diff --git a/src/if-linux.c b/src/if-linux.c
index 8d397ebc..c2e7b9a7 100644
--- a/src/if-linux.c
+++ b/src/if-linux.c
@@ -1673,14 +1673,17 @@ bpf_read(struct interface *ifp, int s, void *data, size_t len,
};
struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1 };
#ifdef PACKET_AUXDATA
- unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))] = { 0 };
+ union {
+ struct cmsghdr hdr;
+ uint8_t buf[CMSG_SPACE(sizeof(struct tpacket_auxdata))];
+ } cmsgbuf = { .buf = { 0 } };
struct cmsghdr *cmsg;
struct tpacket_auxdata *aux;
#endif
#ifdef PACKET_AUXDATA
- msg.msg_control = cmsgbuf;
- msg.msg_controllen = sizeof(cmsgbuf);
+ msg.msg_control = cmsgbuf.buf;
+ msg.msg_controllen = sizeof(cmsgbuf.buf);
#endif
bytes = recvmsg(s, &msg, 0);
diff --git a/src/ipv6nd.c b/src/ipv6nd.c
index faf31561..99e92aaf 100644
--- a/src/ipv6nd.c
+++ b/src/ipv6nd.c
@@ -328,11 +328,14 @@ ipv6nd_sendrsprobe(void *arg)
.sin6_scope_id = ifp->index,
};
struct iovec iov = { .iov_base = state->rs, .iov_len = state->rslen };
- unsigned char ctl[CMSG_SPACE(sizeof(struct in6_pktinfo))] = { 0 };
+ union {
+ struct cmsghdr hdr;
+ uint8_t buf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+ } cmsgbuf = { .buf = { 0 } };
struct msghdr msg = {
.msg_name = &dst, .msg_namelen = sizeof(dst),
.msg_iov = &iov, .msg_iovlen = 1,
- .msg_control = ctl, .msg_controllen = sizeof(ctl),
+ .msg_control = cmsgbuf.buf, .msg_controllen = sizeof(cmsgbuf.buf),
};
struct cmsghdr *cm;
struct in6_pktinfo pi = { .ipi6_ifindex = ifp->index };
@@ -402,11 +405,14 @@ ipv6nd_sendadvertisement(void *arg)
.sin6_scope_id = ifp->index,
};
struct iovec iov = { .iov_base = ia->na, .iov_len = ia->na_len };
- unsigned char ctl[CMSG_SPACE(sizeof(struct in6_pktinfo))] = { 0 };
+ union {
+ struct cmsghdr hdr;
+ uint8_t buf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+ } cmsgbuf = { .buf = { 0 } };
struct msghdr msg = {
.msg_name = &dst, .msg_namelen = sizeof(dst),
.msg_iov = &iov, .msg_iovlen = 1,
- .msg_control = ctl, .msg_controllen = sizeof(ctl),
+ .msg_control = cmsgbuf.buf, .msg_controllen = sizeof(cmsgbuf.buf),
};
struct cmsghdr *cm;
struct in6_pktinfo pi = { .ipi6_ifindex = ifp->index };