gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r10214 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r10214 - gnunet/src/transport
Date: Thu, 4 Feb 2010 15:31:16 +0100

Author: grothoff
Date: 2010-02-04 15:31:16 +0100 (Thu, 04 Feb 2010)
New Revision: 10214

Modified:
   gnunet/src/transport/gnunet-nat-client.c
   gnunet/src/transport/gnunet-nat-server.c
Log:
fix

Modified: gnunet/src/transport/gnunet-nat-client.c
===================================================================
--- gnunet/src/transport/gnunet-nat-client.c    2010-02-04 14:22:53 UTC (rev 
10213)
+++ gnunet/src/transport/gnunet-nat-client.c    2010-02-04 14:31:16 UTC (rev 
10214)
@@ -329,6 +329,7 @@
   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 @@
   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 @@
       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 @@
   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 @@
        }
       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,

Modified: gnunet/src/transport/gnunet-nat-server.c
===================================================================
--- gnunet/src/transport/gnunet-nat-server.c    2010-02-04 14:22:53 UTC (rev 
10213)
+++ gnunet/src/transport/gnunet-nat-server.c    2010-02-04 14:31:16 UTC (rev 
10214)
@@ -325,6 +325,7 @@
   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 @@
   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 @@
     }
   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);    
     }
 }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]