gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19528 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r19528 - gnunet/src/vpn
Date: Mon, 30 Jan 2012 13:26:09 +0100

Author: grothoff
Date: 2012-01-30 13:26:09 +0100 (Mon, 30 Jan 2012)
New Revision: 19528

Modified:
   gnunet/src/vpn/test_gnunet_vpn.c
Log:
-add test for unsupported AFs (#2123)

Modified: gnunet/src/vpn/test_gnunet_vpn.c
===================================================================
--- gnunet/src/vpn/test_gnunet_vpn.c    2012-01-30 12:21:21 UTC (rev 19527)
+++ gnunet/src/vpn/test_gnunet_vpn.c    2012-01-30 12:26:09 UTC (rev 19528)
@@ -458,6 +458,31 @@
 }
 
 
+/**
+ * Test if the given AF is supported by this system.
+ * 
+ * @param af to test
+ * @return GNUNET_OK if the AF is supported
+ */
+static int
+test_af (int af)
+{
+  int s;
+
+  s = socket (af, SOCK_STREAM, 0);
+  if (-1 == s)
+  {
+    if (EAFNOSUPPORT == errno)
+      return GNUNET_NO;
+    fprintf (stderr, "Failed to create test socket: %s\n", STRERROR (errno));
+    return GNUNET_SYSERR;
+  }
+  close (s);
+  return GNUNET_OK;
+}
+
+
+
 int
 main (int argc, char *const *argv)
 {
@@ -535,7 +560,15 @@
     fprintf (stderr, "invalid binary suffix `%s'\n", type);
     return 1;
   }
+  if ( (GNUNET_OK != test_af (src_af)) ||
+       (GNUNET_OK != test_af (dest_af)) )
+  {
+    fprintf (stderr, 
+            "Required address families not supported by this system, skipping 
test.\n");
+    return 0;
+  }
 
+
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
     return 2;
   setup_peer (&p1, "test_gnunet_vpn.conf");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]