瀏覽代碼

We are having a LOT of weird issues now, I need to do a lot of debugging, Please help.

MissValeska 10 年之前
父節點
當前提交
9918b99634
共有 3 個檔案被更改,包括 20 行新增14 行删除
  1. 12
    11
      src/dns_wrapper.c
  2. 7
    3
      src/inet.c
  3. 1
    0
      src/mark.c

+ 12
- 11
src/dns_wrapper.c 查看文件

@@ -2,7 +2,7 @@
2 2
  * (c) Copyright 2005 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
3 3
  *
4 4
  * This source code is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License as published 
5
+ * modify it under the terms of the GNU General Public License as published
6 6
  * by the Free Software Foundation; either version 2 of the License,
7 7
  * or (at your option) any later version.
8 8
  *
@@ -20,7 +20,7 @@
20 20
  *
21 21
  * The DNS wrapper listens to the port 53 for DNS hostname resolution queries,
22 22
  * it then resolves the hostname by using the ANDNA system and sends back the
23
- * resolved ip. In this way, every program can use ANDNA: just set 
23
+ * resolved ip. In this way, every program can use ANDNA: just set
24 24
  * "nameserver localhost"
25 25
  * in /etc/resolv.conf ;)
26 26
  */
@@ -49,7 +49,7 @@
49 49
 
50 50
 /*
51 51
  * dns_exec_pkt: resolve the hostname contained in the DNS query and sends
52
- * the reply to from. 
52
+ * the reply to from.
53 53
  * `passed_argv' is a pointer to a dns_exec_pkt_argv struct.
54 54
  */
55 55
 void *dns_exec_pkt(void *passed_argv)
@@ -77,6 +77,7 @@ void *dns_exec_pkt(void *passed_argv)
77 77
 	/* Send the DNS reply */
78 78
 	bytes_sent=inet_sendto(argv.sk, answer_buffer, answer_length, 0,
79 79
 			&argv.from, argv.from_len);
80
+        error("bytes_sent is: %d argv.sk is: %d answer_buffer is: %s answer_length is: %d argv.from is: %p agrv.from_len is: %p", bytes_sent,argv.sk, answer_buffer, answer_length, argv.from, argv.from_len);
80 81
 	if(bytes_sent != answer_length)
81 82
 		debug(DBG_SOFT, ERROR_MSG "inet_sendto error: %s", ERROR_POS,
82 83
 				strerror(errno));
@@ -103,7 +104,7 @@ void dns_wrapper_daemon(u_short port)
103 104
 #ifdef DEBUG
104 105
 	int select_errors=0;
105 106
 #endif
106
-	
107
+
107 108
 	pthread_attr_init(&t_attr);
108 109
 	pthread_attr_setdetachstate(&t_attr, PTHREAD_CREATE_DETACHED);
109 110
 	pthread_mutex_init(&dns_exec_lock, 0);
@@ -117,10 +118,10 @@ void dns_wrapper_daemon(u_short port)
117 118
 	for(;;) {
118 119
 		if(!sk)
119 120
 			fatal("The dns_wrapper_daemon socket got corrupted");
120
-		
121
+
121 122
 		FD_ZERO(&fdset);
122 123
 		FD_SET(sk, &fdset);
123
-		
124
+
124 125
 		ret = select(sk+1, &fdset, NULL, NULL, NULL);
125 126
 		if(sigterm_timestamp)
126 127
 			/* NetsukukuD has been closed */
@@ -131,7 +132,7 @@ void dns_wrapper_daemon(u_short port)
131 132
 				break;
132 133
 			select_errors++;
133 134
 #endif
134
-			error("dns_wrapper_daemonp: select error: %s", 
135
+			error("dns_wrapper_daemonp: select error: %s",
135 136
 					strerror(errno));
136 137
 			continue;
137 138
 		}
@@ -141,7 +142,7 @@ void dns_wrapper_daemon(u_short port)
141 142
 		setzero(&buf, MAX_DNS_PKT_SZ);
142 143
 		setzero(&exec_pkt_argv.from, sizeof(struct sockaddr));
143 144
 		setzero(&exec_pkt_argv, sizeof(struct dns_exec_pkt_argv));
144
-		
145
+
145 146
 		exec_pkt_argv.from_len = my_family == AF_INET ?
146 147
 			sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
147 148
 
@@ -153,14 +154,14 @@ void dns_wrapper_daemon(u_short port)
153 154
 					" query pkt aborted!");
154 155
 			continue;
155 156
 		}
156
-		
157
+
157 158
 		/* Exec the pkt in another thread */
158 159
 		exec_pkt_argv.sk=sk;
159 160
 		exec_pkt_argv.rpkt_sz=err;
160 161
 		exec_pkt_argv.rpkt=buf;
161
-		
162
+
162 163
 		pthread_mutex_lock(&dns_exec_lock);
163
-		pthread_create(&thread, &t_attr, dns_exec_pkt, 
164
+		pthread_create(&thread, &t_attr, dns_exec_pkt,
164 165
 				(void *)&exec_pkt_argv);
165 166
 		pthread_mutex_lock(&dns_exec_lock);
166 167
 		pthread_mutex_unlock(&dns_exec_lock);

+ 7
- 3
src/inet.c 查看文件

@@ -1053,17 +1053,21 @@ ssize_t inet_sendto(int s, const void *msg, size_t len, int flags,
1053 1053
 	ssize_t err;
1054 1054
 	fd_set fdset;
1055 1055
 	int ret;
1056
-
1056
+	int errno_int;
1057
+	
1057 1058
 	if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
1059
+		errno_int = errno;
1058 1060
 		error("sendto errno: %d err is: %d", errno, err);
1059
-		switch(errno)
1061
+		switch(errno_int)
1060 1062
 		{
1061 1063
 			case EMSGSIZE:
1064
+			error("Packet artificially fragmented: %d", stderr);
1062 1065
 				inet_sendto(s, msg, len/2, flags, to, tolen);
1063 1066
 				err=inet_sendto(s, ((const char *)msg+(len/2)), 
1064 1067
 						len-(len/2), flags, to, tolen);
1065 1068
 				break;
1066
-
1069
+			case EFAULT:
1070
+			error("The value of to is: %d", to);
1067 1071
 			default:
1068 1072
 				error("inet_sendto: Cannot send(): %s", strerror(errno));
1069 1073
 				return err;

+ 1
- 0
src/mark.c 查看文件

@@ -325,6 +325,7 @@ int store_rules()
325 325
 			return 0;
326 326
 		}
327 327
 		else {
328
+            error("This is store_rules, And the value of t is: %p", t);
328 329
 			commit_rules(&t);
329 330
 			error("In store_rules: %s.",iptc_strerror(errno));
330 331
 			err_ret(ERR_NETSTO,-1);

Loading…
取消
儲存