Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/external/bsd/nsd/dist Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/b35bfe3b7318
branches:  netbsd-8
changeset: 446017:b35bfe3b7318
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 20 16:02:50 2018 +0000

description:
Pull up following revision(s) (requested by hannken in ticket #1098):

        external/bsd/nsd/dist/server.c: revision 1.2

Fix NSD when built with --enable-recvmmsg:

When resetting a query with query_reset(queries[i], ...) always restore the
corresponding msgs[i].msg_hdr.msg_namelen from queries[i]->addrlen.

After receiving a message set queries[i]->addrlen to the received msg_namelen.

Reported upstream, will be fixed for 4.1.26

diffstat:

 external/bsd/nsd/dist/server.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (61 lines):

diff -r 77fbcb2f0e50 -r b35bfe3b7318 external/bsd/nsd/dist/server.c
--- a/external/bsd/nsd/dist/server.c    Sun Nov 18 19:34:52 2018 +0000
+++ b/external/bsd/nsd/dist/server.c    Tue Nov 20 16:02:50 2018 +0000
@@ -2209,6 +2209,7 @@
        for (i = 0; i < recvcount; i++) {
        loopstart:
                received = msgs[i].msg_len;
+               queries[i]->addrlen = msgs[i].msg_hdr.msg_namelen;
                q = queries[i];
                if (received == -1) {
                        log_msg(LOG_ERR, "recvmmsg %d failed %s", i, strerror(
@@ -2217,6 +2218,7 @@
                        /* No zone statup */
                        query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
                        iovecs[i].iov_len = buffer_remaining(q->packet);
+                       msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
                        goto swap_drop;
                }
 
@@ -2264,6 +2266,7 @@
                } else {
                        query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
                        iovecs[i].iov_len = buffer_remaining(q->packet);
+                       msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
                swap_drop:
                        STATUP(data->nsd, dropped);
                        ZTATUP(data->nsd, q->zone, dropped);
@@ -2304,6 +2307,7 @@
        for(i=0; i<recvcount; i++) {
                query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
                iovecs[i].iov_len = buffer_remaining(queries[i]->packet);
+               msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
        }
 }
 
@@ -2344,13 +2348,15 @@
        }
        for (i = 0; i < recvcount; i++) {
                received = msgs[i].msg_len;
-               msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
+               queries[i]->addrlen = msgs[i].msg_hdr.msg_namelen;
                if (received == -1) {
                        log_msg(LOG_ERR, "recvmmsg failed");
                        STATUP(data->nsd, rxerr);
                        /* No zone statup */
                        /* the error can be found in msgs[i].msg_hdr.msg_flags */
                        query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
+                       iovecs[i].iov_len = buffer_remaining(queries[i]->packet);
+                       msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
                        continue;
                }
                q = queries[i];
@@ -2442,6 +2448,8 @@
 #ifndef NONBLOCKING_IS_BROKEN
 #ifdef HAVE_RECVMMSG
                query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
+               iovecs[i].iov_len = buffer_remaining(queries[i]->packet);
+               msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 #endif
        }
 #endif



Home | Main Index | Thread Index | Old Index