- finale commit for the api change
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 29 Nov 2011 18:04:01 +0000 (18:04 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 29 Nov 2011 18:04:01 +0000 (18:04 +0000)
src/core/gnunet-core-list-connections.c
src/include/gnunet_transport_service.h
src/transport/gnunet-service-transport_clients.c
src/transport/gnunet-service-transport_neighbours.c
src/transport/gnunet-service-transport_neighbours.h
src/transport/gnunet-transport.c
src/transport/transport.conf
src/transport/transport_api_address_lookup.c
src/transport/transport_api_address_to_string.c

index 8f00c0a185b4784f11e26db97f98f6b51e44ff25..71c7d40d5a606659dffac246206f6ce99af77d82 100644 (file)
@@ -100,7 +100,7 @@ static void
 process_resolved_address (void *cls, const struct GNUNET_HELLO_Address *address)
 {
   struct PrintContext *pc = cls;
-  struct AddressStringList *new_address;
+//  struct AddressStringList *new_address;
 
   if (address == NULL)
   {
@@ -108,14 +108,17 @@ process_resolved_address (void *cls, const struct GNUNET_HELLO_Address *address)
     return;
   }
 
+  /* This does exactly the same as gnunet-transport -i !*/
+  /*
   new_address = GNUNET_malloc (sizeof (struct AddressStringList));
 #if VERBOSE
   fprintf (stderr, "Received address %s\n", address);
 #endif
-  // FIXME : GNUNET_TRANSPORT_address_to_string
+
   new_address->address_string = GNUNET_strdup ("FIXME");
   GNUNET_CONTAINER_DLL_insert (pc->address_list_head, pc->address_list_tail,
                                new_address);
+   */
 }
 
 
index 98436065bf0565f4ae71c9db714cb05b0135d6c1..830a061f4a63d3264120ec4f19d9da59c3db314b 100644 (file)
@@ -115,7 +115,7 @@ typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls,
  * @param address address
  */
 // FIXME: use NULL for address on disconnect IF in monitor mode (one_shot = NO)
-typedef void (*GNUNET_TRANSPORT_AddressLookUpCallback) (void *cls,
+typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) (void *cls,
                                                         const struct GNUNET_HELLO_Address *address);
 
 
@@ -322,12 +322,12 @@ GNUNET_TRANSPORT_address_to_string_cancel (struct
  * @param peer_address_callback function to call with the results
  * @param peer_address_callback_cls closure for peer_address_callback
  */
-struct GNUNET_TRANSPORT_PeerAddressLookupContext *
+struct GNUNET_TRANSPORT_PeerIterateContext *
 GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                       const struct GNUNET_PeerIdentity *peer,
                                      int one_shot,
                                       struct GNUNET_TIME_Relative timeout,
-                                      GNUNET_TRANSPORT_AddressLookUpCallback peer_address_callback,
+                                      GNUNET_TRANSPORT_PeerIterateCallback peer_address_callback,
                                       void *peer_address_callback_cls);
 
 
@@ -338,16 +338,12 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Ha
  */
 void
 GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
-                                             GNUNET_TRANSPORT_PeerAddressLookupContext
+                                             GNUNET_TRANSPORT_PeerIterateContext
 *alc);
 
 
 /**
- * Return all the known addresses. FIXME: document better!
- * 
- * FIXME: remove, replace with new 'peer_address_lookup' API
- * 
- *
+ * Return all the known addresses.
  * @param cfg configuration to use
  * @param timeout how long is the lookup allowed to take at most
  * @param peer_address_callback function to call with the results
@@ -356,7 +352,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
 void
 GNUNET_TRANSPORT_address_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                   struct GNUNET_TIME_Relative timeout,
-                                  GNUNET_TRANSPORT_AddressLookUpCallback
+                                  GNUNET_TRANSPORT_PeerIterateCallback
                                   peer_address_callback,
                                   void *peer_address_callback_cls);
 
index 7c50218e097de5c5f01660fc5b9e8cd76e6b694c..d787c7aabd5dceb298d8c2adf369165d25f9fa80 100644 (file)
@@ -612,7 +612,6 @@ static void
 transmit_address_to_client (void *cls, const char *buf)
 {
   struct GNUNET_SERVER_TransmitContext *tc = cls;
-
   if (NULL == buf)
   {
     GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
@@ -712,6 +711,9 @@ clients_handle_address_to_string (void *cls, struct GNUNET_SERVER_Client *client
                                 tc);
 }
 
+#if 0
+
+THIS FUNCTIONALITY IS NOT USED ANYWHERE!
 
 /**
  * Send an address to the client.
@@ -749,16 +751,15 @@ send_address_to_client (void *cls,
 
 
 /**
- * Client asked to obtain information about a peer's addresses.
+ * Client asked to obtain information about all addresses of a peer.
  * Process the request.
- * FIXME: use better name!
  *
  * @param cls unused
  * @param client the client
  * @param message the peer address information request
  */
 static void
-clients_handle_peer_address_lookup (void *cls,
+clients_handle_peer_address_iterate (void *cls,
                                     struct GNUNET_SERVER_Client *client,
                                     const struct GNUNET_MessageHeader *message)
 {
@@ -768,13 +769,15 @@ clients_handle_peer_address_lookup (void *cls,
   peer_address_lookup = (const struct PeerAddressLookupMessage *) message;
   GNUNET_break (ntohl (peer_address_lookup->reserved) == 0);
   tc = GNUNET_SERVER_transmit_context_create (client);
+
   GST_validation_get_addresses (&peer_address_lookup->peer,
                                 &send_address_to_client, tc);
+
   GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
       GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
   GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
 }
-
+#endif
 
 /**
  * Output the active address of connected neighbours to the given client.
@@ -811,15 +814,14 @@ output_addresses (void *cls, const struct GNUNET_PeerIdentity *peer,
   memcpy(&addr[alen], address->transport_name, tlen);
 
   transmit_binary_to_client (tc, msg, size);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "output_addresses: peer `%s' transport %s address %s   %s\n",GNUNET_i2s(&msg->peer), &addr[alen], GNUNET_a2s((struct sockaddr *) addr, alen), GNUNET_a2s((struct sockaddr *) address->address, address->address_length));
   GNUNET_free (msg);
 }
 
 
 /**
- * Client asked to obtain information about all actively used addresses.
- * Process the request.  FIXME: use better name!
+ * Client asked to obtain information about all actively used addresses
+ * of connected peers
+ * Process the request.
  *
  * @param cls unused
  * @param client the client
@@ -830,11 +832,41 @@ clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client,
                                 const struct GNUNET_MessageHeader *message)
 {
   struct GNUNET_SERVER_TransmitContext *tc;
+  struct AddressIterateMessage * msg;
+  struct GNUNET_PeerIdentity dummy;
+  struct GNUNET_HELLO_Address * address;
+
 
   GNUNET_SERVER_disable_receive_done_warning (client);
   tc = GNUNET_SERVER_transmit_context_create (client);
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "clients_handle_address_iterate: \n");
-  GST_neighbours_iterate (&output_addresses, tc);
+
+  if (ntohs (message->type) != GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE)
+  {
+    GNUNET_break_op(0);
+    return;
+  }
+  if (ntohs (message->size) != sizeof (struct AddressIterateMessage))
+  {
+    GNUNET_break_op(0);
+    return;
+  }
+
+  msg = (struct AddressIterateMessage *) message;
+  memset (&dummy, 0,  sizeof (struct GNUNET_PeerIdentity));
+
+  if (0 == memcmp (&msg->peer, &dummy, sizeof (struct GNUNET_PeerIdentity)))
+  {
+    /* iterate over all neighbours */
+    GST_neighbours_iterate (&output_addresses, tc);
+  }
+  else
+  {
+    /* just return one neighbour */
+    address = GST_neighbour_get_current_address(&msg->peer);
+    if (address != NULL)
+      output_addresses(tc, &msg->peer, NULL, 0, address);
+  }
+
   GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
       GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
   GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
@@ -859,12 +891,16 @@ GST_clients_start (struct GNUNET_SERVER_Handle *server)
     {&clients_handle_request_connect, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT,
      sizeof (struct TransportRequestConnectMessage)},
+    /* converts a binary address to a human readable address */
     {&clients_handle_address_to_string, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 0},
-    {&clients_handle_peer_address_lookup, NULL,
+#if 0
+    /* Not used at the moment, gets all addresses of a peer */
+    {&clients_handle_peer_address_iterate, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_PEER_ADDRESS_LOOKUP,
      sizeof (struct PeerAddressLookupMessage)},
-    {&clients_handle_address_iterate, NULL,
+#endif
+     {&clients_handle_address_iterate, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE,
      sizeof (struct AddressIterateMessage)},
     {&GST_blacklist_handle_init, NULL,
index 6f1aa74317ed722783bbb239a98c5b3519447963..3024d8bc18a7060c9c8234a76c545d9f6ca2b5be 100644 (file)
@@ -1561,6 +1561,26 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer)
   return n->latency;
 }
 
+/**
+ * Obtain current address information for the given neighbour.
+ *
+ * @param peer
+ * @return address currently used
+ */
+struct GNUNET_HELLO_Address *
+GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer)
+{
+  struct NeighbourMapEntry *n;
+
+  n = lookup_neighbour (peer);
+  if ( (NULL == n) ||
+       ( (n->address == NULL) && (n->session == NULL) ) )
+    return NULL;
+
+  return n->address;
+}
+
+
 
 /**
  * Create an entry in the neighbour map for the given peer
index 31777343da7ee1fed4ba8155a5c6dc81d7f75a5b..e85f1a4d06b2e404c1c859ca36f8b8d9dd4607d7 100644 (file)
@@ -284,6 +284,16 @@ struct GNUNET_TIME_Relative
 GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer);
 
 
+/**
+ * Obtain current address information for the given neighbour.
+ *
+ * @param peer
+ * @return address currently used
+ */
+struct GNUNET_HELLO_Address *
+GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer);
+
+
 /**
  * We received a disconnect message from the given peer,
  * validate and process.
index 58d20e16daffa7b71dda6a3d6c34579dc6dde4cc..9097311a61dad1a076dce99ce2940d0667801dea 100644 (file)
@@ -75,6 +75,11 @@ static int iterate_connections;
  */
 static int test_configuration;
 
+/**
+ * Option -n.
+ */
+static int numeric;
+
 /**
  * Global return value (0 success).
  */
@@ -150,7 +155,6 @@ struct TestContext
 
 };
 
-struct GNUNET_CONFIGURATION_Handle * cfg;
 
 /**
  * Display the result of the test.
@@ -436,7 +440,17 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
 void process_string (void *cls,
                      const char *address)
 {
-  fprintf (stdout, _("process_string\n"));
+  struct GNUNET_PeerIdentity * peer = cls;
+
+  if ((address != NULL))
+  {
+    fprintf (stdout, _("Peer `%s' : %s\n"), GNUNET_i2s(peer), address);
+  }
+  else
+  {
+    /* done */
+    GNUNET_free (peer);
+  }
 }
 
 /**
@@ -451,23 +465,24 @@ void process_string (void *cls,
 static void
 process_address (void *cls, const struct GNUNET_HELLO_Address *address)
 {
+  const struct GNUNET_CONFIGURATION_Handle * cfg = cls;
+
   if (address == NULL)
   {
+    /* done */
     return;
   }
 
-  fprintf (stdout, _("Peer `%s'\n"),
-           GNUNET_i2s (&address->peer));
+  struct GNUNET_PeerIdentity * peer = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity));
+  *peer = address->peer;
 
   /* Resolve address to string */
-  /*
   GNUNET_TRANSPORT_address_to_string (cfg,
-      address,
-      GNUNET_NO,
-      GNUNET_TIME_UNIT_MINUTES,
-      &process_string,
-      NULL);
-      */
+    address,
+    numeric,
+    GNUNET_TIME_UNIT_MINUTES,
+    &process_string,
+    peer);
 }
 
 
@@ -483,7 +498,6 @@ static void
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  cfg = cfg;
   if (test_configuration)
   {
     do_test_configuration (cfg);
@@ -525,7 +539,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   if (iterate_connections)
   {
     GNUNET_TRANSPORT_address_iterate (cfg, GNUNET_TIME_UNIT_MINUTES,
-                                      &process_address, NULL);
+                                      &process_address, (void *)cfg);
   }
 }
 
@@ -550,6 +564,9 @@ main (int argc, char *const *argv)
     {'t', "test", NULL,
      gettext_noop ("test transport configuration (involves external server)"),
      0, &GNUNET_GETOPT_set_one, &test_configuration},
+     {'n', "numeric", NULL,
+      gettext_noop ("do not resolve hostnames"),
+      0, &GNUNET_GETOPT_set_one, &numeric},
     GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
     GNUNET_GETOPT_OPTION_END
   };
index 7fe3d9532b137237601fa22dd24f21cc4892bb4d..2aa69268a5e6b1fe176f313dff36ed2d8637b0e1 100644 (file)
@@ -22,7 +22,8 @@ UNIX_MATCH_GID = YES
 # BINDTO =
 # REJECT_FROM =
 # REJECT_FROM6 =
-# PREFIX =
+PREFIX = valgrind --leak-check=full
+
 
 [transport-tcp]
 # Use 0 to ONLY advertise as a peer behind NAT (no port binding)
index 5904de5e25aa2119800be5e3582e238eccb92563..489ba8a5a1b026c56b2cb702b6e03a107c34d12c 100644 (file)
 /**
  * Context for the address lookup.
  */
-struct GNUNET_TRANSPORT_PeerAddressLookupContext
+struct GNUNET_TRANSPORT_PeerIterateContext
 {
   /**
-   * Function to call with the human-readable address.
+   * Function to call with the binary address.
    */
-  GNUNET_TRANSPORT_AddressLookUpCallback cb;
+  GNUNET_TRANSPORT_PeerIterateCallback cb;
 
   /**
    * Closure for cb.
@@ -76,11 +76,12 @@ static void
 peer_address_response_processor (void *cls,
                                  const struct GNUNET_MessageHeader *msg)
 {
-  struct GNUNET_TRANSPORT_PeerAddressLookupContext *pal_ctx = cls;
-  struct AddressIterateResponseMessage *air_msg = (struct AddressIterateResponseMessage *) &msg[1];
-  const struct GNUNET_HELLO_Address *address;
+  struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx = cls;
+  struct AddressIterateResponseMessage *air_msg;
+  struct GNUNET_HELLO_Address *address;
   uint16_t size;
-  if (air_msg == NULL)
+
+  if (msg == NULL)
   {
     pal_ctx->cb (pal_ctx->cb_cls, NULL);
     GNUNET_CLIENT_disconnect (pal_ctx->client, GNUNET_NO);
@@ -98,6 +99,16 @@ peer_address_response_processor (void *cls,
     return;
   }
 
+  if (size < sizeof (struct GNUNET_MessageHeader) + sizeof (struct AddressIterateResponseMessage))
+  {
+    GNUNET_break_op (0);
+    pal_ctx->cb (pal_ctx->cb_cls, NULL );
+    GNUNET_CLIENT_disconnect (pal_ctx->client, GNUNET_NO);
+    GNUNET_free (pal_ctx);
+    return;
+  }
+
+  air_msg = (struct AddressIterateResponseMessage *) &msg[1];
   size_t tlen = ntohl(air_msg->pluginlen);
   size_t alen = ntohl(air_msg->addrlen);
 
@@ -113,7 +124,7 @@ peer_address_response_processor (void *cls,
   char * addr = (char *) &air_msg[1];
   char * transport_name = &addr[alen];
 
-  if (transport_name[tlen] != '\0')
+  if (transport_name[tlen-1] != '\0')
   {
     GNUNET_break_op (0);
     pal_ctx->cb (pal_ctx->cb_cls, NULL );
@@ -122,8 +133,6 @@ peer_address_response_processor (void *cls,
     return;
   }
 
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "peer %s transport_name: %s\n",GNUNET_i2s(&air_msg->peer), transport_name);
-
   address = GNUNET_HELLO_address_allocate(&air_msg->peer, transport_name, addr, alen);
 
   /* expect more replies */
@@ -131,28 +140,36 @@ peer_address_response_processor (void *cls,
                          GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout));
 
   pal_ctx->cb (pal_ctx->cb_cls, address);
+  GNUNET_free (address);
 }
 
 
 /**
- * Return all the known addresses for a peer.
+ * Return all the known addresses for a specific peer or all peers.
+ * Returns continously all address if one_shot is set to GNUNET_NO
+ *
+ * CHANGE: Returns the address(es) that we are currently using for this
+ * peer.  Upon completion, the 'AddressLookUpCallback' is called one more
+ * time with 'NULL' for the address and the peer.  After this, the operation must no
+ * longer be explicitly cancelled.
  *
  * @param cfg configuration to use
- * @param peer peer identity to look up the addresses of
+ * @param peer peer identity to look up the addresses of, CHANGE: allow NULL for all (connected) peers
+ * @param one_shot GNUNET_YES to return the current state and then end (with NULL+NULL),
+ *                 GNUNET_NO to monitor the set of addresses used (continuously, must be explicitly cancelled)
  * @param timeout how long is the lookup allowed to take at most
  * @param peer_address_callback function to call with the results
  * @param peer_address_callback_cls closure for peer_address_callback
- * @return handle to cancel the operation, NULL on error
  */
-struct GNUNET_TRANSPORT_PeerAddressLookupContext *
+struct GNUNET_TRANSPORT_PeerIterateContext *
 GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                             const struct GNUNET_PeerIdentity *peer,
                                             int one_shot,
                                             struct GNUNET_TIME_Relative timeout,
-                                            GNUNET_TRANSPORT_AddressLookUpCallback peer_address_callback,
+                                            GNUNET_TRANSPORT_PeerIterateCallback peer_address_callback,
                                             void *peer_address_callback_cls)
 {
-  struct GNUNET_TRANSPORT_PeerAddressLookupContext *pal_ctx;
+  struct GNUNET_TRANSPORT_PeerIterateContext *pal_ctx;
   struct AddressIterateMessage msg;
   struct GNUNET_CLIENT_Connection *client;
   struct GNUNET_TIME_Absolute abs_timeout;
@@ -174,7 +191,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Ha
   else
    memcpy (&msg.peer, peer , sizeof (struct GNUNET_PeerIdentity));
 
-  pal_ctx = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerAddressLookupContext));
+  pal_ctx = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerIterateContext));
   pal_ctx->cb = peer_address_callback;
   pal_ctx->cb_cls = peer_address_callback_cls;
   pal_ctx->timeout = abs_timeout;
@@ -195,7 +212,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct GNUNET_CONFIGURATION_Ha
  */
 void
 GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
-                                             GNUNET_TRANSPORT_PeerAddressLookupContext
+                                             GNUNET_TRANSPORT_PeerIterateContext
                                              *alc)
 {
   GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
@@ -203,7 +220,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
 }
 
 /**
- * Return all the known addresses for all peers.
+ * Return all addresses for all peers.
  *
  * @param cfg configuration to use
  * @param timeout how long is the lookup allowed to take at most
@@ -213,7 +230,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (struct
 void
 GNUNET_TRANSPORT_address_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
                                   struct GNUNET_TIME_Relative timeout,
-                                  GNUNET_TRANSPORT_AddressLookUpCallback
+                                  GNUNET_TRANSPORT_PeerIterateCallback
                                   peer_address_callback,
                                   void *peer_address_callback_cls)
 {
index 2e5a34ce22e6f79da5a3cb097080f228747ed9eb..87ee9ad8354a0108c34bcf245009aa5089644cdd 100644 (file)
@@ -76,7 +76,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg)
     return;
   }
   GNUNET_break (ntohs (msg->type) ==
-      GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE);
+      GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
   size = ntohs (msg->size);
   if (size == sizeof (struct GNUNET_MessageHeader))
   {
@@ -131,8 +131,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
   char *addrbuf;
 
   GNUNET_assert (address != NULL);
-  alen = GNUNET_HELLO_address_get_size (address);
-  len = sizeof (struct AddressLookupMessage) + alen;
+  len = sizeof (struct AddressLookupMessage) + GNUNET_HELLO_address_get_size (address);
   if (len >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
   {
     GNUNET_break (0);
@@ -144,6 +143,8 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
     return NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "GNUNET_TRANSPORT_address_to_string\n");
+
+  alen = address->address_length;
   msg = GNUNET_malloc (len);
   msg->header.size = htons (len);
   msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING);
@@ -151,7 +152,9 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
   msg->timeout = GNUNET_TIME_relative_hton (timeout);
   msg->addrlen = htonl (alen);
   addrbuf = (char *) &msg[1];
-  memcpy (addrbuf, address, alen);
+  memcpy (addrbuf, address->address, alen);
+  strcpy (&addrbuf[alen], address->transport_name);
+
   alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_AddressToStringContext));
   alc->cb = aluc;
   alc->cb_cls = aluc_cls;
@@ -183,4 +186,4 @@ GNUNET_TRANSPORT_address_to_string_cancel (struct
 
 
 
-/* end of transport_api_address_lookup.c */
+/* end of transport_api_address_to_string.c */