diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-03-29 04:31:19 +0200 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2015-03-29 13:57:51 +0200 |
commit | 0a9d2fcf8e955b7e7a3247ef354a2d4e12a17f62 (patch) | |
tree | 1cef24c4aa5dcfa95df7708f1a9b65b3f2e1b162 /src/odhcpd.c | |
parent | 721db56281dba79158470d7f69ccc7577f11fbb6 (diff) |
odhcpd: use proper struct msghdr initializers to fix build error on musl
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'src/odhcpd.c')
-rw-r--r-- | src/odhcpd.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c index 3c384e8..24ef891 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -153,8 +153,15 @@ ssize_t odhcpd_send(int socket, struct sockaddr_in6 *dest, { // Construct headers uint8_t cmsg_buf[CMSG_SPACE(sizeof(struct in6_pktinfo))] = {0}; - struct msghdr msg = {(void*)dest, sizeof(*dest), iov, iov_len, - cmsg_buf, sizeof(cmsg_buf), 0}; + struct msghdr msg = { + .msg_name = (void *) dest, + .msg_namelen = sizeof(*dest), + .msg_iov = iov, + .msg_iovlen = iov_len, + .msg_control = cmsg_buf, + .msg_controllen = sizeof(cmsg_buf), + .msg_flags = 0 + }; // Set control data (define destination interface) struct cmsghdr *chdr = CMSG_FIRSTHDR(&msg); @@ -331,8 +338,15 @@ static void odhcpd_receive_packets(struct uloop_fd *u, _unused unsigned int even while (true) { struct iovec iov = {data_buf, sizeof(data_buf)}; - struct msghdr msg = {&addr, sizeof(addr), &iov, 1, - cmsg_buf, sizeof(cmsg_buf), 0}; + struct msghdr msg = { + .msg_name = (void *) &addr, + .msg_namelen = sizeof(addr), + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = cmsg_buf, + .msg_controllen = sizeof(cmsg_buf), + .msg_flags = 0 + }; ssize_t len = recvmsg(u->fd, &msg, MSG_DONTWAIT); if (len < 0) { |