aboutsummaryrefslogtreecommitdiff
path: root/src/util/client.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2014-02-09 21:54:56 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2014-02-09 21:54:56 +0000
commit8a6d5d56ba09ddd8a8848bae490b84ef3ea2923d (patch)
treebf6550e218666d2df51dd02bf185298b2ab4cf03 /src/util/client.c
parent09104d9e153cfce464ef38cda9ccbba4b029ae11 (diff)
downloadgnunet-8a6d5d56ba09ddd8a8848bae490b84ef3ea2923d.tar.gz
gnunet-8a6d5d56ba09ddd8a8848bae490b84ef3ea2923d.zip
Create UNIX domain sockets as abstract sockets when running in LINUX and the
option USE_ABSTRACT_SOCKETS is present in configuration.
Diffstat (limited to 'src/util/client.c')
-rw-r--r--src/util/client.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/util/client.c b/src/util/client.c
index ea3cc45f4..02bec5a8f 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -842,6 +842,7 @@ GNUNET_CLIENT_service_test (const char *service,
842 /* probe UNIX support */ 842 /* probe UNIX support */
843 struct sockaddr_un s_un; 843 struct sockaddr_un s_un;
844 char *unixpath; 844 char *unixpath;
845 int abstract;
845 846
846 unixpath = NULL; 847 unixpath = NULL;
847 if ((GNUNET_OK == 848 if ((GNUNET_OK ==
@@ -862,17 +863,29 @@ GNUNET_CLIENT_service_test (const char *service,
862 _("Using `%s' instead\n"), unixpath); 863 _("Using `%s' instead\n"), unixpath);
863 } 864 }
864 } 865 }
865 if (NULL != unixpath) 866#ifdef LINUX
867 abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg,
868 "TESTING",
869 "USE_ABSTRACT_SOCKETS");
870#else
871 abstract = GNUNET_NO;
872#endif
873 if ((NULL != unixpath) && (GNUNET_YES != abstract))
866 { 874 {
867 if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (unixpath)) 875 if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (unixpath))
868 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, 876 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
869 "mkdir", unixpath); 877 "mkdir", unixpath);
878 }
879 if (NULL != unixpath)
880 {
870 sock = GNUNET_NETWORK_socket_create (PF_UNIX, SOCK_STREAM, 0); 881 sock = GNUNET_NETWORK_socket_create (PF_UNIX, SOCK_STREAM, 0);
871 if (NULL != sock) 882 if (NULL != sock)
872 { 883 {
873 memset (&s_un, 0, sizeof (s_un)); 884 memset (&s_un, 0, sizeof (s_un));
874 s_un.sun_family = AF_UNIX; 885 s_un.sun_family = AF_UNIX;
875 strncpy (s_un.sun_path, unixpath, sizeof (s_un.sun_path) - 1); 886 strncpy (s_un.sun_path, unixpath, sizeof (s_un.sun_path) - 1);
887 if (GNUNET_YES == abstract)
888 s_un.sun_path[0] = '\0';
876#if HAVE_SOCKADDR_IN_SIN_LEN 889#if HAVE_SOCKADDR_IN_SIN_LEN
877 s_un.sun_len = (u_char) sizeof (struct sockaddr_un); 890 s_un.sun_len = (u_char) sizeof (struct sockaddr_un);
878#endif 891#endif