Package: ipv6calc
Version: 0.73.0-2

Hi,

the ipv6calc program has a typo in the source code relating to the
printing of a Teredo type IPv6 address.  Patch included, see below:

antici...@hsa:~$ ipv6calc -i 2001:0:5ef5:73bc:3838:17a2:a0af:fea4
No input type specified, try autodetection...found type: ipv6addr
No output type specified, try autodetection...found type: ipv6addr
Address type: unicast, global-unicast, teredo
IPv4 address: 95.80.1.91
IPv4 registry[95.80.1.91]: RIPENCC
IPv4 address: 94.245.115.188
IPv4 registry[94.245.115.188]: RIPENCC
Address type is Teredo and included IPv4 server address is: 95.80.1.91
and client port: 59485
IPv4 registry for Teredo server address: RIPENCC
Registry for address: IANA

http://en.wikipedia.org/wiki/Teredo_tunneling#Teredo_IPv6_addressing

bits   content
0-31   Prefix
32-63  Primary IPv4 of server
64-79  Flags
80-95  Obfuscated client UDP port (value xor 0xffff)
96-127 Obfuscated client IPv4 (value xor 0xffffffff)

antici...@hsa:/usr/local/src/ipv6calc$ python
Python 2.5.4 (r254:67916, Jan 24 2010, 16:02:42) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipaddr
>>> ipaddr.IPv4Address((0x5ef5<<16)+0x73bc)
IPv4Address('94.245.115.188')
>>> 0x17a2 ^ 0xffff
59485
>>> ipaddr.IPv4Address(((0xa0af<<16)+0xfea4) ^ 0xffffffff)
IPv4Address('95.80.1.91')

Obviously, the addresses are mixed up in the output of ipv6calc.


Attached is a patch that fixes this.

antici...@hsa:/usr/local/src/ipv6calc$
ipv6calc-0.73.0-modified/ipv6calc/ipv6calc -i
2001:0:5ef5:73bc:3838:17a2:a0af:fea4 2>&1 | grep 'is Teredo'
Address type is Teredo and included IPv4 server address is:
94.245.115.188 and client port: 59485

Regards,
-- 
Martin Millnert <mar...@millnert.se>
diff -ruN ipv6calc-0.73.0/ipv6calc/showinfo.c ipv6calc-0.73.0-modified/ipv6calc/showinfo.c
--- ipv6calc-0.73.0/ipv6calc/showinfo.c	2007-07-05 22:58:23.000000000 +0200
+++ ipv6calc-0.73.0-modified/ipv6calc/showinfo.c	2010-02-10 22:41:03.000000000 +0100
@@ -714,7 +714,7 @@
 		print_ipv4addr(&ipv4addr, formatoptions | FORMATOPTION_printembedded, "TEREDO-CLIENT");
 		print_ipv4addr(&ipv4addr2, formatoptions | FORMATOPTION_printembedded, "TEREDO-SERVER");
 
-		retval = libipv4addr_ipv4addrstruct_to_string(&ipv4addr, helpstring, 0);
+		retval = libipv4addr_ipv4addrstruct_to_string(&ipv4addr2, helpstring, 0);
 		if ( retval != 0 ) {
 			fprintf(stderr, "Error converting IPv4 address to string\n");
 			retval = 1;

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to