fix
authorChristian Grothoff <christian@grothoff.org>
Thu, 4 Feb 2010 14:31:16 +0000 (14:31 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 4 Feb 2010 14:31:16 +0000 (14:31 +0000)
src/transport/gnunet-nat-client.c
src/transport/gnunet-nat-server.c

index da0a8064b05b55747599a02fb8b1c882ebb9848e..80c1c14adb092fc31e1d14a537e844d764149d41 100644 (file)
@@ -329,6 +329,7 @@ process_icmp_response (const struct in_addr *my_ip,
   struct in_addr sip;
   uint16_t my_magic;
   uint16_t reply_magic;
+  uint16_t local_port;
   struct ip_packet ip_pkt;
   struct icmp_packet icmp_pkt;
   struct udp_packet udp_pkt;  
@@ -382,6 +383,7 @@ process_icmp_response (const struct in_addr *my_ip,
   memcpy(&sip, &ip_pkt.src_ip, sizeof (sip));
   reply_magic = ntohs (udp_pkt.checksum_aka_my_magic);
   my_magic = ntohs (udp_pkt.mlen_aka_reply_port_magic);
+  local_port = ntohs (udp_pkt.source_port);
   if  (my_magic == 0)
     {
 #if 0
@@ -392,13 +394,14 @@ process_icmp_response (const struct in_addr *my_ip,
       return;
     }
   fprintf (stderr,
-          "Received ICMP from `%s' with hints %u and %u\n",
+          "Received ICMP from `%s' with hints %u and %u to local port %u\n",
           inet_ntop (AF_INET,
                      &sip,
                      buf,
                      sizeof (buf)),
           my_magic,
-          reply_magic);
+          reply_magic,
+          local_port);
   if (my_magic == 0)
     {
       try_connect (my_ip, &sip, reply_magic);
@@ -406,12 +409,14 @@ process_icmp_response (const struct in_addr *my_ip,
   else
     {
       send_icmp (my_ip, &target, my_magic, reply_magic);
-      printf ("%s:%u\n",
+      printf ("%s:%u listen on %u\n",
              inet_ntop (AF_INET,
                         &sip,
                         buf,
                         sizeof(buf)),
-             my_magic);    
+             my_magic,
+             local_port);
+      /* technically, we're done here! */      
     }
 }
 
@@ -549,7 +554,7 @@ main (int argc, char *const *argv)
        }
       p = make_port ();
       fprintf (stderr,
-              "Sending fake ICMP message to %s with port %u\n",
+              "Sending fake ICMP message to %s:%u\n",
               argv[1],
               p);      
       send_icmp (&external,
index bc1130f9b236c60fe173a11f98abfd74344c3cb8..ab984d18a3a42c82d0f84882c1cdaf6da876c66e 100644 (file)
@@ -325,6 +325,7 @@ process_icmp_response (const struct in_addr *my_ip,
   struct in_addr sip;
   uint16_t my_magic;
   uint16_t reply_magic;
+  uint16_t local_port;
   struct ip_packet ip_pkt;
   struct icmp_packet icmp_pkt;
   struct udp_packet udp_pkt;  
@@ -378,6 +379,7 @@ process_icmp_response (const struct in_addr *my_ip,
   memcpy(&sip, &ip_pkt.src_ip, sizeof (sip));
   reply_magic = ntohs (udp_pkt.checksum_aka_my_magic);
   my_magic = ntohs (udp_pkt.mlen_aka_reply_port_magic);
+  local_port = ntohs (udp_pkt.source_port);
   fprintf (stderr,
           "Received ICMP from `%s' with hints %u and %u\n",
           inet_ntop (AF_INET,
@@ -392,12 +394,14 @@ process_icmp_response (const struct in_addr *my_ip,
     }
   else
     {
-      printf ("%s:%u\n",
+      /* FIXME: should close 'local_port' */
+      printf ("%s:%u listen on %u\n",
              inet_ntop (AF_INET,
                         &sip,
                         buf,
                         sizeof(buf)),
-             my_magic);    
+             my_magic,
+             local_port);    
     }
 }