diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-06-30 00:00:24 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-06-30 00:00:24 -0500 |
commit | 7685fd4eced7e122ee151eb281523594f0c1d7d1 (patch) | |
tree | 7c882047bb17eb9ec71aff37f8247d132bdc8063 /src | |
parent | bb5d3a43f9c7beca6b9aa89696dbaae9a916a409 (diff) | |
parent | 7e9349a59c653668ab024d7e2e7f81667fb81cdb (diff) | |
download | pfsense-7685fd4eced7e122ee151eb281523594f0c1d7d1.zip pfsense-7685fd4eced7e122ee151eb281523594f0c1d7d1.tar.gz |
Merge pull request #3029 from phil-davis/IPv6colons
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/IPv6.inc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/etc/inc/IPv6.inc b/src/etc/inc/IPv6.inc index 815de65..d297ed1 100644 --- a/src/etc/inc/IPv6.inc +++ b/src/etc/inc/IPv6.inc @@ -557,7 +557,7 @@ class Net_IPv6 if (false !== strpos($uip, '::') ) { - list($ip1, $ip2) = explode('::', $uip); + list($ip1, $ip2, $ip3) = explode('::', $uip); if ("" == $ip1) { @@ -606,21 +606,27 @@ class Net_IPv6 $uip = "0:0:0:0:0:0:0:0"; + if (isset($ip3)) { // ::::xxx - not good + if ("" == $ip3) { // :::: + $ip3 = 0; // Give back a 9th "0" + } + $uip .= ":" . $ip3; + } + } else if (-1 == $c1) { // ::xxx - $fill = str_repeat('0:', 7-$c2); + $fill = str_repeat('0:', max(1, 7-$c2)); $uip = str_replace('::', $fill, $uip); } else if (-1 == $c2) { // xxx:: - $fill = str_repeat(':0', 7-$c1); + $fill = str_repeat(':0', max(1, 7-$c1)); $uip = str_replace('::', $fill, $uip); } else { // xxx::xxx - $fill = str_repeat(':0:', max(1, 6-$c2-$c1)); + $fill = ':' . str_repeat('0:', max(1, 6-$c2-$c1)); $uip = str_replace('::', $fill, $uip); - $uip = str_replace('::', ':', $uip); } } @@ -921,7 +927,7 @@ class Net_IPv6 } - if (8 == $count) { + if (8 == $count and empty($ipPart[1])) { return true; |