unix domain sockets used hardcoded path instead of configuration setting
authorMatthias Wachs <wachs@net.in.tum.de>
Fri, 7 Feb 2014 14:21:26 +0000 (14:21 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Fri, 7 Feb 2014 14:21:26 +0000 (14:21 +0000)
- removing UNIX domain sockets port support and UNIX domain socket NAT support

src/transport/plugin_transport_unix.c
src/transport/transport.conf.in

index 9fc4ba735aede3d2c4a7e212032c41ac9bf5f381..56e1de4263b05c377a56946d5ada619726402b65 100644 (file)
  */
 #define HOSTNAME_RESOLVE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
 
-/**
- * Default "port" to use, if configuration does not specify.
- * Essentially just a number appended to the UNIX path.
- */
-#define UNIX_NAT_DEFAULT_PORT 22086
-
-
 #define LOG(kind,...) GNUNET_log_from (kind, "transport-unix",__VA_ARGS__)
 
 
@@ -316,11 +309,6 @@ struct Plugin
    */
   int with_ws;
 
-  /**
-   * Integer to append to unix domain socket.
-   */
-  uint16_t port;
-
 };
 
 
@@ -1572,7 +1560,6 @@ void *
 libgnunet_plugin_transport_unix_init (void *cls)
 {
   struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  unsigned long long port;
   struct GNUNET_TRANSPORT_PluginFunctions *api;
   struct Plugin *plugin;
   int sockets_created;
@@ -1588,16 +1575,19 @@ libgnunet_plugin_transport_unix_init (void *cls)
     api->string_to_address = &unix_string_to_address;
     return api;
   }
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-unix", "PORT",
-                                             &port))
-    port = UNIX_NAT_DEFAULT_PORT;
+
   plugin = GNUNET_new (struct Plugin);
-  plugin->port = port;
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_filename(env->cfg, "transport-unix", "UNIXPATH",
+                                             &plugin->unix_socket_path))
+  {
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         _("No UNIXPATH given in configuration!\n"));
+    GNUNET_free (plugin);
+    return NULL;
+  }
+
   plugin->env = env;
-  GNUNET_asprintf (&plugin->unix_socket_path,
-                  "/tmp/unix-plugin-sock.%d",
-                   plugin->port);
 
   /* Initialize my flags */
   myoptions = 0;
index 575f4dc20c1e54855d762239ce90626737c84485..00807c701813b7a27f585ac771052e1bc7b7cc82 100644 (file)
@@ -32,7 +32,7 @@ UNIX_MATCH_GID = YES
 
 
 [transport-unix]
-PORT = 22086
+UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-transport-plugin-unix.sock
 TESTING_IGNORE_KEYS = ACCEPT_FROM;
 
 [transport-tcp]