]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4491. [bug] Improve message emitted when testing whether sendmsg
authorMark Andrews <marka@isc.org>
Wed, 26 Oct 2016 22:02:06 +0000 (09:02 +1100)
committerMark Andrews <marka@isc.org>
Wed, 26 Oct 2016 22:02:06 +0000 (09:02 +1100)
                        works with TOS/TCLASS fails. [RT #43483]

CHANGES
lib/isc/unix/net.c

diff --git a/CHANGES b/CHANGES
index 2eac3325caceeda7599a42475277f2bfca8c8750..ce43fac4ab02cebe99ceb2416bf51c6d4a86f452 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4491.  [bug]           Improve message emitted when testing whether sendmsg
+                       works with TOS/TCLASS fails. [RT #43483]
+
 4490.  [maint]         Added AAAA (2001:500:12::d0d) for G.ROOT-SERVERS.NET.
 
 4489.  [security]      It was possible to trigger assertions when processing
index e40e647b1deb2edf5133e0c12443fbdc9e7ca5cd..07cca465c8f1e102ce3fa430c991850e1c2f0290 100644 (file)
@@ -500,7 +500,7 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) {
                unsigned char b[256];
        } control;
        struct cmsghdr *cmsgp;
-       int dscp = 46;
+       int dscp = (46 << 2);   /* Expedited forwarding. */
        struct iovec iovec;
        char buf[1] = { 0 };
        isc_result_t result;
@@ -562,6 +562,8 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) {
 
        if (sendmsg(s, &msg, 0) < 0) {
                int debug = ISC_LOG_DEBUG(10);
+               const char *typestr;
+               const char *msgstr;
                switch (errno) {
 #ifdef ENOPROTOOPT
                case ENOPROTOOPT:
@@ -580,13 +582,12 @@ cmsgsend(int s, int level, int type, struct addrinfo *res) {
                                      ISC_LOGMODULE_SOCKET, ISC_LOG_DEBUG(10),
                                      "sendmsg: %s", strbuf);
                } else {
-                       UNEXPECTED_ERROR(__FILE__, __LINE__,
-                                        "sendmsg() %s: %s",
-                                        isc_msgcat_get(isc_msgcat,
-                                                       ISC_MSGSET_GENERAL,
-                                                       ISC_MSG_FAILED,
-                                                       "failed"),
-                                        strbuf);
+                       typestr = (type == IP_TOS) ? "IP_TOS" : "IPV6_TCLASS";
+                       msgstr = isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
+                                               ISC_MSG_FAILED, "failed");
+                       UNEXPECTED_ERROR(__FILE__, __LINE__, "probing "
+                                        "sendmsg() with %s=%02x %s: %s",
+                                        typestr, dscp, msgstr, strbuf);
                }
                return (ISC_FALSE);
        }