aboutsummaryrefslogtreecommitdiff
path: root/src/pt
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
commit61c39c60565b386e0e12ea669556b030e8cd7180 (patch)
tree59109aeab8297bdc996faca8c4e38ec7426c36cf /src/pt
parent780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff)
downloadgnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz
gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip
-remove trailing whitespace
Diffstat (limited to 'src/pt')
-rw-r--r--src/pt/gnunet-daemon-pt.c76
-rw-r--r--src/pt/test_gns_vpn.c66
-rw-r--r--src/pt/test_gnunet_vpn.c16
3 files changed, 79 insertions, 79 deletions
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index 1d9abf81a..f10274328 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -64,7 +64,7 @@ enum RequestGroup
64 /** 64 /**
65 * DNS answers 65 * DNS answers
66 */ 66 */
67 ANSWERS = 0, 67 ANSWERS = 0,
68 68
69 /** 69 /**
70 * DNS authority records 70 * DNS authority records
@@ -92,7 +92,7 @@ struct ReplyContext
92 * Handle to submit the final result. 92 * Handle to submit the final result.
93 */ 93 */
94 struct GNUNET_DNS_RequestHandle *rh; 94 struct GNUNET_DNS_RequestHandle *rh;
95 95
96 /** 96 /**
97 * DNS packet that is being modified. 97 * DNS packet that is being modified.
98 */ 98 */
@@ -117,7 +117,7 @@ struct ReplyContext
117 * Group that is being modified 117 * Group that is being modified
118 */ 118 */
119 enum RequestGroup group; 119 enum RequestGroup group;
120 120
121}; 121};
122 122
123 123
@@ -144,7 +144,7 @@ struct MeshExit
144 * not initialze a tunnel to this peer yet. 144 * not initialze a tunnel to this peer yet.
145 */ 145 */
146 struct GNUNET_MESH_Tunnel *mesh_tunnel; 146 struct GNUNET_MESH_Tunnel *mesh_tunnel;
147 147
148 /** 148 /**
149 * At what time did the peer's advertisement expire? 149 * At what time did the peer's advertisement expire?
150 */ 150 */
@@ -177,7 +177,7 @@ struct MeshExit
177 177
178 /** 178 /**
179 * Identity of the peer that is providing the exit for us. 179 * Identity of the peer that is providing the exit for us.
180 */ 180 */
181 struct GNUNET_PeerIdentity peer; 181 struct GNUNET_PeerIdentity peer;
182 182
183 /** 183 /**
@@ -218,7 +218,7 @@ struct RequestContext
218 * Handle for interaction with DNS service. 218 * Handle for interaction with DNS service.
219 */ 219 */
220 struct GNUNET_DNS_RequestHandle *rh; 220 struct GNUNET_DNS_RequestHandle *rh;
221 221
222 /** 222 /**
223 * Message we're sending out via MESH, allocated at the 223 * Message we're sending out via MESH, allocated at the
224 * end of this struct. 224 * end of this struct.
@@ -243,7 +243,7 @@ struct RequestContext
243 /** 243 /**
244 * #GNUNET_NO if this request is still in the transmit_queue, 244 * #GNUNET_NO if this request is still in the transmit_queue,
245 * #GNUNET_YES if we are in the receive_queue. 245 * #GNUNET_YES if we are in the receive_queue.
246 */ 246 */
247 int16_t was_transmitted; 247 int16_t was_transmitted;
248 248
249}; 249};
@@ -388,7 +388,7 @@ get_tunnel_weight (struct MeshExit *exit)
388 uint32_t dropped; 388 uint32_t dropped;
389 uint32_t drop_percent; 389 uint32_t drop_percent;
390 uint32_t good_percent; 390 uint32_t good_percent;
391 391
392 GNUNET_assert (exit->num_transmitted >= exit->num_answered); 392 GNUNET_assert (exit->num_transmitted >= exit->num_answered);
393 dropped = exit->num_transmitted - exit->num_answered; 393 dropped = exit->num_transmitted - exit->num_answered;
394 if (exit->num_transmitted > 0) 394 if (exit->num_transmitted > 0)
@@ -408,7 +408,7 @@ get_tunnel_weight (struct MeshExit *exit)
408 408
409/** 409/**
410 * Choose a mesh exit for a DNS request. We try to use a tunnel 410 * Choose a mesh exit for a DNS request. We try to use a tunnel
411 * that is reliable and currently available. All existing 411 * that is reliable and currently available. All existing
412 * tunnels are given a base weight of 1, plus a score relating 412 * tunnels are given a base weight of 1, plus a score relating
413 * to the total number of queries answered in relation to the 413 * to the total number of queries answered in relation to the
414 * total number of queries we sent to that tunnel. That 414 * total number of queries we sent to that tunnel. That
@@ -520,7 +520,7 @@ submit_request (struct ReplyContext *rc);
520 * will match 'result_af' from the request 520 * will match 'result_af' from the request
521 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 521 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
522 * that the VPN allocated for the redirection; 522 * that the VPN allocated for the redirection;
523 * traffic to this IP will now be redirected to the 523 * traffic to this IP will now be redirected to the
524 * specified target peer; NULL on error 524 * specified target peer; NULL on error
525 */ 525 */
526static void 526static void
@@ -633,7 +633,7 @@ submit_request (struct ReplyContext *rc)
633 finish_request (rc); 633 finish_request (rc);
634 return; 634 return;
635 default: 635 default:
636 GNUNET_assert (0); 636 GNUNET_assert (0);
637 } 637 }
638 for (i=rc->offset;i<ra_len;i++) 638 for (i=rc->offset;i<ra_len;i++)
639 { 639 {
@@ -694,7 +694,7 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
694 694
695 695
696/** 696/**
697 * This function is called AFTER we got an IP address for a 697 * This function is called AFTER we got an IP address for a
698 * DNS request. Now, the PT daemon has the chance to substitute 698 * DNS request. Now, the PT daemon has the chance to substitute
699 * the IP address with one from the VPN range to tunnel requests 699 * the IP address with one from the VPN range to tunnel requests
700 * destined for this IP address via VPN and MESH. 700 * destined for this IP address via VPN and MESH.
@@ -704,7 +704,7 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
704 * @param request_length number of bytes in request 704 * @param request_length number of bytes in request
705 * @param request udp payload of the DNS request 705 * @param request udp payload of the DNS request
706 */ 706 */
707static void 707static void
708dns_post_request_handler (void *cls, 708dns_post_request_handler (void *cls,
709 struct GNUNET_DNS_RequestHandle *rh, 709 struct GNUNET_DNS_RequestHandle *rh,
710 size_t request_length, 710 size_t request_length,
@@ -809,7 +809,7 @@ timeout_request (void *cls,
809{ 809{
810 struct RequestContext *rc = cls; 810 struct RequestContext *rc = cls;
811 struct MeshExit *exit = rc->exit; 811 struct MeshExit *exit = rc->exit;
812 812
813 if (rc->was_transmitted) 813 if (rc->was_transmitted)
814 { 814 {
815 exit->num_transmitted++; 815 exit->num_transmitted++;
@@ -844,7 +844,7 @@ timeout_request (void *cls,
844 exit_tail, 844 exit_tail,
845 exit); 845 exit);
846 /* go back to semi-innocent: mark as not great, but 846 /* go back to semi-innocent: mark as not great, but
847 avoid a prohibitively negative score (see 847 avoid a prohibitively negative score (see
848 #get_tunnel_weight, which checks for a certain 848 #get_tunnel_weight, which checks for a certain
849 minimum number of transmissions before making 849 minimum number of transmissions before making
850 up an opinion) */ 850 up an opinion) */
@@ -858,7 +858,7 @@ timeout_request (void *cls,
858 858
859 859
860/** 860/**
861 * This function is called *before* the DNS request has been 861 * This function is called *before* the DNS request has been
862 * given to a "local" DNS resolver. Tunneling for DNS requests 862 * given to a "local" DNS resolver. Tunneling for DNS requests
863 * was enabled, so we now need to send the request via some MESH 863 * was enabled, so we now need to send the request via some MESH
864 * tunnel to a DNS EXIT for resolution. 864 * tunnel to a DNS EXIT for resolution.
@@ -868,7 +868,7 @@ timeout_request (void *cls,
868 * @param request_length number of bytes in request 868 * @param request_length number of bytes in request
869 * @param request udp payload of the DNS request 869 * @param request udp payload of the DNS request
870 */ 870 */
871static void 871static void
872dns_pre_request_handler (void *cls, 872dns_pre_request_handler (void *cls,
873 struct GNUNET_DNS_RequestHandle *rh, 873 struct GNUNET_DNS_RequestHandle *rh,
874 size_t request_length, 874 size_t request_length,
@@ -943,7 +943,7 @@ dns_pre_request_handler (void *cls,
943 * #GNUNET_SYSERR to close it (signal serious error) 943 * #GNUNET_SYSERR to close it (signal serious error)
944 */ 944 */
945static int 945static int
946receive_dns_response (void *cls, 946receive_dns_response (void *cls,
947 struct GNUNET_MESH_Tunnel *tunnel, 947 struct GNUNET_MESH_Tunnel *tunnel,
948 void **tunnel_ctx, 948 void **tunnel_ctx,
949 const struct GNUNET_MessageHeader *message) 949 const struct GNUNET_MessageHeader *message)
@@ -979,7 +979,7 @@ receive_dns_response (void *cls,
979 GNUNET_free (rc); 979 GNUNET_free (rc);
980 exit->num_answered++; 980 exit->num_answered++;
981 exit->num_transmitted++; 981 exit->num_transmitted++;
982 return GNUNET_OK; 982 return GNUNET_OK;
983 } 983 }
984 } 984 }
985 GNUNET_STATISTICS_update (stats, 985 GNUNET_STATISTICS_update (stats,
@@ -993,7 +993,7 @@ receive_dns_response (void *cls,
993 * Abort all pending DNS requests with the given mesh exit. 993 * Abort all pending DNS requests with the given mesh exit.
994 * 994 *
995 * @param exit mesh exit to abort requests for 995 * @param exit mesh exit to abort requests for
996 */ 996 */
997static void 997static void
998abort_all_requests (struct MeshExit *exit) 998abort_all_requests (struct MeshExit *exit)
999{ 999{
@@ -1006,7 +1006,7 @@ abort_all_requests (struct MeshExit *exit)
1006 rc); 1006 rc);
1007 GNUNET_DNS_request_drop (rc->rh); 1007 GNUNET_DNS_request_drop (rc->rh);
1008 GNUNET_SCHEDULER_cancel (rc->timeout_task); 1008 GNUNET_SCHEDULER_cancel (rc->timeout_task);
1009 GNUNET_free (rc); 1009 GNUNET_free (rc);
1010 } 1010 }
1011 while (NULL != (rc = exit->transmit_queue_head)) 1011 while (NULL != (rc = exit->transmit_queue_head))
1012 { 1012 {
@@ -1015,7 +1015,7 @@ abort_all_requests (struct MeshExit *exit)
1015 rc); 1015 rc);
1016 GNUNET_DNS_request_drop (rc->rh); 1016 GNUNET_DNS_request_drop (rc->rh);
1017 GNUNET_SCHEDULER_cancel (rc->timeout_task); 1017 GNUNET_SCHEDULER_cancel (rc->timeout_task);
1018 GNUNET_free (rc); 1018 GNUNET_free (rc);
1019 } 1019 }
1020} 1020}
1021 1021
@@ -1093,7 +1093,7 @@ cleanup (void *cls,
1093/** 1093/**
1094 * Function called whenever a tunnel is destroyed. Should clean up 1094 * Function called whenever a tunnel is destroyed. Should clean up
1095 * the associated state and attempt to build a new one. 1095 * the associated state and attempt to build a new one.
1096 * 1096 *
1097 * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel. 1097 * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel.
1098 * 1098 *
1099 * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect) 1099 * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect)
@@ -1103,12 +1103,12 @@ cleanup (void *cls,
1103 */ 1103 */
1104static void 1104static void
1105mesh_tunnel_end_cb (void *cls, 1105mesh_tunnel_end_cb (void *cls,
1106 const struct GNUNET_MESH_Tunnel *tunnel, 1106 const struct GNUNET_MESH_Tunnel *tunnel,
1107 void *tunnel_ctx) 1107 void *tunnel_ctx)
1108{ 1108{
1109 struct MeshExit *exit = tunnel_ctx; 1109 struct MeshExit *exit = tunnel_ctx;
1110 struct MeshExit *alt; 1110 struct MeshExit *alt;
1111 struct RequestContext *rc; 1111 struct RequestContext *rc;
1112 1112
1113 if (NULL != exit->mesh_th) 1113 if (NULL != exit->mesh_th)
1114 { 1114 {
@@ -1149,7 +1149,7 @@ mesh_tunnel_end_cb (void *cls,
1149 else 1149 else
1150 { 1150 {
1151 /* the same peer was chosen, just make sure the queue processing is restarted */ 1151 /* the same peer was chosen, just make sure the queue processing is restarted */
1152 alt = exit; 1152 alt = exit;
1153 } 1153 }
1154 if ( (NULL == alt->mesh_th) && 1154 if ( (NULL == alt->mesh_th) &&
1155 (NULL != (rc = alt->transmit_queue_head)) ) 1155 (NULL != (rc = alt->transmit_queue_head)) )
@@ -1163,7 +1163,7 @@ mesh_tunnel_end_cb (void *cls,
1163 1163
1164 1164
1165/** 1165/**
1166 * Function called whenever we find an advertisement for a 1166 * Function called whenever we find an advertisement for a
1167 * DNS exit in the DHT. If we don't have a mesh tunnel, 1167 * DNS exit in the DHT. If we don't have a mesh tunnel,
1168 * we should build one; otherwise, we should save the 1168 * we should build one; otherwise, we should save the
1169 * advertisement for later use. 1169 * advertisement for later use.
@@ -1185,7 +1185,7 @@ static void
1185handle_dht_result (void *cls, 1185handle_dht_result (void *cls,
1186 struct GNUNET_TIME_Absolute exp, 1186 struct GNUNET_TIME_Absolute exp,
1187 const struct GNUNET_HashCode *key, 1187 const struct GNUNET_HashCode *key,
1188 const struct GNUNET_PeerIdentity *get_path, 1188 const struct GNUNET_PeerIdentity *get_path,
1189 unsigned int get_path_length, 1189 unsigned int get_path_length,
1190 const struct GNUNET_PeerIdentity *put_path, 1190 const struct GNUNET_PeerIdentity *put_path,
1191 unsigned int put_path_length, 1191 unsigned int put_path_length,
@@ -1201,7 +1201,7 @@ handle_dht_result (void *cls,
1201 return; 1201 return;
1202 } 1202 }
1203 ad = data; 1203 ad = data;
1204 for (exit = exit_head; NULL != exit; exit = exit->next) 1204 for (exit = exit_head; NULL != exit; exit = exit->next)
1205 if (0 == memcmp (&ad->peer, 1205 if (0 == memcmp (&ad->peer,
1206 &exit->peer, 1206 &exit->peer,
1207 sizeof (struct GNUNET_PeerIdentity))) 1207 sizeof (struct GNUNET_PeerIdentity)))
@@ -1240,23 +1240,23 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1240 cfg = cfg_; 1240 cfg = cfg_;
1241 stats = GNUNET_STATISTICS_create ("pt", cfg); 1241 stats = GNUNET_STATISTICS_create ("pt", cfg);
1242 ipv4_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV4"); 1242 ipv4_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV4");
1243 ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6"); 1243 ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6");
1244 dns_tunnel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS"); 1244 dns_tunnel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS");
1245 if (! (ipv4_pt || ipv6_pt || dns_tunnel)) 1245 if (! (ipv4_pt || ipv6_pt || dns_tunnel))
1246 { 1246 {
1247 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1247 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1248 _("No useful service enabled. Exiting.\n")); 1248 _("No useful service enabled. Exiting.\n"));
1249 GNUNET_SCHEDULER_shutdown (); 1249 GNUNET_SCHEDULER_shutdown ();
1250 return; 1250 return;
1251 } 1251 }
1252 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); 1252 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls);
1253 if (ipv4_pt || ipv6_pt) 1253 if (ipv4_pt || ipv6_pt)
1254 { 1254 {
1255 dns_post_handle 1255 dns_post_handle
1256 = GNUNET_DNS_connect (cfg, 1256 = GNUNET_DNS_connect (cfg,
1257 GNUNET_DNS_FLAG_POST_RESOLUTION, 1257 GNUNET_DNS_FLAG_POST_RESOLUTION,
1258 &dns_post_request_handler, NULL); 1258 &dns_post_request_handler, NULL);
1259 if (NULL == dns_post_handle) 1259 if (NULL == dns_post_handle)
1260 { 1260 {
1261 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1261 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1262 _("Failed to connect to %s service. Exiting.\n"), 1262 _("Failed to connect to %s service. Exiting.\n"),
@@ -1281,11 +1281,11 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1281 {NULL, 0, 0} 1281 {NULL, 0, 0}
1282 }; 1282 };
1283 1283
1284 dns_pre_handle 1284 dns_pre_handle
1285 = GNUNET_DNS_connect (cfg, 1285 = GNUNET_DNS_connect (cfg,
1286 GNUNET_DNS_FLAG_PRE_RESOLUTION, 1286 GNUNET_DNS_FLAG_PRE_RESOLUTION,
1287 &dns_pre_request_handler, NULL); 1287 &dns_pre_request_handler, NULL);
1288 if (NULL == dns_pre_handle) 1288 if (NULL == dns_pre_handle)
1289 { 1289 {
1290 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1290 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1291 _("Failed to connect to %s service. Exiting.\n"), 1291 _("Failed to connect to %s service. Exiting.\n"),
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index adf8b7d85..a0b2d926f 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -217,9 +217,9 @@ curl_main ()
217 } 217 }
218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n"); 218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download complete, shutting down!\n");
219 do_shutdown (); 219 do_shutdown ();
220 return; 220 return;
221 } 221 }
222 GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max)); 222 GNUNET_assert (CURLM_OK == curl_multi_fdset (multi, &rs, &ws, &es, &max));
223 if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) || 223 if ( (CURLM_OK != curl_multi_timeout (multi, &timeout)) ||
224 (-1 == timeout) ) 224 (-1 == timeout) )
225 delay = GNUNET_TIME_UNIT_SECONDS; 225 delay = GNUNET_TIME_UNIT_SECONDS;
@@ -236,14 +236,14 @@ curl_main ()
236 &nrs, 236 &nrs,
237 &nws, 237 &nws,
238 &curl_task, 238 &curl_task,
239 NULL); 239 NULL);
240} 240}
241 241
242 242
243static void 243static void
244start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 244start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
245{ 245{
246 GNUNET_asprintf (&url, 246 GNUNET_asprintf (&url,
247 "http://%s/hello_world", 247 "http://%s/hello_world",
248 TEST_DOMAIN); 248 TEST_DOMAIN);
249 curl = curl_easy_init (); 249 curl = curl_easy_init ();
@@ -280,7 +280,7 @@ disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
280 * will match 'result_af' from the request 280 * will match 'result_af' from the request
281 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 281 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
282 * that the VPN allocated for the redirection; 282 * that the VPN allocated for the redirection;
283 * traffic to this IP will now be redirected to the 283 * traffic to this IP will now be redirected to the
284 * specified target peer; NULL on error 284 * specified target peer; NULL on error
285 */ 285 */
286static void 286static void
@@ -290,11 +290,11 @@ commence_testing (void *cls, int32_t success, const char *emsg)
290 290
291 if ((emsg != NULL) && (GNUNET_YES != success)) 291 if ((emsg != NULL) && (GNUNET_YES != success))
292 { 292 {
293 fprintf (stderr, 293 fprintf (stderr,
294 "NS failed to create record %s\n", emsg); 294 "NS failed to create record %s\n", emsg);
295 GNUNET_SCHEDULER_shutdown (); 295 GNUNET_SCHEDULER_shutdown ();
296 return; 296 return;
297 } 297 }
298 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &start_curl, NULL); 298 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), &start_curl, NULL);
299} 299}
300 300
@@ -302,7 +302,7 @@ commence_testing (void *cls, int32_t success, const char *emsg)
302/** 302/**
303 * Function to keep the HTTP server running. 303 * Function to keep the HTTP server running.
304 */ 304 */
305static void 305static void
306mhd_main (void); 306mhd_main (void);
307 307
308 308
@@ -316,7 +316,7 @@ mhd_task (void *cls,
316} 316}
317 317
318 318
319static void 319static void
320mhd_main () 320mhd_main ()
321{ 321{
322 struct GNUNET_NETWORK_FDSet nrs; 322 struct GNUNET_NETWORK_FDSet nrs;
@@ -351,7 +351,7 @@ mhd_main ()
351 &nrs, 351 &nrs,
352 &nws, 352 &nws,
353 &mhd_task, 353 &mhd_task,
354 NULL); 354 NULL);
355} 355}
356 356
357 357
@@ -367,7 +367,7 @@ run (void *cls,
367 struct GNUNET_NAMESTORE_RecordData rd; 367 struct GNUNET_NAMESTORE_RecordData rd;
368 char *rd_string; 368 char *rd_string;
369 char *zone_keyfile; 369 char *zone_keyfile;
370 370
371 GNUNET_TESTING_peer_get_identity (peer, &id); 371 GNUNET_TESTING_peer_get_identity (peer, &id);
372 GNUNET_CRYPTO_hash_to_enc ((struct GNUNET_HashCode*)&id, &peername); 372 GNUNET_CRYPTO_hash_to_enc ((struct GNUNET_HashCode*)&id, &peername);
373 373
@@ -383,7 +383,7 @@ run (void *cls,
383 MHD_OPTION_END); 383 MHD_OPTION_END);
384 GNUNET_assert (NULL != mhd); 384 GNUNET_assert (NULL != mhd);
385 mhd_main (); 385 mhd_main ();
386 386
387 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", 387 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
388 "ZONEKEY", 388 "ZONEKEY",
389 &zone_keyfile)) 389 &zone_keyfile))
@@ -433,7 +433,7 @@ open_dev_null (int target_fd,
433 if (fd == target_fd) 433 if (fd == target_fd)
434 return; 434 return;
435 if (-1 == dup2 (fd, target_fd)) 435 if (-1 == dup2 (fd, target_fd))
436 { 436 {
437 (void) close (fd); 437 (void) close (fd);
438 abort (); 438 abort ();
439 } 439 }
@@ -443,13 +443,13 @@ open_dev_null (int target_fd,
443 443
444/** 444/**
445 * Run the given command and wait for it to complete. 445 * Run the given command and wait for it to complete.
446 * 446 *
447 * @param file name of the binary to run 447 * @param file name of the binary to run
448 * @param cmd command line arguments (as given to 'execv') 448 * @param cmd command line arguments (as given to 'execv')
449 * @return 0 on success, 1 on any error 449 * @return 0 on success, 1 on any error
450 */ 450 */
451static int 451static int
452fork_and_exec (const char *file, 452fork_and_exec (const char *file,
453 char *const cmd[]) 453 char *const cmd[])
454{ 454{
455 int status; 455 int status;
@@ -459,8 +459,8 @@ fork_and_exec (const char *file,
459 pid = fork (); 459 pid = fork ();
460 if (-1 == pid) 460 if (-1 == pid)
461 { 461 {
462 fprintf (stderr, 462 fprintf (stderr,
463 "fork failed: %s\n", 463 "fork failed: %s\n",
464 strerror (errno)); 464 strerror (errno));
465 return 1; 465 return 1;
466 } 466 }
@@ -469,25 +469,25 @@ fork_and_exec (const char *file,
469 /* we are the child process */ 469 /* we are the child process */
470 /* close stdin/stdout to not cause interference 470 /* close stdin/stdout to not cause interference
471 with the helper's main protocol! */ 471 with the helper's main protocol! */
472 (void) close (0); 472 (void) close (0);
473 open_dev_null (0, O_RDONLY); 473 open_dev_null (0, O_RDONLY);
474 (void) close (1); 474 (void) close (1);
475 open_dev_null (1, O_WRONLY); 475 open_dev_null (1, O_WRONLY);
476 (void) execv (file, cmd); 476 (void) execv (file, cmd);
477 /* can only get here on error */ 477 /* can only get here on error */
478 fprintf (stderr, 478 fprintf (stderr,
479 "exec `%s' failed: %s\n", 479 "exec `%s' failed: %s\n",
480 file, 480 file,
481 strerror (errno)); 481 strerror (errno));
482 _exit (1); 482 _exit (1);
483 } 483 }
484 /* keep running waitpid as long as the only error we get is 'EINTR' */ 484 /* keep running waitpid as long as the only error we get is 'EINTR' */
485 while ( (-1 == (ret = waitpid (pid, &status, 0))) && 485 while ( (-1 == (ret = waitpid (pid, &status, 0))) &&
486 (errno == EINTR) ); 486 (errno == EINTR) );
487 if (-1 == ret) 487 if (-1 == ret)
488 { 488 {
489 fprintf (stderr, 489 fprintf (stderr,
490 "waitpid failed: %s\n", 490 "waitpid failed: %s\n",
491 strerror (errno)); 491 strerror (errno));
492 return 1; 492 return 1;
493 } 493 }
@@ -508,19 +508,19 @@ main (int argc, char *const *argv)
508 { 508 {
509 "iptables", "-t", "mangle", "-L", "-v", NULL 509 "iptables", "-t", "mangle", "-L", "-v", NULL
510 }; 510 };
511 511
512 if (0 == access ("/sbin/iptables", X_OK)) 512 if (0 == access ("/sbin/iptables", X_OK))
513 sbin_iptables = "/sbin/iptables"; 513 sbin_iptables = "/sbin/iptables";
514 else if (0 == access ("/usr/sbin/iptables", X_OK)) 514 else if (0 == access ("/usr/sbin/iptables", X_OK))
515 sbin_iptables = "/usr/sbin/iptables"; 515 sbin_iptables = "/usr/sbin/iptables";
516 else 516 else
517 { 517 {
518 fprintf (stderr, 518 fprintf (stderr,
519 "Executable iptables not found in approved directories: %s, skipping\n", 519 "Executable iptables not found in approved directories: %s, skipping\n",
520 strerror (errno)); 520 strerror (errno));
521 return 0; 521 return 0;
522 } 522 }
523 523
524 if (0 != fork_and_exec (sbin_iptables, iptables_args)) 524 if (0 != fork_and_exec (sbin_iptables, iptables_args))
525 { 525 {
526 fprintf (stderr, 526 fprintf (stderr,
@@ -548,20 +548,20 @@ main (int argc, char *const *argv)
548 GNUNET_OS_check_helper_binary (bin_exit, GNUNET_YES, "-d gnunet-vpn - - - 169.1.3.3.7 255.255.255.0")) || //no nat, ipv4 only 548 GNUNET_OS_check_helper_binary (bin_exit, GNUNET_YES, "-d gnunet-vpn - - - 169.1.3.3.7 255.255.255.0")) || //no nat, ipv4 only
549 (GNUNET_YES != 549 (GNUNET_YES !=
550 GNUNET_OS_check_helper_binary (bin_dns, GNUNET_YES, NULL))) ) // TODO: once we have a windows-testcase, add test parameters here 550 GNUNET_OS_check_helper_binary (bin_dns, GNUNET_YES, NULL))) ) // TODO: once we have a windows-testcase, add test parameters here
551 { 551 {
552 fprintf (stderr, 552 fprintf (stderr,
553 "WARNING: gnunet-helper-{exit,vpn,dns} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n"); 553 "WARNING: gnunet-helper-{exit,vpn,dns} binaries in $PATH are not SUID, refusing to run test (as it would have to fail).\n");
554 fprintf (stderr, 554 fprintf (stderr,
555 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n"); 555 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n");
556 GNUNET_free (bin_vpn); 556 GNUNET_free (bin_vpn);
557 GNUNET_free (bin_exit); 557 GNUNET_free (bin_exit);
558 GNUNET_free (bin_dns); 558 GNUNET_free (bin_dns);
559 return 0; 559 return 0;
560 } 560 }
561 GNUNET_free (bin_vpn); 561 GNUNET_free (bin_vpn);
562 GNUNET_free (bin_exit); 562 GNUNET_free (bin_exit);
563 GNUNET_free (bin_dns); 563 GNUNET_free (bin_dns);
564 564
565 dest_ip = "169.254.86.1"; 565 dest_ip = "169.254.86.1";
566 dest_af = AF_INET; 566 dest_af = AF_INET;
567 src_af = AF_INET; 567 src_af = AF_INET;
@@ -570,11 +570,11 @@ main (int argc, char *const *argv)
570 use_v6 = GNUNET_YES; 570 use_v6 = GNUNET_YES;
571 else 571 else
572 use_v6 = GNUNET_NO; 572 use_v6 = GNUNET_NO;
573 573
574 if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) || 574 if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
575 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) ) 575 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) )
576 { 576 {
577 fprintf (stderr, 577 fprintf (stderr,
578 "Required address families not supported by this system, skipping test.\n"); 578 "Required address families not supported by this system, skipping test.\n");
579 return 0; 579 return 0;
580 } 580 }
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c
index 975cb7ee0..7e83fdcd1 100644
--- a/src/pt/test_gnunet_vpn.c
+++ b/src/pt/test_gnunet_vpn.c
@@ -357,7 +357,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
357 struct in6_addr v6; 357 struct in6_addr v6;
358 void *addr; 358 void *addr;
359 enum MHD_FLAG flags; 359 enum MHD_FLAG flags;
360 360
361 vpn = GNUNET_VPN_connect (cfg); 361 vpn = GNUNET_VPN_connect (cfg);
362 GNUNET_assert (NULL != vpn); 362 GNUNET_assert (NULL != vpn);
363 flags = MHD_USE_DEBUG; 363 flags = MHD_USE_DEBUG;
@@ -366,8 +366,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
366 mhd = 366 mhd =
367 MHD_start_daemon (flags, PORT, NULL, NULL, &mhd_ahc, NULL, 367 MHD_start_daemon (flags, PORT, NULL, NULL, &mhd_ahc, NULL,
368 MHD_OPTION_END); 368 MHD_OPTION_END);
369 369
370 370
371 GNUNET_assert (NULL != mhd); 371 GNUNET_assert (NULL != mhd);
372 mhd_main (); 372 mhd_main ();
373 addr = NULL; 373 addr = NULL;
@@ -384,7 +384,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
384 default: 384 default:
385 GNUNET_assert (0); 385 GNUNET_assert (0);
386 } 386 }
387 rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr, 387 rr = GNUNET_VPN_redirect_to_ip (vpn, src_af, dest_af, addr,
388 GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb, 388 GNUNET_TIME_UNIT_FOREVER_ABS, &allocation_cb,
389 NULL); 389 NULL);
390 ctrl_c_task_id = 390 ctrl_c_task_id =
@@ -436,7 +436,7 @@ main (int argc, char *const *argv)
436 return 1; 436 return 1;
437 } 437 }
438 type++; 438 type++;
439 /* on Windows, .exe is suffixed to these binaries, 439 /* on Windows, .exe is suffixed to these binaries,
440 * thus cease comparison after the 6th char. 440 * thus cease comparison after the 6th char.
441 */ 441 */
442 if (0 == strncmp (type, "4_to_6",6)) 442 if (0 == strncmp (type, "4_to_6",6))
@@ -468,7 +468,7 @@ main (int argc, char *const *argv)
468 fprintf (stderr, "invalid binary suffix `%s'\n", type); 468 fprintf (stderr, "invalid binary suffix `%s'\n", type);
469 return 1; 469 return 1;
470 } 470 }
471 if ((GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) || 471 if ((GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
472 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af))) 472 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)))
473 { 473 {
474 fprintf (stderr, 474 fprintf (stderr,
@@ -483,8 +483,8 @@ main (int argc, char *const *argv)
483 if (0 != 483 if (0 !=
484 GNUNET_TESTING_peer_run ("test-gnunet-vpn", "test_gnunet_vpn.conf", &run, 484 GNUNET_TESTING_peer_run ("test-gnunet-vpn", "test_gnunet_vpn.conf", &run,
485 NULL)) 485 NULL))
486 return 1; 486 return 1;
487 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn"); 487 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn");
488 return global_ret; 488 return global_ret;
489} 489}
490 490