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

This commit is contained in:
MissValeska 2014-03-18 18:29:15 -07:00
parent b28ac22fb3
commit 9918b99634
3 changed files with 20 additions and 14 deletions

View File

@ -2,7 +2,7 @@
* (c) Copyright 2005 Andrea Lo Pumo aka AlpT <alpt@freaknet.org> * (c) Copyright 2005 Andrea Lo Pumo aka AlpT <alpt@freaknet.org>
* *
* This source code is free software; you can redistribute it and/or * This source code is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published * modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, * by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version. * or (at your option) any later version.
* *
@ -20,7 +20,7 @@
* *
* The DNS wrapper listens to the port 53 for DNS hostname resolution queries, * The DNS wrapper listens to the port 53 for DNS hostname resolution queries,
* it then resolves the hostname by using the ANDNA system and sends back the * it then resolves the hostname by using the ANDNA system and sends back the
* resolved ip. In this way, every program can use ANDNA: just set * resolved ip. In this way, every program can use ANDNA: just set
* "nameserver localhost" * "nameserver localhost"
* in /etc/resolv.conf ;) * in /etc/resolv.conf ;)
*/ */
@ -49,7 +49,7 @@
/* /*
* dns_exec_pkt: resolve the hostname contained in the DNS query and sends * dns_exec_pkt: resolve the hostname contained in the DNS query and sends
* the reply to from. * the reply to from.
* `passed_argv' is a pointer to a dns_exec_pkt_argv struct. * `passed_argv' is a pointer to a dns_exec_pkt_argv struct.
*/ */
void *dns_exec_pkt(void *passed_argv) void *dns_exec_pkt(void *passed_argv)
@ -77,6 +77,7 @@ void *dns_exec_pkt(void *passed_argv)
/* Send the DNS reply */ /* Send the DNS reply */
bytes_sent=inet_sendto(argv.sk, answer_buffer, answer_length, 0, bytes_sent=inet_sendto(argv.sk, answer_buffer, answer_length, 0,
&argv.from, argv.from_len); &argv.from, argv.from_len);
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);
if(bytes_sent != answer_length) if(bytes_sent != answer_length)
debug(DBG_SOFT, ERROR_MSG "inet_sendto error: %s", ERROR_POS, debug(DBG_SOFT, ERROR_MSG "inet_sendto error: %s", ERROR_POS,
strerror(errno)); strerror(errno));
@ -103,7 +104,7 @@ void dns_wrapper_daemon(u_short port)
#ifdef DEBUG #ifdef DEBUG
int select_errors=0; int select_errors=0;
#endif #endif
pthread_attr_init(&t_attr); pthread_attr_init(&t_attr);
pthread_attr_setdetachstate(&t_attr, PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&t_attr, PTHREAD_CREATE_DETACHED);
pthread_mutex_init(&dns_exec_lock, 0); pthread_mutex_init(&dns_exec_lock, 0);
@ -117,10 +118,10 @@ void dns_wrapper_daemon(u_short port)
for(;;) { for(;;) {
if(!sk) if(!sk)
fatal("The dns_wrapper_daemon socket got corrupted"); fatal("The dns_wrapper_daemon socket got corrupted");
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(sk, &fdset); FD_SET(sk, &fdset);
ret = select(sk+1, &fdset, NULL, NULL, NULL); ret = select(sk+1, &fdset, NULL, NULL, NULL);
if(sigterm_timestamp) if(sigterm_timestamp)
/* NetsukukuD has been closed */ /* NetsukukuD has been closed */
@ -131,7 +132,7 @@ void dns_wrapper_daemon(u_short port)
break; break;
select_errors++; select_errors++;
#endif #endif
error("dns_wrapper_daemonp: select error: %s", error("dns_wrapper_daemonp: select error: %s",
strerror(errno)); strerror(errno));
continue; continue;
} }
@ -141,7 +142,7 @@ void dns_wrapper_daemon(u_short port)
setzero(&buf, MAX_DNS_PKT_SZ); setzero(&buf, MAX_DNS_PKT_SZ);
setzero(&exec_pkt_argv.from, sizeof(struct sockaddr)); setzero(&exec_pkt_argv.from, sizeof(struct sockaddr));
setzero(&exec_pkt_argv, sizeof(struct dns_exec_pkt_argv)); setzero(&exec_pkt_argv, sizeof(struct dns_exec_pkt_argv));
exec_pkt_argv.from_len = my_family == AF_INET ? exec_pkt_argv.from_len = my_family == AF_INET ?
sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
@ -153,14 +154,14 @@ void dns_wrapper_daemon(u_short port)
" query pkt aborted!"); " query pkt aborted!");
continue; continue;
} }
/* Exec the pkt in another thread */ /* Exec the pkt in another thread */
exec_pkt_argv.sk=sk; exec_pkt_argv.sk=sk;
exec_pkt_argv.rpkt_sz=err; exec_pkt_argv.rpkt_sz=err;
exec_pkt_argv.rpkt=buf; exec_pkt_argv.rpkt=buf;
pthread_mutex_lock(&dns_exec_lock); pthread_mutex_lock(&dns_exec_lock);
pthread_create(&thread, &t_attr, dns_exec_pkt, pthread_create(&thread, &t_attr, dns_exec_pkt,
(void *)&exec_pkt_argv); (void *)&exec_pkt_argv);
pthread_mutex_lock(&dns_exec_lock); pthread_mutex_lock(&dns_exec_lock);
pthread_mutex_unlock(&dns_exec_lock); pthread_mutex_unlock(&dns_exec_lock);

View File

@ -1053,17 +1053,21 @@ ssize_t inet_sendto(int s, const void *msg, size_t len, int flags,
ssize_t err; ssize_t err;
fd_set fdset; fd_set fdset;
int ret; int ret;
int errno_int;
if((err=sendto(s, msg, len, flags, to, tolen))==-1) { if((err=sendto(s, msg, len, flags, to, tolen))==-1) {
errno_int = errno;
error("sendto errno: %d err is: %d", errno, err); error("sendto errno: %d err is: %d", errno, err);
switch(errno) switch(errno_int)
{ {
case EMSGSIZE: case EMSGSIZE:
error("Packet artificially fragmented: %d", stderr);
inet_sendto(s, msg, len/2, flags, to, tolen); inet_sendto(s, msg, len/2, flags, to, tolen);
err=inet_sendto(s, ((const char *)msg+(len/2)), err=inet_sendto(s, ((const char *)msg+(len/2)),
len-(len/2), flags, to, tolen); len-(len/2), flags, to, tolen);
break; break;
case EFAULT:
error("The value of to is: %d", to);
default: default:
error("inet_sendto: Cannot send(): %s", strerror(errno)); error("inet_sendto: Cannot send(): %s", strerror(errno));
return err; return err;

View File

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