odhcpd: use proper struct msghdr initializers to fix build error on musl
authorFelix Fietkau <nbd@openwrt.org>
Sun, 29 Mar 2015 02:31:19 +0000 (04:31 +0200)
committerSteven Barth <steven@midlink.org>
Sun, 29 Mar 2015 11:57:51 +0000 (13:57 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
src/odhcpd.c

index 3c384e831cd5b76267e0981fb7b9b766ec9466d8..24ef891d3c5be7059b6a9675ff1b2752f10a5221 100644 (file)
@@ -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) {