Browse Source

[dns] Disambiguate "no nameserver" and "no DNS record" errors

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
34dab1007c
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      src/net/udp/dns.c

+ 10
- 2
src/net/udp/dns.c View File

46
 
46
 
47
 FEATURE ( FEATURE_PROTOCOL, "DNS", DHCP_EB_FEATURE_DNS, 1 );
47
 FEATURE ( FEATURE_PROTOCOL, "DNS", DHCP_EB_FEATURE_DNS, 1 );
48
 
48
 
49
+/* Disambiguate the various error causes */
50
+#define ENXIO_NO_RECORD __einfo_error ( EINFO_ENXIO_NO_RECORD )
51
+#define EINFO_ENXIO_NO_RECORD \
52
+	__einfo_uniqify ( EINFO_ENXIO, 0x01, "DNS name does not exist" )
53
+#define ENXIO_NO_NAMESERVER __einfo_error ( EINFO_ENXIO_NO_NAMESERVER )
54
+#define EINFO_ENXIO_NO_NAMESERVER \
55
+	__einfo_uniqify ( EINFO_ENXIO, 0x02, "No DNS servers available" )
56
+
49
 /** The DNS server */
57
 /** The DNS server */
50
 static struct sockaddr_tcpip nameserver = {
58
 static struct sockaddr_tcpip nameserver = {
51
 	.st_port = htons ( DNS_PORT ),
59
 	.st_port = htons ( DNS_PORT ),
438
 			goto done;
446
 			goto done;
439
 		} else {
447
 		} else {
440
 			DBGC ( dns, "DNS %p found no CNAME record\n", dns );
448
 			DBGC ( dns, "DNS %p found no CNAME record\n", dns );
441
-			dns_done ( dns, -ENXIO );
449
+			dns_done ( dns, -ENXIO_NO_RECORD );
442
 			rc = 0;
450
 			rc = 0;
443
 			goto done;
451
 			goto done;
444
 		}
452
 		}
507
 	if ( ! nameserver.st_family ) {
515
 	if ( ! nameserver.st_family ) {
508
 		DBG ( "DNS not attempting to resolve \"%s\": "
516
 		DBG ( "DNS not attempting to resolve \"%s\": "
509
 		      "no DNS servers\n", name );
517
 		      "no DNS servers\n", name );
510
-		rc = -ENXIO;
518
+		rc = -ENXIO_NO_NAMESERVER;
511
 		goto err_no_nameserver;
519
 		goto err_no_nameserver;
512
 	}
520
 	}
513
 
521
 

Loading…
Cancel
Save