瀏覽代碼

Added debugging.

tags/v0.9.3
Michael Brown 19 年之前
父節點
當前提交
1644238813
共有 2 個檔案被更改,包括 9 行新增2 行删除
  1. 8
    2
      src/core/resolv.c
  2. 1
    0
      src/include/resolv.h

+ 8
- 2
src/core/resolv.c 查看文件

@@ -12,14 +12,20 @@ int resolv ( struct in_addr *address, const char *name ) {
12 12
 	struct resolver *resolver;
13 13
 
14 14
 	/* Check for a dotted quad IP address first */
15
-	if ( inet_aton ( name, address ) )
15
+	if ( inet_aton ( name, address ) ) {
16
+		DBG ( "RESOLV saw valid IP address %s\n", name );
16 17
 		return 1;
18
+	}
17 19
 
18 20
 	/* Try any compiled-in name resolution modules */
19 21
 	for ( resolver = resolvers ; resolver < resolvers_end ; resolver++ ) {
20
-		if ( resolver->resolv ( address, name ) )
22
+		if ( resolver->resolv ( address, name ) ) {
23
+			DBG ( "RESOLV resolved \"%s\" to %@ using %s\n",
24
+			      name, address->s_addr, resolver->name );
21 25
 			return 1;
26
+		}
22 27
 	}
23 28
 
29
+	DBG ( "RESOLV failed to resolve %s\n", name );
24 30
 	return 0;
25 31
 }

+ 1
- 0
src/include/resolv.h 查看文件

@@ -5,6 +5,7 @@
5 5
 #include "tables.h"
6 6
 
7 7
 struct resolver {
8
+	const char *name;
8 9
 	int ( * resolv ) ( struct in_addr *address, const char *name );
9 10
 };
10 11
 

Loading…
取消
儲存