Skip Menu |
 

This queue is for tickets about the Net-IP CPAN distribution.

Report information
The Basics
Id: 71042
Status: resolved
Priority: 0/
Queue: Net-IP

People
Owner: Nobody in particular
Requestors: dmitry.kurochkin [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.26



From dmitry.kurochkin [...] gmail.com Sat Sep 17 20: 14:05 2011
MIME-Version: 1.0
X-Spam-Status: No, score=-6.199 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, NORMAL_HTTP_TO_IP=0.001, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779, T_TO_NO_BRKTS_FREEMAIL=0.01, T_TVD_MIME_NO_HEADERS=0.01] autolearn=ham
X-Spam-Flag: NO
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
Content-Type: multipart/mixed; boundary="=-=-="
Message-ID: <87ty8aso4x.fsf [...] gmail.com>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -6.199
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id BC37924097E for <cpan-bug+Net-IP [...] hipster.bestpractical.com>; Sat, 17 Sep 2011 20:14:05 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u55rSsw2Lwg0 for <cpan-bug+Net-IP [...] hipster.bestpractical.com>; Sat, 17 Sep 2011 20:14:04 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 4815B24089D for <bug-Net-IP [...] rt.cpan.org>; Sat, 17 Sep 2011 20:14:04 -0400 (EDT)
Received: (qmail 16711 invoked by uid 103); 18 Sep 2011 00:14:03 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 18 Sep 2011 00:14:03 -0000
Received: from mail-bw0-f50.google.com (HELO mail-bw0-f50.google.com) (209.85.214.50) by 16.mx.develooper.com (qpsmtpd/0.80/v0.80-19-gf52d165) with ESMTP; Sat, 17 Sep 2011 17:14:00 -0700
Received: by bkbzt19 with SMTP id zt19so4129273bkb.9 for <bug-Net-IP [...] rt.cpan.org>; Sat, 17 Sep 2011 17:13:57 -0700 (PDT)
Received: by 10.204.139.204 with SMTP id f12mr579101bku.263.1316304836935; Sat, 17 Sep 2011 17:13:56 -0700 (PDT)
Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id z9sm9929373bkn.7.2011.09.17.17.13.55 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 17 Sep 2011 17:13:56 -0700 (PDT)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Delivered-To: cpan-bug+Net-IP [...] hipster.bestpractical.com
Subject: ip_reverse incorrect result for many IPv6 addresses
User-Agent: Notmuch/0.8-27-g706f431 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu)
Return-Path: <dmitry.kurochkin [...] gmail.com>
X-RT-Mail-Extension: net-ip
X-Original-To: cpan-bug+Net-IP [...] hipster.bestpractical.com
X-Spam-Check-BY: 16.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:user-agent:date:message-id:mime-version :content-type; bh=XXBasfgJRC8z2gzbYC6gjbGrQ4QnJEkWjFS5AArAZOE=; b=wKZv9OeUlkwyikdV/PACUDTuLTXHymUO0MqetpoDCE1NUoqWLMSQLGEiDWA+kaF+Cy ldgLEYElOcgR9UTTBYjowddwrUzdzsj9K0aT0DHBx9jYFnxY58XsSGY2jiirDSmX2kRx yoCRg2s3cKFM9GaORQOAutZ5HiscrAsLvG8+g=
Date: Sun, 18 Sep 2011 04:14:06 +0400
X-Spam-Level:
To: bug-Net-IP [...] rt.cpan.org
From: Dmitry Kurochkin <dmitry.kurochkin [...] gmail.com>
Content-Length: 0
X-RT-Original-Encoding: ascii
content-type: text/plain; charset="utf-8"
Content-Length: 459
Download (untitled) / with headers
text/plain 459b
Hello. Net::IP::ip_reverse() produces incorrect results for many IPv6 addresses, e.g. ip_reverse("2001:4f8:3:36:0:0:0:235", 128, 6) returns: 5.3.2.0.0.0.6.3.3.8.f.4.1.0.0.2.ip6.arpa. While expected result is: 5.3.2.0.0.0.0.0.0.0.0.0.0.0.0.0.6.3.0.0.3.0.0.0.8.f.4.0.1.0.0.2.ip6.arpa. Attached patch for Net::IP v1.25 fixes the problem. Note: I am not very good at Perl so there may be a more elegant/efficient way to fix this. Regards, Dmitry
Content-Type: text/x-diff
content-disposition: inline; filename="ipv6-reverse.patch"
Content-Length: 1451
Download ipv6-reverse.patch
text/x-diff 1.4k
--- a/IP.pm 2006-05-24 22:35:23.000000000 +0400 +++ b/IP.pm 2011-09-18 04:09:19.338849625 +0400 @@ -1766,42 +1766,43 @@ $ERRNO = 101; return; } if ($ip_version == 4) { my @quads = split /\./, $ip; my $no_quads = ($len / 8); my @reverse_quads = reverse @quads; while (@reverse_quads and $reverse_quads[0] == 0) { shift(@reverse_quads); } return join '.', @reverse_quads, 'in-addr', 'arpa.'; } elsif ($ip_version == 6) { my @rev_groups = reverse split /:/, $ip; my @result; - foreach (@rev_groups) { - my @revhex = reverse split //; + foreach my $a (@rev_groups) { + $a = sprintf "%04s", $a; + my @revhex = reverse split //, $a; push @result, @revhex; } # This takes the zone above if it's not exactly on a nibble my $first_nibble_index = $len ? 32 - (int($len / 4)) : 0; return join '.', @result[ $first_nibble_index .. $#result ], 'ip6', 'arpa.'; } } #------------------------------------------------------------------------------ # Subroutine ip_normalize # Purpose : Normalize data to a range of IP addresses # Params : IP or prefix or range # Returns : ip1, ip2 (if range) or undef (error) sub ip_normalize { my ($data) = shift; my $ipversion;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.