Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2016 09:27:45 +0000 (UTC)
From:      Renato Botelho <garga@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r424752 - in head/net/pear-Net_IPv6: . files
Message-ID:  <201610270927.u9R9RjMr002864@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: garga
Date: Thu Oct 27 09:27:44 2016
New Revision: 424752
URL: https://svnweb.freebsd.org/changeset/ports/424752

Log:
  Import a patch to fix compress("::") calls
  
  Submitted by:	Phil Davis
  Obtained from:	https://github.com/phil-davis/Net_IPv6/commit/638b96a253164b65c63825c38e79812b6c5f448d
  MFH:		2016Q4
  Sponsored by:	Rubicon Communications (Netgate)

Added:
  head/net/pear-Net_IPv6/files/patch-fix_compress   (contents, props changed)
Modified:
  head/net/pear-Net_IPv6/Makefile

Modified: head/net/pear-Net_IPv6/Makefile
==============================================================================
--- head/net/pear-Net_IPv6/Makefile	Thu Oct 27 09:03:54 2016	(r424751)
+++ head/net/pear-Net_IPv6/Makefile	Thu Oct 27 09:27:44 2016	(r424752)
@@ -3,7 +3,7 @@
 
 PORTNAME=	Net_IPv6
 DISTVERSION=	1.3.0.b2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net pear
 DISTNAME=	${PORTNAME}-1.3.0b2
 

Added: head/net/pear-Net_IPv6/files/patch-fix_compress
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/pear-Net_IPv6/files/patch-fix_compress	Thu Oct 27 09:27:44 2016	(r424752)
@@ -0,0 +1,36 @@
+From 638b96a253164b65c63825c38e79812b6c5f448d Mon Sep 17 00:00:00 2001
+From: Phil Davis <phil.davis@inf.org>
+Date: Thu, 27 Oct 2016 13:45:38 +0930
+Subject: [PATCH] Fix compress to "::"
+
+Problem:
+```
+Net_IPv6::compress("0:0:0:0:0:0:0:0");
+```
+returns the empty string.
+
+It should return double-colon "::"
+
+The preg_replace here are over-zealous, in the "::" case, the sring
+starts and ends with ":" and so both get stripped out.
+---
+ Net/IPv6.php | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/Net/IPv6.php b/Net/IPv6.php
+index ba77472..39949d1 100644
+--- Net/IPv6.php
++++ Net/IPv6.php
+@@ -734,8 +734,10 @@ public static function compress($ip, $force = false)
+ 
+         }
+ 
+-        $cip = preg_replace('/((^:)|(:$))/', '', $cip);
+-        $cip = preg_replace('/((^:)|(:$))/', '::', $cip);
++        if ($cip != "::") {
++            $cip = preg_replace('/((^:)|(:$))/', '', $cip);
++            $cip = preg_replace('/((^:)|(:$))/', '::', $cip);
++        }
+ 
+         if ('' != $netmask) {
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610270927.u9R9RjMr002864>