1
--- deadwood-3.0.05/src/DwSocket.h 2011-11-10 11:46:56.000000000 -0600
2
+++ deadwood-3.1.01/src/DwSocket.h 2011-11-19 17:09:42.375915964 -0600
4
-/* Copyright (c) 2007-2010 Sam Trenholme
5
+/* Copyright (c) 2007-2011 Sam Trenholme
10
/* Function for removing inflight data about a connection */
11
void zap_inflight(dw_str *query);
13
-/* Make this also look like a function; this resets a given remote
16
-#define reset_rem(a) if(rem[a].socket != INVALID_SOCKET) { \
17
- closesocket(rem[a].socket); \
18
- rem[a].socket = INVALID_SOCKET; } \
20
- rem[a].remote_id = 0; \
21
- rem[a].retries = num_retries; \
22
- if(rem[a].ns != 0) { \
23
- dw_destroy(rem[a].ns); \
25
- rem[a].is_upstream = 0; \
26
- if(rem[a].query != 0) { \
27
- zap_inflight(rem[a].query); \
28
- dw_destroy(rem[a].query); \
29
- rem[a].query = 0; } \
30
- rem[a].recurse_depth = 0; \
31
- rem[a].current_ns = -1; \
32
- rem[a].child_id = -1; \
33
- if(rem[a].glueless != 0) { \
34
- dw_destroy(rem[a].glueless); \
35
- rem[a].glueless = 0; } \
36
- if(rem[a].local != 0) { \
38
- for(qq = 0; qq < rem[a].num_locals; qq++) { \
39
- if(rem[a].local[qq] != 0) { \
40
- dw_destroy(rem[a].local[qq]-> \
42
- free(rem[a].local[qq]); \
43
- rem[a].local[qq] = 0; } \
45
- free(rem[a].local); } \
47
- rem[a].num_locals = 0;
49
#define tcp_remote2local(a,b,c) tcp_local2remote(a,b,c)
51
/* Function parameters */
56
+/* Reset the values for a remote connection */
57
+void reset_rem(int_fast32_t a);
59
/* Given a "client" that recvfrom/accept gave us (which has the IP and port
60
* number hidden in it), extract the IP and port from that "client", put the
61
* IP information in from_ip, and return a 16-bit number that has the port
62
--- deadwood-3.1.01/src/DwSocket.c.orig 2011-11-19 16:24:28.886280114 -0600
63
+++ deadwood-3.1.01/src/DwSocket.c 2011-11-19 17:09:53.302958916 -0600
66
#endif /* NO_INET_PTON */
68
+/* Reset the values for a remote connection */
69
+void reset_rem(int_fast32_t a) {
70
+ if(rem[a].socket != INVALID_SOCKET) {
71
+ closesocket(rem[a].socket);
72
+ rem[a].socket = INVALID_SOCKET;
75
+ rem[a].remote_id = 0;
76
+ rem[a].retries = num_retries;
77
+ if(rem[a].ns != 0) {
78
+ dw_destroy(rem[a].ns);
81
+ rem[a].is_upstream = 0;
82
+ if(rem[a].query != 0) {
83
+ zap_inflight(rem[a].query);
84
+ dw_destroy(rem[a].query);
87
+ rem[a].recurse_depth = 0;
88
+ rem[a].current_ns = -1;
89
+ rem[a].child_id = -1;
90
+ if(rem[a].glueless != 0) {
91
+ dw_destroy(rem[a].glueless);
92
+ rem[a].glueless = 0;
94
+ if(rem[a].local != 0) {
96
+ for(qq = 0; qq < rem[a].num_locals; qq++) {
97
+ if(rem[a].local[qq] != 0) {
98
+ dw_destroy(rem[a].local[qq]->orig_query);
99
+ free(rem[a].local[qq]);
100
+ rem[a].local[qq] = 0; }
102
+ free(rem[a].local);
105
+ rem[a].num_locals = 0;
108
/* Configure the dns_do local bind structure. Given an IP we
109
* want to bind to, fill up the dns_udp structure with that IP
110
* and set things up to bind to the dns_port port (normally 53, DNS).