aboutsummaryrefslogtreecommitdiff
path: root/src/pt
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-10-26 22:13:01 +0000
committerChristian Grothoff <christian@grothoff.org>2012-10-26 22:13:01 +0000
commit64d3e46cfb99a711e500fa1f114e7c44bdf10040 (patch)
tree83093d92761d5c1b8b2fded713adaa19af29274c /src/pt
parentef6f05f63769263a5201636c4b7f71eaa455cdf3 (diff)
downloadgnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.tar.gz
gnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.zip
-bugfixes, code cleanup
Diffstat (limited to 'src/pt')
-rw-r--r--src/pt/test_gns_vpn.c30
-rw-r--r--src/pt/test_gnunet_vpn.c27
2 files changed, 5 insertions, 52 deletions
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index 7d2cd7ba4..32283bad4 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -415,30 +415,6 @@ run (void *cls,
415 415
416 416
417/** 417/**
418 * Test if the given AF is supported by this system.
419 *
420 * @param af to test
421 * @return GNUNET_OK if the AF is supported
422 */
423static int
424test_af (int af)
425{
426 int s;
427
428 s = socket (af, SOCK_STREAM, 0);
429 if (-1 == s)
430 {
431 if (EAFNOSUPPORT == errno)
432 return GNUNET_NO;
433 fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno));
434 return GNUNET_SYSERR;
435 }
436 close (s);
437 return GNUNET_OK;
438}
439
440
441/**
442 * Open '/dev/null' and make the result the given 418 * Open '/dev/null' and make the result the given
443 * file descriptor. 419 * file descriptor.
444 * 420 *
@@ -579,13 +555,13 @@ main (int argc, char *const *argv)
579 dest_af = AF_INET; 555 dest_af = AF_INET;
580 src_af = AF_INET; 556 src_af = AF_INET;
581 557
582 if (GNUNET_OK == test_af (AF_INET6)) 558 if (GNUNET_OK == GNUNET_NETWORK_test_pf (PF_INET6))
583 use_v6 = GNUNET_YES; 559 use_v6 = GNUNET_YES;
584 else 560 else
585 use_v6 = GNUNET_NO; 561 use_v6 = GNUNET_NO;
586 562
587 if ( (GNUNET_OK != test_af (src_af)) || 563 if ( (GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
588 (GNUNET_OK != test_af (dest_af)) ) 564 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)) )
589 { 565 {
590 fprintf (stderr, 566 fprintf (stderr,
591 "Required address families not supported by this system, skipping test.\n"); 567 "Required address families not supported by this system, skipping test.\n");
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c
index 72551e353..8b9bb2b20 100644
--- a/src/pt/test_gnunet_vpn.c
+++ b/src/pt/test_gnunet_vpn.c
@@ -390,30 +390,6 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
390} 390}
391 391
392 392
393/**
394 * Test if the given AF is supported by this system.
395 *
396 * @param af to test
397 * @return GNUNET_OK if the AF is supported
398 */
399static int
400test_af (int af)
401{
402 int s;
403
404 s = socket (af, SOCK_STREAM, 0);
405 if (-1 == s)
406 {
407 if (EAFNOSUPPORT == errno)
408 return GNUNET_NO;
409 fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno));
410 return GNUNET_SYSERR;
411 }
412 close (s);
413 return GNUNET_OK;
414}
415
416
417int 393int
418main (int argc, char *const *argv) 394main (int argc, char *const *argv)
419{ 395{
@@ -476,7 +452,8 @@ main (int argc, char *const *argv)
476 fprintf (stderr, "invalid binary suffix `%s'\n", type); 452 fprintf (stderr, "invalid binary suffix `%s'\n", type);
477 return 1; 453 return 1;
478 } 454 }
479 if ((GNUNET_OK != test_af (src_af)) || (GNUNET_OK != test_af (dest_af))) 455 if ((GNUNET_OK != GNUNET_NETWORK_test_pf (src_af)) ||
456 (GNUNET_OK != GNUNET_NETWORK_test_pf (dest_af)))
480 { 457 {
481 fprintf (stderr, 458 fprintf (stderr,
482 "Required address families not supported by this system, skipping test.\n"); 459 "Required address families not supported by this system, skipping test.\n");