瀏覽代碼

Abort immediately if no nameserver is present.

tags/v0.9.3
Michael Brown 19 年之前
父節點
當前提交
0cfcd91558
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. 6
    0
      src/proto/dns.c

+ 6
- 0
src/proto/dns.c 查看文件

@@ -249,6 +249,12 @@ static int dns_resolv ( struct in_addr *addr, const char *name ) {
249 249
 	unsigned int recursion = 0;
250 250
 	unsigned int id = 1;
251 251
 
252
+	/* Fail immediately if we have no name server */
253
+	if ( ! arptable[ARP_NAMESERVER].ipaddr.s_addr ) {
254
+		DBG ( "DNS has no nameserver\n" );
255
+		return 0;
256
+	}
257
+
252 258
 	DBG ( "DNS resolving %s\n", name );
253 259
 
254 260
 	/* Set up the query data */

Loading…
取消
儲存