Subject: whois: Teredo support Package: whois Version: 4.7.15 Severity: wishlist Tags: patch
*** Please type your report below this line ***
Hello,
6to4-like support for Teredo addresses would be nice.
Patch attached.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17.10
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Versions of packages whois depends on:
ii libc6 2.3.6.ds1-2 GNU C Library: Shared
libraries
ii libidn11 0.6.5-1 GNU libidn library,
implementation
whois recommends no packages.
-- no debconf information
diff -Nru whois-4.7.15/ip6_del_list whois-4.7.15.new/ip6_del_list
--- whois-4.7.15/ip6_del_list 2006-05-23 15:24:18.000000000 +0300
+++ whois-4.7.15.new/ip6_del_list 2006-08-23 20:01:48.000000000 +0300
@@ -2,6 +2,7 @@
# The parser is very simple-minded and wants the two first components of
# addresses. It does not deal with networks == 0 or > 24 bit.
+2001:0000::/32 teredo
2001:0200::/23 apnic
2001:0400::/23 arin
2001:0600::/23 ripe
diff -Nru whois-4.7.15/make_ip6_del.pl whois-4.7.15.new/make_ip6_del.pl
--- whois-4.7.15/make_ip6_del.pl 2005-01-29 00:15:47.000000000 +0200
+++ whois-4.7.15.new/make_ip6_del.pl 2006-08-23 20:02:44.000000000 +0300
@@ -26,6 +26,8 @@
print $s;
} elsif ($s eq '6to4') {
print "\\x0A";
+ } elsif ($s eq 'teredo') {
+ print "\\x0B";
} elsif ($s eq 'UNALLOCATED') {
print "\\006";
} else {
diff -Nru whois-4.7.15/whois.c whois-4.7.15.new/whois.c
--- whois-4.7.15/whois.c 2006-07-19 13:14:51.000000000 +0300
+++ whois-4.7.15.new/whois.c 2006-08-23 20:04:28.000000000 +0300
@@ -245,6 +245,12 @@
/* XXX should fail if server[0] < ' ' */
qstring = p; /* XXX leak */
break;
+ case 0x0B:
+ p = convert_teredo(qstring);
+ printf(_("\nQuerying for the IPv4 endpoint %s of a Teredo IPv6 address.\n\n"), p);
+ server = whichwhois(p);
+ qstring = p ;
+ break;
default:
break;
}
@@ -836,6 +842,20 @@
return new;
}
+char *convert_teredo(const char *s)
+{
+ char *new = malloc(sizeof("255.255.255.255"));
+ unsigned int a, b;
+
+ if (sscanf(s, "2001:%*[^:]:%*[^:]:%*[^:]:%*[^:]:%*[^:]:%x:%x", &a, &b) != 2)
+ return (char *) "0.0.0.0";
+
+ a ^= 0xffff;
+ b ^= 0xffff;
+ sprintf(new, "%d.%d.%d.%d", a >> 8, a & 0xff, b >> 8, b & 0xff);
+ return new;
+}
+
unsigned long myinet_aton(const char *s)
{
unsigned long a, b, c, d;
diff -Nru whois-4.7.15/whois.h whois-4.7.15.new/whois.h
--- whois-4.7.15/whois.h 2005-04-29 02:26:49.000000000 +0300
+++ whois-4.7.15.new/whois.h 2006-08-23 19:59:33.000000000 +0300
@@ -27,6 +27,7 @@
int domfind(const char *, const char *[]);
char *normalize_domain(const char *);
char *convert_6to4(const char *);
+char *convert_teredo(const char *);
const char *handle_query(const char *server, const char *port,
const char *qstring, const char *fstring);
void split_server_port(const char *const input, const char **server,
pgpN1PDds8q4u.pgp
Description: PGP signature

