mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-03 13:29:36 -05:00
more portable msghdr.
git-svn-id: file:///svn/unbound/trunk@218 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
cd67cb6869
commit
c214e7c4cb
3 changed files with 6 additions and 7 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue