From 2ecad0debfa1f03527d7cae26aa18edccc1483b6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 4 Feb 2010 14:31:16 +0000 Subject: [PATCH] fix --- src/transport/gnunet-nat-client.c | 15 ++++++++++----- src/transport/gnunet-nat-server.c | 8 ++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/transport/gnunet-nat-client.c b/src/transport/gnunet-nat-client.c index da0a8064b..80c1c14ad 100644 --- a/src/transport/gnunet-nat-client.c +++ b/src/transport/gnunet-nat-client.c @@ -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, diff --git a/src/transport/gnunet-nat-server.c b/src/transport/gnunet-nat-server.c index bc1130f9b..ab984d18a 100644 --- a/src/transport/gnunet-nat-server.c +++ b/src/transport/gnunet-nat-server.c @@ -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); } } -- 2.25.1