fix #3275 with solution from https://gnunet.org/bugs/view.php?id=3275#c8029
[oweals/gnunet.git] / src / pt / gnunet-daemon-pt.c
index 1d9abf81ad1274ff75d7ea4159dd9c4d211d1826..166f9df1dcaeed3a4b7c2e013bce912d8a5af76e 100644 (file)
@@ -51,7 +51,7 @@
 #define MAX_DNS_SIZE (8 * 1024)
 
 /**
- * How many tunnels do we open at most at the same time?
+ * How many channels do we open at most at the same time?
  */
 #define MAX_OPEN_TUNNELS 4
 
@@ -64,7 +64,7 @@ enum RequestGroup
   /**
    * DNS answers
    */
-  ANSWERS = 0, 
+  ANSWERS = 0,
 
   /**
    * DNS authority records
@@ -92,7 +92,7 @@ struct ReplyContext
    * Handle to submit the final result.
    */
   struct GNUNET_DNS_RequestHandle *rh;
-  
+
   /**
    * DNS packet that is being modified.
    */
@@ -117,13 +117,13 @@ struct ReplyContext
    * Group that is being modified
    */
   enum RequestGroup group;
-  
+
 };
 
 
 /**
  * Handle to a peer that advertised that it is willing to serve
- * as a DNS exit.  We try to keep a few tunnels open and a few
+ * as a DNS exit.  We try to keep a few channels open and a few
  * peers in reserve.
  */
 struct MeshExit
@@ -140,11 +140,11 @@ struct MeshExit
   struct MeshExit *prev;
 
   /**
-   * Tunnel we use for DNS requests over MESH, NULL if we did
-   * not initialze a tunnel to this peer yet.
+   * Channel we use for DNS requests over MESH, NULL if we did
+   * not initialze a channel to this peer yet.
    */
-  struct GNUNET_MESH_Tunnel *mesh_tunnel;
-  
+  struct GNUNET_MESH_Channel *mesh_channel;
+
   /**
    * At what time did the peer's advertisement expire?
    */
@@ -161,32 +161,32 @@ struct MeshExit
   struct RequestContext *receive_queue_tail;
 
   /**
-   * Head of DLL of requests to be transmitted to a mesh_tunnel.
+   * Head of DLL of requests to be transmitted to a mesh_channel.
    */
   struct RequestContext *transmit_queue_head;
 
   /**
-   * Tail of DLL of requests to be transmitted to a mesh_tunnel.
+   * Tail of DLL of requests to be transmitted to a mesh_channel.
    */
   struct RequestContext *transmit_queue_tail;
 
   /**
-   * Active transmission request for this tunnel (or NULL).
+   * Active transmission request for this channel (or NULL).
    */
   struct GNUNET_MESH_TransmitHandle *mesh_th;
 
   /**
    * Identity of the peer that is providing the exit for us.
-   */ 
+   */
   struct GNUNET_PeerIdentity peer;
 
   /**
-   * How many DNS requests did we transmit via this tunnel?
+   * How many DNS requests did we transmit via this channel?
    */
   unsigned int num_transmitted;
 
   /**
-   * How many DNS requests were answered via this tunnel?
+   * How many DNS requests were answered via this channel?
    */
   unsigned int num_answered;
 
@@ -218,7 +218,7 @@ struct RequestContext
    * Handle for interaction with DNS service.
    */
   struct GNUNET_DNS_RequestHandle *rh;
-  
+
   /**
    * Message we're sending out via MESH, allocated at the
    * end of this struct.
@@ -243,14 +243,14 @@ struct RequestContext
   /**
    * #GNUNET_NO if this request is still in the transmit_queue,
    * #GNUNET_YES if we are in the receive_queue.
-   */ 
+   */
   int16_t was_transmitted;
 
 };
 
 
 /**
- * Head of DLL of mesh exits.  Mesh exits with an open tunnel are
+ * Head of DLL of mesh exits.  Mesh exits with an open channel are
  * always at the beginning (so we do not have to traverse the entire
  * list to find them).
  */
@@ -312,14 +312,14 @@ static int ipv4_pt;
 static int ipv6_pt;
 
 /**
- * Are we tunneling DNS queries?
+ * Are we channeling DNS queries?
  */
-static int dns_tunnel;
+static int dns_channel;
 
 /**
- * Number of DNS exit peers we currently have in the mesh tunnel.
- * Used to see if using the mesh tunnel makes any sense right now,
- * as well as to decide if we should open new tunnels.
+ * Number of DNS exit peers we currently have in the mesh channel.
+ * Used to see if using the mesh channel makes any sense right now,
+ * as well as to decide if we should open new channels.
  */
 static unsigned int dns_exit_available;
 
@@ -336,25 +336,24 @@ try_open_exit ()
 
   candidate_count = 0;
   for (pos = exit_head; NULL != pos; pos = pos->next)
-    if (NULL == pos->mesh_tunnel)
+    if (NULL == pos->mesh_channel)
       candidate_count++;
   candidate_selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
                                                 candidate_count);
   candidate_count = 0;
   for (pos = exit_head; NULL != pos; pos = pos->next)
-    if (NULL == pos->mesh_tunnel)
+    if (NULL == pos->mesh_channel)
     {
       candidate_count++;
       if (candidate_selected < candidate_count)
       {
        /* move to the head of the DLL */
-       pos->mesh_tunnel = GNUNET_MESH_tunnel_create (mesh_handle,
+       pos->mesh_channel = GNUNET_MESH_channel_create (mesh_handle,
                                                      pos,
                                                      &pos->peer,
                                                      GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
-                                                     GNUNET_YES /* no buffer */,
-                                                     GNUNET_NO /* reliable */);
-       if (NULL == pos->mesh_tunnel)
+                                                     GNUNET_MESH_OPTION_DEFAULT);
+       if (NULL == pos->mesh_channel)
        {
          GNUNET_break (0);
          continue;
@@ -375,20 +374,20 @@ try_open_exit ()
 
 /**
  * Compute the weight of the given exit.  The higher the weight,
- * the more likely it will be that the tunnel will be chosen.
- * A weigt of zero means that we should close the tunnel as it
+ * the more likely it will be that the channel will be chosen.
+ * A weigt of zero means that we should close the channel as it
  * is so bad, that we should not use it.
  *
  * @param exit exit to calculate the weight for
- * @return weight of the tunnel
+ * @return weight of the channel
  */
 static uint32_t
-get_tunnel_weight (struct MeshExit *exit)
+get_channel_weight (struct MeshExit *exit)
 {
   uint32_t dropped;
   uint32_t drop_percent;
   uint32_t good_percent;
-  
+
   GNUNET_assert (exit->num_transmitted >= exit->num_answered);
   dropped = exit->num_transmitted - exit->num_answered;
   if (exit->num_transmitted > 0)
@@ -407,12 +406,12 @@ get_tunnel_weight (struct MeshExit *exit)
 
 
 /**
- * Choose a mesh exit for a DNS request.  We try to use a tunnel
- * that is reliable and currently available.  All existing 
- * tunnels are given a base weight of 1, plus a score relating
+ * Choose a mesh exit for a DNS request.  We try to use a channel
+ * that is reliable and currently available.  All existing
+ * channels are given a base weight of 1, plus a score relating
  * to the total number of queries answered in relation to the
- * total number of queries we sent to that tunnel.  That
- * score is doubled if the tunnel is currently idle.
+ * total number of queries we sent to that channel.  That
+ * score is doubled if the channel is currently idle.
  *
  * @return NULL if no exit is known, otherwise the
  *         exit that we should use to queue a message with
@@ -423,22 +422,22 @@ choose_exit ()
   struct MeshExit *pos;
   uint64_t total_transmitted;
   uint64_t selected_offset;
-  uint32_t tunnel_weight;
+  uint32_t channel_weight;
 
   total_transmitted = 0;
   for (pos = exit_head; NULL != pos; pos = pos->next)
   {
-    if (NULL == pos->mesh_tunnel)
+    if (NULL == pos->mesh_channel)
       break;
-    tunnel_weight = get_tunnel_weight (pos);
-    total_transmitted += tunnel_weight;
-    /* double weight for idle tunnels */
+    channel_weight = get_channel_weight (pos);
+    total_transmitted += channel_weight;
+    /* double weight for idle channels */
     if (NULL == pos->mesh_th)
-      total_transmitted += tunnel_weight;
+      total_transmitted += channel_weight;
   }
   if (0 == total_transmitted)
   {
-    /* no tunnels available, or only a very bad one... */
+    /* no channels available, or only a very bad one... */
     return exit_head;
   }
   selected_offset = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
@@ -446,13 +445,13 @@ choose_exit ()
   total_transmitted = 0;
   for (pos = exit_head; NULL != pos; pos = pos->next)
   {
-    if (NULL == pos->mesh_tunnel)
+    if (NULL == pos->mesh_channel)
       break;
-    tunnel_weight = get_tunnel_weight (pos);
-    total_transmitted += tunnel_weight;
-    /* double weight for idle tunnels */
+    channel_weight = get_channel_weight (pos);
+    total_transmitted += channel_weight;
+    /* double weight for idle channels */
     if (NULL == pos->mesh_th)
-      total_transmitted += tunnel_weight;
+      total_transmitted += channel_weight;
     if (total_transmitted > selected_offset)
       return pos;
   }
@@ -520,7 +519,7 @@ submit_request (struct ReplyContext *rc);
  *                will match 'result_af' from the request
  * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
  *                that the VPN allocated for the redirection;
- *                traffic to this IP will now be redirected to the 
+ *                traffic to this IP will now be redirected to the
  *                specified target peer; NULL on error
  */
 static void
@@ -561,7 +560,7 @@ vpn_allocation_callback (void *cls,
 
 
 /**
- * Modify the given DNS record by asking VPN to create a tunnel
+ * Modify the given DNS record by asking VPN to create a channel
  * to the given address.  When done, continue with submitting
  * other records from the request context ('submit_request' is
  * our continuation).
@@ -633,7 +632,7 @@ submit_request (struct ReplyContext *rc)
       finish_request (rc);
       return;
     default:
-      GNUNET_assert (0);      
+      GNUNET_assert (0);
     }
     for (i=rc->offset;i<ra_len;i++)
     {
@@ -694,9 +693,9 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
 
 
 /**
- * This function is called AFTER we got an IP address for a 
+ * This function is called AFTER we got an IP address for a
  * DNS request.  Now, the PT daemon has the chance to substitute
- * the IP address with one from the VPN range to tunnel requests
+ * the IP address with one from the VPN range to channel requests
  * destined for this IP address via VPN and MESH.
  *
  * @param cls closure
@@ -704,7 +703,7 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
  * @param request_length number of bytes in request
  * @param request udp payload of the DNS request
  */
-static void 
+static void
 dns_post_request_handler (void *cls,
                          struct GNUNET_DNS_RequestHandle *rh,
                          size_t request_length,
@@ -768,7 +767,7 @@ transmit_dns_request_to_mesh (void *cls,
   mlen = rc->mlen;
   if (mlen > size)
   {
-    exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_tunnel,
+    exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel,
                                                       GNUNET_NO,
                                                       TIMEOUT,
                                                       mlen,
@@ -787,7 +786,7 @@ transmit_dns_request_to_mesh (void *cls,
                               rc);
   rc = exit->transmit_queue_head;
   if (NULL != rc)
-    exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_tunnel,
+    exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel,
                                                       GNUNET_NO,
                                                       TIMEOUT,
                                                       rc->mlen,
@@ -809,7 +808,7 @@ timeout_request (void *cls,
 {
   struct RequestContext *rc = cls;
   struct MeshExit *exit = rc->exit;
-  
+
   if (rc->was_transmitted)
   {
     exit->num_transmitted++;
@@ -828,15 +827,15 @@ timeout_request (void *cls,
                            1, GNUNET_NO);
   GNUNET_DNS_request_drop (rc->rh);
   GNUNET_free (rc);
-  if ( (0 == get_tunnel_weight (exit)) &&
+  if ( (0 == get_channel_weight (exit)) &&
        (NULL == exit->receive_queue_head) &&
        (NULL == exit->transmit_queue_head) )
   {
-    /* this straw broke the camel's back: this tunnel now has
+    /* this straw broke the camel's back: this channel now has
        such a low score that it will not be used; close it! */
     GNUNET_assert (NULL == exit->mesh_th);
-    GNUNET_MESH_tunnel_destroy (exit->mesh_tunnel);
-    exit->mesh_tunnel = NULL;
+    GNUNET_MESH_channel_destroy (exit->mesh_channel);
+    exit->mesh_channel = NULL;
     GNUNET_CONTAINER_DLL_remove (exit_head,
                                 exit_tail,
                                 exit);
@@ -844,8 +843,8 @@ timeout_request (void *cls,
                                      exit_tail,
                                      exit);
     /* go back to semi-innocent: mark as not great, but
-       avoid a prohibitively negative score (see 
-       #get_tunnel_weight, which checks for a certain
+       avoid a prohibitively negative score (see
+       #get_channel_weight, which checks for a certain
        minimum number of transmissions before making
        up an opinion) */
     exit->num_transmitted = 5;
@@ -858,17 +857,17 @@ timeout_request (void *cls,
 
 
 /**
- * This function is called *before* the DNS request has been 
- * given to a "local" DNS resolver.  Tunneling for DNS requests
+ * This function is called *before* the DNS request has been
+ * given to a "local" DNS resolver.  Channeling for DNS requests
  * was enabled, so we now need to send the request via some MESH
- * tunnel to a DNS EXIT for resolution.
+ * channel to a DNS EXIT for resolution.
  *
  * @param cls closure
  * @param rh request handle to user for reply
  * @param request_length number of bytes in request
  * @param request udp payload of the DNS request
  */
-static void 
+static void
 dns_pre_request_handler (void *cls,
                         struct GNUNET_DNS_RequestHandle *rh,
                         size_t request_length,
@@ -886,7 +885,7 @@ dns_pre_request_handler (void *cls,
   if (0 == dns_exit_available)
   {
     GNUNET_STATISTICS_update (stats,
-                             gettext_noop ("# DNS requests dropped (DNS mesh tunnel down)"),
+                             gettext_noop ("# DNS requests dropped (DNS mesh channel down)"),
                              1, GNUNET_NO);
     GNUNET_DNS_request_drop (rh);
     return;
@@ -903,7 +902,7 @@ dns_pre_request_handler (void *cls,
   mlen = sizeof (struct GNUNET_MessageHeader) + request_length;
   exit = choose_exit ();
   GNUNET_assert (NULL != exit);
-  GNUNET_assert (NULL != exit->mesh_tunnel);
+  GNUNET_assert (NULL != exit->mesh_channel);
   rc = GNUNET_malloc (sizeof (struct RequestContext) + mlen);
   rc->exit = exit;
   rc->rh = rh;
@@ -923,7 +922,7 @@ dns_pre_request_handler (void *cls,
                                    exit->transmit_queue_tail,
                                    rc);
   if (NULL == exit->mesh_th)
-    exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_tunnel,
+    exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel,
                                                       GNUNET_NO,
                                                       TIMEOUT,
                                                       mlen,
@@ -936,19 +935,19 @@ dns_pre_request_handler (void *cls,
  * Process a request via mesh to perform a DNS query.
  *
  * @param cls NULL
- * @param tunnel connection to the other end
- * @param tunnel_ctx pointer to our `struct MeshExit`
+ * @param channel connection to the other end
+ * @param channel_ctx pointer to our `struct MeshExit`
  * @param message the actual message
  * @return #GNUNET_OK to keep the connection open,
  *         #GNUNET_SYSERR to close it (signal serious error)
  */
 static int
-receive_dns_response (void *cls, 
-                     struct GNUNET_MESH_Tunnel *tunnel,
-                     void **tunnel_ctx,
+receive_dns_response (void *cls,
+                     struct GNUNET_MESH_Channel *channel,
+                     void **channel_ctx,
                      const struct GNUNET_MessageHeader *message)
 {
-  struct MeshExit *exit = *tunnel_ctx;
+  struct MeshExit *exit = *channel_ctx;
   struct GNUNET_TUN_DnsHeader dns;
   size_t mlen;
   struct RequestContext *rc;
@@ -979,7 +978,7 @@ receive_dns_response (void *cls,
       GNUNET_free (rc);
       exit->num_answered++;
       exit->num_transmitted++;
-      return GNUNET_OK;      
+      return GNUNET_OK;
     }
   }
   GNUNET_STATISTICS_update (stats,
@@ -993,7 +992,7 @@ receive_dns_response (void *cls,
  * Abort all pending DNS requests with the given mesh exit.
  *
  * @param exit mesh exit to abort requests for
- */ 
+ */
 static void
 abort_all_requests (struct MeshExit *exit)
 {
@@ -1006,7 +1005,7 @@ abort_all_requests (struct MeshExit *exit)
                                 rc);
     GNUNET_DNS_request_drop (rc->rh);
     GNUNET_SCHEDULER_cancel (rc->timeout_task);
-    GNUNET_free (rc);    
+    GNUNET_free (rc);
   }
   while (NULL != (rc = exit->transmit_queue_head))
   {
@@ -1015,7 +1014,7 @@ abort_all_requests (struct MeshExit *exit)
                                 rc);
     GNUNET_DNS_request_drop (rc->rh);
     GNUNET_SCHEDULER_cancel (rc->timeout_task);
-    GNUNET_free (rc);    
+    GNUNET_free (rc);
   }
 }
 
@@ -1049,10 +1048,10 @@ cleanup (void *cls,
       GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th);
       exit->mesh_th = NULL;
     }
-    if (NULL != exit->mesh_tunnel)
+    if (NULL != exit->mesh_channel)
     {
-      GNUNET_MESH_tunnel_destroy (exit->mesh_tunnel);
-      exit->mesh_tunnel = NULL;
+      GNUNET_MESH_channel_destroy (exit->mesh_channel);
+      exit->mesh_channel = NULL;
     }
     abort_all_requests (exit);
     GNUNET_free (exit);
@@ -1091,38 +1090,38 @@ cleanup (void *cls,
 
 
 /**
- * Function called whenever a tunnel is destroyed.  Should clean up
+ * Function called whenever a channel is destroyed.  Should clean up
  * the associated state and attempt to build a new one.
- * 
- * It must NOT call #GNUNET_MESH_tunnel_destroy on the tunnel.
+ *
+ * It must NOT call #GNUNET_MESH_channel_destroy on the channel.
  *
  * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect)
- * @param tunnel connection to the other end (henceforth invalid)
- * @param tunnel_ctx place where local state associated
- *                   with the tunnel is stored
+ * @param channel connection to the other end (henceforth invalid)
+ * @param channel_ctx place where local state associated
+ *                   with the channel is stored
  */
 static void
-mesh_tunnel_end_cb (void *cls,
-                   const struct GNUNET_MESH_Tunnel *tunnel, 
-                   void *tunnel_ctx)
+mesh_channel_end_cb (void *cls,
+                   const struct GNUNET_MESH_Channel *channel,
+                   void *channel_ctx)
 {
-  struct MeshExit *exit = tunnel_ctx;
+  struct MeshExit *exit = channel_ctx;
   struct MeshExit *alt;
-  struct RequestContext *rc;  
+  struct RequestContext *rc;
 
   if (NULL != exit->mesh_th)
   {
     GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th);
     exit->mesh_th = NULL;
   }
-  exit->mesh_tunnel = NULL;
+  exit->mesh_channel = NULL;
   dns_exit_available--;
-  /* open alternative tunnels */
+  /* open alternative channels */
   try_open_exit ();
-  if (NULL == exit->mesh_tunnel)
+  if (NULL == exit->mesh_channel)
   {
-    /* our tunnel is now closed, move our requests to an alternative
-       tunnel */
+    /* our channel is now closed, move our requests to an alternative
+       channel */
     alt = choose_exit ();
     while (NULL != (rc = exit->transmit_queue_head))
     {
@@ -1149,11 +1148,11 @@ mesh_tunnel_end_cb (void *cls,
   else
   {
     /* the same peer was chosen, just make sure the queue processing is restarted */
-    alt = exit; 
+    alt = exit;
   }
   if ( (NULL == alt->mesh_th) &&
        (NULL != (rc = alt->transmit_queue_head)) )
-    alt->mesh_th = GNUNET_MESH_notify_transmit_ready (alt->mesh_tunnel,
+    alt->mesh_th = GNUNET_MESH_notify_transmit_ready (alt->mesh_channel,
                                                      GNUNET_NO,
                                                      TIMEOUT,
                                                      rc->mlen,
@@ -1163,8 +1162,8 @@ mesh_tunnel_end_cb (void *cls,
 
 
 /**
- * Function called whenever we find an advertisement for a 
- * DNS exit in the DHT.  If we don't have a mesh tunnel,
+ * Function called whenever we find an advertisement for a
+ * DNS exit in the DHT.  If we don't have a mesh channel,
  * we should build one; otherwise, we should save the
  * advertisement for later use.
  *
@@ -1185,7 +1184,7 @@ static void
 handle_dht_result (void *cls,
                   struct GNUNET_TIME_Absolute exp,
                   const struct GNUNET_HashCode *key,
-                  const struct GNUNET_PeerIdentity *get_path, 
+                  const struct GNUNET_PeerIdentity *get_path,
                   unsigned int get_path_length,
                   const struct GNUNET_PeerIdentity *put_path,
                   unsigned int put_path_length,
@@ -1201,7 +1200,7 @@ handle_dht_result (void *cls,
     return;
   }
   ad = data;
-  for (exit = exit_head; NULL != exit; exit = exit->next)  
+  for (exit = exit_head; NULL != exit; exit = exit->next)
     if (0 == memcmp (&ad->peer,
                     &exit->peer,
                     sizeof (struct GNUNET_PeerIdentity)))
@@ -1210,7 +1209,7 @@ handle_dht_result (void *cls,
   {
     exit = GNUNET_new (struct MeshExit);
     exit->peer = ad->peer;
-    /* tunnel is closed, so insert at the end */
+    /* channel is closed, so insert at the end */
     GNUNET_CONTAINER_DLL_insert_tail (exit_head,
                                      exit_tail,
                                      exit);
@@ -1240,23 +1239,23 @@ run (void *cls, char *const *args GNUNET_UNUSED,
   cfg = cfg_;
   stats = GNUNET_STATISTICS_create ("pt", cfg);
   ipv4_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV4");
-  ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6"); 
-  dns_tunnel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS"); 
-  if (! (ipv4_pt || ipv6_pt || dns_tunnel))
+  ipv6_pt = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_IPV6");
+  dns_channel = GNUNET_CONFIGURATION_get_value_yesno (cfg, "pt", "TUNNEL_DNS");
+  if (! (ipv4_pt || ipv6_pt || dns_channel))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                _("No useful service enabled.  Exiting.\n"));
     GNUNET_SCHEDULER_shutdown ();
-    return;    
+    return;
   }
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls);
   if (ipv4_pt || ipv6_pt)
   {
-    dns_post_handle 
-      = GNUNET_DNS_connect (cfg, 
+    dns_post_handle
+      = GNUNET_DNS_connect (cfg,
                            GNUNET_DNS_FLAG_POST_RESOLUTION,
                            &dns_post_request_handler, NULL);
-    if (NULL == dns_post_handle)       
+    if (NULL == dns_post_handle)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                  _("Failed to connect to %s service.  Exiting.\n"),
@@ -1274,18 +1273,18 @@ run (void *cls, char *const *args GNUNET_UNUSED,
       return;
     }
   }
-  if (dns_tunnel)
+  if (dns_channel)
   {
     static struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
       {&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0},
       {NULL, 0, 0}
     };
 
-    dns_pre_handle 
-      = GNUNET_DNS_connect (cfg, 
+    dns_pre_handle
+      = GNUNET_DNS_connect (cfg,
                            GNUNET_DNS_FLAG_PRE_RESOLUTION,
                            &dns_pre_request_handler, NULL);
-    if (NULL == dns_pre_handle)       
+    if (NULL == dns_pre_handle)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                  _("Failed to connect to %s service.  Exiting.\n"),
@@ -1294,7 +1293,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
       return;
     }
     mesh_handle = GNUNET_MESH_connect (cfg, NULL, NULL,
-                                      &mesh_tunnel_end_cb,
+                                      &mesh_channel_end_cb,
                                       mesh_handlers, NULL);
     if (NULL == mesh_handle)
     {