From 0a9d2fcf8e955b7e7a3247ef354a2d4e12a17f62 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 29 Mar 2015 04:31:19 +0200 Subject: odhcpd: use proper struct msghdr initializers to fix build error on musl Signed-off-by: Felix Fietkau --- src/odhcpd.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3