]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
more portable msghdr.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 3 Apr 2007 10:01:54 +0000 (10:01 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 3 Apr 2007 10:01:54 +0000 (10:01 +0000)
git-svn-id: file:///svn/unbound/trunk@218 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/data/msgreply.c
util/netevent.c

index f1097aefd4194294f10b2f410d92dc87ebe2c714..7e825dbc0def5cfcdf10f87d0170129877361999 100644 (file)
@@ -6,6 +6,7 @@
        - constants for DNS flags. 
        - compilation without locks fixup.
        - removed include of unportable header from lookup3.c.
+       - more portable use of struct msghdr.
 
 2 April 2007: Wouter
        - check sizes of udp received messages, not too short.
index 9d3974148e374f46c321e276b4048bf10b430ba2..374ac8764ebdbc64fd26c4086cc887c02db9d62f 100644 (file)
@@ -217,7 +217,7 @@ reply_info_answer_iov(struct reply_info* rep, uint16_t qid,
        /* [0]=reserved for tcplen, [1]=id, [2]=flags, [3]=message */
        struct iovec iov[4];
 
-       iov[1].iov_base = &qid;
+       iov[1].iov_base = (void*)&qid;
        iov[1].iov_len = sizeof(uint16_t);
        if(!cached) {
                /* original flags, copy RD bit from query. */
@@ -228,9 +228,9 @@ reply_info_answer_iov(struct reply_info* rep, uint16_t qid,
        }
        log_assert(qflags & BIT_QR); /* QR bit must be on in our replies */
        qflags = htons(qflags);
-       iov[2].iov_base = &qflags;
+       iov[2].iov_base = (void*)&qflags;
        iov[2].iov_len = sizeof(uint16_t);
-       iov[3].iov_base = rep->reply;
+       iov[3].iov_base = (void*)rep->reply;
        iov[3].iov_len = rep->replysize;
        comm_point_send_reply_iov(comrep, iov, 4);
 }
index ad5f690a42d13c3520e08ca30da1fbf2d4c5bd00..8dca4ed5b7a4645afd9ff230457004952dcfe738 100644 (file)
@@ -787,13 +787,11 @@ comm_point_send_reply_iov(struct comm_reply* repinfo, struct iovec* iov,
        log_assert(repinfo && repinfo->c);
        if(repinfo->c->type == comm_udp) {
                struct msghdr hdr;
+               memset(&hdr, 0, sizeof(hdr));
                hdr.msg_name = &repinfo->addr;
                hdr.msg_namelen = repinfo->addrlen;
                hdr.msg_iov = iov + 1;
                hdr.msg_iovlen = (TYPE_MSGIOVLEN)(iovlen - 1);
-               hdr.msg_control = NULL;
-               hdr.msg_controllen = 0;
-               hdr.msg_flags = 0;
                /* note that number of characters sent is not checked. */
                if(sendmsg(repinfo->c->fd, &hdr, 0) == -1)
                        log_err("sendmsg: %s", strerror(errno));
@@ -805,7 +803,7 @@ comm_point_send_reply_iov(struct comm_reply* repinfo, struct iovec* iov,
                for(i=1; i<iovlen; i++)
                        len += iov[i].iov_len;
                len = htons(len);
-               iov[0].iov_base = &len;
+               iov[0].iov_base = (void*)&len;
                iov[0].iov_len = sizeof(uint16_t);
                if((done=writev(repinfo->c->fd, iov, (int)iovlen)) == -1) {
 #ifdef S_SPLINT_S