Recently, I went on a tear updating my Perl modules on CPAN to support IPv6. Since my modules (and scripts) rely on other core modules like Socket, IO::Socket and some non core modules like Net::SNMP and Net::Telnet(::Cisco), I had a task to make sure the underlying modules supported IPv6.
I already dealt with IPv6 in the core Socket module for Windows in a previous post. So now to deal with a higher level of code written by other developers. Would they be responsive?
Turns out ... YES! I worked with the author of Net::TFTPd a while back to get an ASCII / BIN mode bug fix submitted and he was again very responsive with my IPv6 ask and patch. So IPv6 capable TFTP server - Perl has one!
I also rely on Net::Telnet::Cisco which uses Net::Telnet to do all the heavy lifting. Net::Telnet looked like it hadn't been updated since 2002 but I submitted the query / patch and contacted the author. In a few days he got back to me and we had a pretty detailed dialogue about adding IPv6 support. There may be a coming version which does this "natively", but imagine my surprise when I found Net::Telnet was already IPv6-capable!
The "workaround" - and as workarounds go, this is the least kludgey I've seen - goes like this:
Open a socket using an IPv6 capable module - like IO::Socket::IP:
use IO::Socket::IP -register; my $socket = IO::Socket::IP->new( PeerHost => '192.168.10.1' # or 2001:db8:192:168::10:1 PeerPort => 23, Family => AF_INET # or AF_INET6 ) or die "not connected\n";
Then, use the $socket handle as an argument to the 'fhopen' parameter in the Net::Telnet new() constructor:
my $session = Net::Telnet->new( fhopen => $socket );
Jay Rogers (Net::Telnet author) is obviously a genius providing IPv6 support in Net::Telnet before Perl core even supported IPv6! Ok, maybe that's a stretch, but certainly the openness of the Net::Telnet API allows for this kind of "plug-and-play" with IPv4/v6 sockets and enables IPv6 right now, while in the background "native" support may be coming.
Thanks Jay!
No comments :
Post a Comment