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;
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
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);
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! */
}
}
}
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,
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;
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,
}
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);
}
}