You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.0 KiB
82 lines
2.0 KiB
Index: dnstracer.c |
|
--- dnstracer.c.orig 2008-02-09 13:47:37 +0100 |
|
+++ dnstracer.c 2008-02-10 10:08:43 +0100 |
|
@@ -689,7 +689,11 @@ |
|
} |
|
|
|
void |
|
+#ifdef NOIPV6 |
|
+dump_data(struct sockaddr_in *dest4, void *dest6, struct dnssession *session) |
|
+#else |
|
dump_data(struct sockaddr_in *dest4, struct sockaddr_in6 *dest6, struct dnssession *session) |
|
+#endif |
|
{ |
|
struct dnsrr *answerrr; |
|
struct dnsrr *authorityrr; |
|
@@ -810,6 +814,7 @@ |
|
exit(1); |
|
} |
|
|
|
+#if defined(AI_NUMERICHOST) && defined(EAI_NODATA) |
|
if (global_source_address != NULL) { |
|
struct addrinfo hints, *src_res; |
|
int error; |
|
@@ -836,6 +841,7 @@ |
|
exit(1); |
|
} |
|
} |
|
+#endif |
|
|
|
return s; |
|
} |
|
@@ -1123,6 +1129,25 @@ |
|
|
|
/*****************************************************************************/ |
|
|
|
+static char *my_strcasestr(const char *s, const char *find) |
|
+{ |
|
+ char c, sc; |
|
+ size_t len; |
|
+ |
|
+ if ((c = *find++) != 0) { |
|
+ c = tolower((unsigned char)c); |
|
+ len = strlen(find); |
|
+ do { |
|
+ do { |
|
+ if ((sc = *s++) == 0) |
|
+ return (NULL); |
|
+ } while ((char)tolower((unsigned char)sc) != c); |
|
+ } while (strncasecmp(s, find, len) != 0); |
|
+ s--; |
|
+ } |
|
+ return ((char *)s); |
|
+} |
|
+ |
|
// |
|
// The core of this program |
|
// |
|
@@ -1198,7 +1223,11 @@ |
|
// don't have to worry about packets received from previous sessions. |
|
// |
|
session = (struct dnssession *)calloc(1, sizeof(struct dnssession)); |
|
+#ifdef NOIPV6 |
|
+ session->socket = create_socket(AF_INET); |
|
+#else |
|
session->socket = create_socket(ipv6 ? AF_INET6 : AF_INET); |
|
+#endif |
|
session->ipv6 = ipv6; |
|
session->server = strdup(server_ip); |
|
session->host = strdup(host); |
|
@@ -1377,8 +1406,12 @@ |
|
struct hostent *h; |
|
char **addr_list = NULL; |
|
|
|
+#ifndef NOIPV6 |
|
h = gethostbyname2(nextserver_name, |
|
ip == 0 ? AF_INET : AF_INET6); |
|
+#else |
|
+ h = gethostbyname(nextserver_name); |
|
+#endif |
|
if (h == NULL) continue; |
|
|
|
//
|
|
|