12745e
commit 3e3002ffead0526d088c353f97475400367087da
12745e
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
12745e
Date:   Tue Feb 24 12:57:26 2015 +0530
12745e
12745e
    Skip logging for DNSSEC responses [BZ 14841]
12745e
    
12745e
    DNSSEC defines a number of response types that one me expect when the
12745e
    DO bit is set.  We don't process any of them, but since we do allow
12745e
    setting the DO bit, skip them without logging an error since it is
12745e
    only a nuisance.
12745e
    
12745e
    Tested on x86_64.
12745e
    
12745e
    	[BZ #14841]
12745e
    	* resolv/gethnamaddr.c (getanswer): Skip logging if
12745e
    	RES_USE_DNSSEC is set.
12745e
    	* resolv/nss_dns/dns-host.c (getanswer_r): Likewise.
12745e
12745e
diff --git glibc-2.17-c758a686/resolv/gethnamaddr.c glibc-2.17-c758a686/resolv/gethnamaddr.c
12745e
index a861a84..7fd0e49 100644
12745e
--- glibc-2.17-c758a686/resolv/gethnamaddr.c
12745e
+++ glibc-2.17-c758a686/resolv/gethnamaddr.c
12745e
@@ -331,23 +331,18 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype)
12745e
 			buflen -= n;
12745e
 			continue;
12745e
 		}
12745e
-		if ((type == T_SIG) || (type == T_KEY) || (type == T_NXT)) {
12745e
-			/* We don't support DNSSEC yet.  For now, ignore
12745e
-			 * the record and send a low priority message
12745e
-			 * to syslog.
12745e
-			 */
12745e
-			syslog(LOG_DEBUG|LOG_AUTH,
12745e
-	       "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
12745e
-			       qname, p_class(C_IN), p_type(qtype),
12745e
-			       p_type(type));
12745e
-			cp += n;
12745e
-			continue;
12745e
-		}
12745e
 		if (type != qtype) {
12745e
-			syslog(LOG_NOTICE|LOG_AUTH,
12745e
+			/* Log a low priority message if we get an unexpected
12745e
+			 * record, but skip it if we are using DNSSEC since it
12745e
+			 * uses many different types in responses that do not
12745e
+			 * match QTYPE.
12745e
+			 */
12745e
+			if ((_res.options & RES_USE_DNSSEC) == 0) {
12745e
+				syslog(LOG_NOTICE|LOG_AUTH,
12745e
 	       "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
12745e
-			       qname, p_class(C_IN), p_type(qtype),
12745e
-			       p_type(type));
12745e
+					qname, p_class(C_IN), p_type(qtype),
12745e
+					p_type(type));
12745e
+			}
12745e
 			cp += n;
12745e
 			continue;		/* XXX - had_error++ ? */
12745e
 		}
12745e
diff --git glibc-2.17-c758a686/resolv/nss_dns/dns-host.c glibc-2.17-c758a686/resolv/nss_dns/dns-host.c
12745e
index f715ab0..b16b0dd 100644
12745e
--- glibc-2.17-c758a686/resolv/nss_dns/dns-host.c
12745e
+++ glibc-2.17-c758a686/resolv/nss_dns/dns-host.c
12745e
@@ -820,26 +820,19 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
12745e
 	  linebuflen -= n;
12745e
 	  continue;
12745e
 	}
12745e
-      if (__builtin_expect (type == T_SIG, 0)
12745e
-	  || __builtin_expect (type == T_KEY, 0)
12745e
-	  || __builtin_expect (type == T_NXT, 0))
12745e
-	{
12745e
-	  /* We don't support DNSSEC yet.  For now, ignore the record
12745e
-	     and send a low priority message to syslog.  */
12745e
-	  syslog (LOG_DEBUG | LOG_AUTH,
12745e
-	       "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
12745e
-		  qname, p_class (C_IN), p_type(qtype), p_type (type));
12745e
-	  cp += n;
12745e
-	  continue;
12745e
-	}
12745e
 
12745e
       if (type == T_A && qtype == T_AAAA && map)
12745e
 	have_to_map = 1;
12745e
       else if (__builtin_expect (type != qtype, 0))
12745e
 	{
12745e
-	  syslog (LOG_NOTICE | LOG_AUTH,
12745e
-	       "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
12745e
-		  qname, p_class (C_IN), p_type (qtype), p_type (type));
12745e
+	  /* Log a low priority message if we get an unexpected record, but
12745e
+	     skip it if we are using DNSSEC since it uses many different types
12745e
+	     in responses that do not match QTYPE.  */
12745e
+	  if ((_res.options & RES_USE_DNSSEC) == 0)
12745e
+	    syslog (LOG_NOTICE | LOG_AUTH,
12745e
+		    "gethostby*.getanswer: asked for \"%s %s %s\", "
12745e
+		    "got type \"%s\"",
12745e
+		    qname, p_class (C_IN), p_type (qtype), p_type (type));
12745e
 	  cp += n;
12745e
 	  continue;			/* XXX - had_error++ ? */
12745e
 	}