Browse Source

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

MissValeska 10 years ago
parent
commit
9918b99634
3 changed files with 20 additions and 14 deletions
  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 View File

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

+ 7
- 3
src/inet.c View File

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

+ 1
- 0
src/mark.c View File

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

Loading…
Cancel
Save