aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2011-10-05 08:58:50 +0000
committerPhilipp Tölke <toelke@in.tum.de>2011-10-05 08:58:50 +0000
commit2478a8f68e5958994c2678484cd31843c05d4efd (patch)
tree3cd4269f9152484a566b2e521bd63d980f3be84e /src/vpn
parentf5c36840ecd770e195cc87a1bca8fa3e54c2dd40 (diff)
downloadgnunet-2478a8f68e5958994c2678484cd31843c05d4efd.tar.gz
gnunet-2478a8f68e5958994c2678484cd31843c05d4efd.zip
bug
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-daemon-vpn-dns.c18
-rw-r--r--src/vpn/gnunet-daemon-vpn-helper.c14
2 files changed, 20 insertions, 12 deletions
diff --git a/src/vpn/gnunet-daemon-vpn-dns.c b/src/vpn/gnunet-daemon-vpn-dns.c
index 9ee81011e..7f762238c 100644
--- a/src/vpn/gnunet-daemon-vpn-dns.c
+++ b/src/vpn/gnunet-daemon-vpn-dns.c
@@ -46,6 +46,8 @@ unsigned char restart_hijack;
46struct answer_packet_list *answer_proc_head; 46struct answer_packet_list *answer_proc_head;
47struct answer_packet_list *answer_proc_tail; 47struct answer_packet_list *answer_proc_tail;
48 48
49struct GNUNET_CLIENT_TransmitHandle *dns_transmit_handle;
50
49/** 51/**
50 * Callback called by notify_transmit_ready; sends dns-queries or rehijack-messages 52 * Callback called by notify_transmit_ready; sends dns-queries or rehijack-messages
51 * to the service-dns 53 * to the service-dns
@@ -55,6 +57,7 @@ size_t
55send_query (void *cls __attribute__ ((unused)), size_t size, void *buf) 57send_query (void *cls __attribute__ ((unused)), size_t size, void *buf)
56{ 58{
57 size_t len; 59 size_t len;
60 dns_transmit_handle = NULL;
58 61
59 /* 62 /*
60 * Send the rehijack-message 63 * Send the rehijack-message
@@ -97,14 +100,14 @@ send_query (void *cls __attribute__ ((unused)), size_t size, void *buf)
97 */ 100 */
98 if (head != NULL) 101 if (head != NULL)
99 { 102 {
100 GNUNET_CLIENT_notify_transmit_ready (dns_connection, 103 dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
101 ntohs (head->pkt.hdr.size), 104 ntohs (head->pkt.hdr.size),
102 GNUNET_TIME_UNIT_FOREVER_REL, 105 GNUNET_TIME_UNIT_FOREVER_REL,
103 GNUNET_YES, &send_query, NULL); 106 GNUNET_YES, &send_query, NULL);
104 } 107 }
105 else if (restart_hijack == 1) 108 else if (restart_hijack == 1)
106 { 109 {
107 GNUNET_CLIENT_notify_transmit_ready (dns_connection, 110 dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
108 sizeof (struct GNUNET_MessageHeader), 111 sizeof (struct GNUNET_MessageHeader),
109 GNUNET_TIME_UNIT_FOREVER_REL, 112 GNUNET_TIME_UNIT_FOREVER_REL,
110 GNUNET_YES, &send_query, NULL); 113 GNUNET_YES, &send_query, NULL);
@@ -140,14 +143,14 @@ connect_to_service_dns (void *cls
140 return; 143 return;
141 144
142 /* If a packet is already in the list, schedule to send it */ 145 /* If a packet is already in the list, schedule to send it */
143 if (head != NULL) 146 if (dns_transmit_handle == NULL && head != NULL)
144 GNUNET_CLIENT_notify_transmit_ready (dns_connection, 147 dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
145 ntohs (head->pkt.hdr.size), 148 ntohs (head->pkt.hdr.size),
146 GNUNET_TIME_UNIT_FOREVER_REL, 149 GNUNET_TIME_UNIT_FOREVER_REL,
147 GNUNET_YES, &send_query, NULL); 150 GNUNET_YES, &send_query, NULL);
148 else if (restart_hijack == 1) 151 else if (dns_transmit_handle == NULL && restart_hijack == 1)
149 { 152 {
150 GNUNET_CLIENT_notify_transmit_ready (dns_connection, 153 dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
151 sizeof (struct GNUNET_MessageHeader), 154 sizeof (struct GNUNET_MessageHeader),
152 GNUNET_TIME_UNIT_FOREVER_REL, 155 GNUNET_TIME_UNIT_FOREVER_REL,
153 GNUNET_YES, &send_query, NULL); 156 GNUNET_YES, &send_query, NULL);
@@ -166,6 +169,9 @@ dns_answer_handler (void *cls
166 /* the service disconnected, reconnect after short wait */ 169 /* the service disconnected, reconnect after short wait */
167 if (msg == NULL) 170 if (msg == NULL)
168 { 171 {
172 if (dns_transmit_handle != NULL)
173 GNUNET_CLIENT_notify_transmit_ready_cancel(dns_transmit_handle);
174 dns_transmit_handle = NULL;
169 GNUNET_CLIENT_disconnect (dns_connection, GNUNET_NO); 175 GNUNET_CLIENT_disconnect (dns_connection, GNUNET_NO);
170 dns_connection = NULL; 176 dns_connection = NULL;
171 conn_task = 177 conn_task =
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c
index eed073e07..d91b00416 100644
--- a/src/vpn/gnunet-daemon-vpn-helper.c
+++ b/src/vpn/gnunet-daemon-vpn-helper.c
@@ -45,6 +45,8 @@
45 45
46struct GNUNET_VPN_HELPER_Handle *helper_handle; 46struct GNUNET_VPN_HELPER_Handle *helper_handle;
47 47
48extern struct GNUNET_CLIENT_TransmitHandle* dns_transmit_handle;
49
48/** 50/**
49 * The tunnels that will be used to send tcp- and udp-packets 51 * The tunnels that will be used to send tcp- and udp-packets
50 */ 52 */
@@ -137,8 +139,8 @@ start_helper_and_schedule (void *cls,
137 * The routing-table gets flushed if an interface disappears. 139 * The routing-table gets flushed if an interface disappears.
138 */ 140 */
139 restart_hijack = 1; 141 restart_hijack = 1;
140 if (NULL != dns_connection) 142 if (NULL != dns_connection && dns_transmit_handle == NULL)
141 GNUNET_CLIENT_notify_transmit_ready (dns_connection, 143 dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection,
142 sizeof (struct GNUNET_MessageHeader), 144 sizeof (struct GNUNET_MessageHeader),
143 GNUNET_TIME_UNIT_FOREVER_REL, 145 GNUNET_TIME_UNIT_FOREVER_REL,
144 GNUNET_YES, &send_query, NULL); 146 GNUNET_YES, &send_query, NULL);
@@ -445,10 +447,10 @@ message_token (void *cls __attribute__ ((unused)), void *client
445 447
446 GNUNET_assert (head != NULL); 448 GNUNET_assert (head != NULL);
447 449
448 if (dns_connection != NULL) 450 if (dns_connection != NULL && dns_transmit_handle == NULL)
449 GNUNET_CLIENT_notify_transmit_ready (dns_connection, len, 451 dns_transmit_handle = GNUNET_CLIENT_notify_transmit_ready (dns_connection, len,
450 GNUNET_TIME_UNIT_FOREVER_REL, 452 GNUNET_TIME_UNIT_FOREVER_REL,
451 GNUNET_YES, &send_query, NULL); 453 GNUNET_YES, &send_query, NULL);
452 } 454 }
453 else 455 else
454 { 456 {