[Outdated] IPv6 support

Started by SleePy, June 29, 2011, 03:25:36 PM

Previous topic - Next topic

SleePy

Link to the mod

IPv6 support for SMF 2.0+ Only.

SMF 2.1 Upgrades are not compatible with this and will cause all the IPv6s to be loss during the upgrade.

This customization will add support for the IPv6 enabled clients in SMF 2.0.  Specifically posts, ip tracking and ban management have been changed.  Member search from the admin panel does support this by default.

Due to the size and necessity of the changes, please do not continue with installation if any change should fail the test.  This may lead to unexpected results or a unusable forum.

Note: During uninstallation, all IPv6 enabled bans will be disabled.  This customization makes attempts to track those changes in columns it adds to the ban_items table.  If you remove the database changes, this tracking will be lost.  In addition upon reinstallation this customization makes attempts to re-enable those bans that should still be active.

Note: Currently you are unable to link via iurl/url or auto linking ipv6 urls.  This is due to the square brackets that ipv6 addresses are enclosed in.  However this doesn't affect domains.

Thanks to Ray Soucy's for his IPv6 functions he wrote and allowing usage of them in this customization.

This mod is open source at GitHub!.  See the source code, fork the project, suggest improvements and download old versions.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

butchs

Nice mod.  I look forward to trying this mod.

One question:  How would another mod be able to check when ipv6 is being handled by the mod? Would it be noticeable somewhere?
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

SleePy

Is there any mod that explicitly handles IPs in a non normal way?  Unlike ban management, most other IP storing should be in a proper sized data set. Other than that, you could do a ipv6 regex check.  For simple checks you could just test to see if : exists in the ip address.   SMF does validate that the IP address is a valid IPv4 and this mod validates a IPv6 address.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Stevenn

8.   Add Before   ./Sources/QueryString.php   Test failed

Help? I really need IPv6 for my site (:

SleePy

Hello,
Do you have any other mods installed?

If you click on the arrow on the left, see which one of the edits on that file is failing, then click the edit icon.  That should give me information about what code it can't find.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

yellowgoat

Quote from: SleePy on August 30, 2011, 05:18:17 PM
Hello,
Do you have any other mods installed?

If you click on the arrow on the left, see which one of the edits on that file is failing, then click the edit icon.  That should give me information about what code it can't find.

Had the same issue.  It couldn't find
?>
on the final modification of  ./Sources/QueryString.php which inserted the functions.  Perfectly clean install.  This was the first mod I attempted to add.

Fisch.666

#6
Hi!

I've installed this mod on my smf 2.0.1 / portamx 1.4.5 without an error in the package manager ang got this SQL Error:

Quote
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BETWEEN bi.ip_low2 AND bi.ip_high2)
AND ( BETWEEN bi.ip_low3 AND bi.ip_hi' at line 7
File: /Sources/Security.php
Line: 344

After revert the Security.php back my page works again. Any ideas how i can fix this?

Thanks in advance for a reply.

*Edit*

Ah, and there is a small typo in the install file for the Security.php. This:


<?php


is replaced by this:


c<?php


which makes no sense.

SleePy

I don't know how that c before <?php would of gotten there.  I make no such edit in the mod.  However removing it I don't think will fix the issue.  Looks like a query has gone wrong in that file.  Do you have that file before you reverted it?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Fisch.666

Hi!

Thanks for your reply. I've attached the file before the revert, but i think this should be correct.

The c before the <?php seems to be a typo in the install file. If you parse the mod on:

http://custom.simplemachines.org/mods/index.php?mod=3051

for 2.0 and 2.0.1 you get this edit in for the Security.php

SleePy

I repackaged the mod and reuploaded it.  See if that provides any better luck.  I can't find that stray c in my repository anywhere. https://github.com/jdarwood007/smfmod_ipv6
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

eric1234

Installed. So how can i know that my site is supported with ipv6? Is there any sign that tell my forum is supported ipv6 so that i can convince my members? :)

SleePy

#11
You would have to ask your host if the server you are on is IPv6 enabled and then you would need to add a AAAA to your dns for that IPv6 address.  If you maintain your DNS records with your host, they would be able to do that if the box you are on is IPv6 capable.
If you have a VPS or dedicated server, you could setup a tunnel if your host doesn't support IPv6 yet. tunnelbroker.net is what I use to tunnel to IPv6 from my home connection since my ISP doesn't support IPv6 yet.  I've got that configured on my router so all my network computers can use IPv6.  The process is the same for setting it up on your VPS/dedicated.  Just need to configure it on the server instead.  Your OS/distro and network setup will depend on how you modify the network configurations to set that up.

This mod only makes it so SMF knows how to understand and handle IPv6 addresses.  It can't change what isn't enabled/setup on the server and DNS itself.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

eric1234

Quote from: SleePy on January 15, 2012, 12:58:29 PM
You would have to ask your host if the server you are on is IPv6 enabled and then you would need to add a AAAA to your dns for that IPv6 address.  If you maintain your DNS records with your host, they would be able to do that if the box you are on is IPv6 capable.
If you have a VPS or dedicated server, you could setup a tunnel if your host doesn't support IPv6 yet. tunnelbroker.net is what I use to tunnel to IPv6 from my home connection since my ISP doesn't support IPv6 yet.  I've got that configured on my router so all my network computers can use IPv6.  The process is the same for setting it up on your VPS/dedicated.  Just need to configure it on the server instead.  Your OS/distro and network setup will depend on how you modify the network configurations to set that up.

This mod only makes it so SMF knows how to understand and handle IPv6 addresses.  It can't change what isn't enabled/setup on the server and DNS itself.
I see. I will confirm with my host. So if my host's server is not ready for ipv6, then what we shall do?

SleePy

You won't be able to make use of the feature this mod adds.

As I said though, if you have a VPS or dedicated server, you can setup a IPv6 tunnel between your server and your IPv6 broker.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

gamerzworld

Getting a "The database value you're trying to insert does not exist: ip_low5" when trying to add a regular IPv4 ban and IPv6 bans do not show an IP address in the trigger list when added. Looking at the database, all bans have a value of 1 for is_ipv6 and even IPv6 bans have just a single 0 for each IPv6 address set. Also, the uninstaller for the database just gives me an error of "Database error, given array of integer values is empty. (bans)". I'm running SMF 2.0.2.

SleePy

Hmm, looks like the ip2range function is causing this.

Open Subs.php and find:


return $ip_array;
}

// Lookup an IP; try shell_exec first because we can do a timeout on it.
function host_from_ip($ip)


Is there this code before that?:



// Makes it simpiler to work with.
$ip_array[5] = array('low' => 0, 'high' => 0);
$ip_array[6] = array('low' => 0, 'high' => 0);
$ip_array[7] = array('low' => 0, 'high' => 0);
$ip_array[8] = array('low' => 0, 'high' => 0);
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

supersasho

Hi, i've got a similar problem like user Fish.666. When i try to install this mod there's an error with ./Sources/QueryString.php. Any ideas?


Code: (Find) [Select]

?>


Code: (Add Before) [Select]

// Working with them as if they where IPv4 numbers, makes it SMF compatible.
function smf_ipv6_to_ints($ip)
{
   // Expand the IP out.
   $ip = explode(':', smf_ipv6_expand($ip));

   $new_ip = array();
   foreach ($ip as $int)
      $new_ip[] = hexdec($int);

   return implode($new_ip, '-');
}


/**
* IPv6 Address Functions for PHP
*
* Functions to manipulate IPv6 addresses for PHP
*
* Copyright (C) 2009 Ray Patrick Soucy
*
* LICENSE:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/ [nofollow]>.
*
* @package   inet6
* @author    Ray Soucy <[email protected]>
* @version   1.0.1
* @copyright 2009 Ray Patrick Soucy
* @link      http://www.soucy.org/ [nofollow]
* @license   GNU General Public License version 3 or later
* @since     File available since Release 1.0.1
*/
function smf_ipv6_expand($addr, $strict_check = true)
{
   /* Check if there are segments missing, insert if necessary */
   if (strpos($addr, '::') !== false)
   {
      $part = explode('::', $addr);
      $part[0] = explode(':', $part[0]);
      $part[1] = explode(':', $part[1]);
      $missing = array();
      for ($i = 0; $i < (8 - (count($part[0]) + count($part[1]))); $i++)
         array_push($missing, '0000');
      $missing = array_merge($part[0], $missing);
      $part = array_merge($missing, $part[1]);
   }
   else
      $part = explode(":", $addr);

   /* Pad each segment until it has 4 digits */
   foreach ($part as &$p)
      while (strlen($p) < 4)
         $p = '0' . $p;

   unset($p);

    /* Join segments */
   $result = implode(':', $part);

   /* Quick check to make sure the length is as expected */
   if (!$strict_check || strlen($result) == 39)
      return $result;
   else
      return false;
}

SleePy

I've updated that mod.  Its possibly a bug with how it was searching for the end of that file.  I've changed it to use the appropriate method.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

BaghdadGhost

Hi Sleepy,

forgive me for the question.

you stated that this mod changes the way ban members. so does it makes it better for admins?

I am not a pro in technology, but as far as I understand a lot of my members are from countries where they use internet providers with IPv6 and when I ban someone by IP usually effect other members. unlike here in the states where each one has a unique ip address.

will this mod help me controlling those members better in term of ban?

I have to ask my host first about the requirements you mentioned in one of your replies.

thanks in advance.

 

BaghdadGhost

oh forgot one thing

does this mod have anything to do with this site


http://ipv6-test.com/validate.php


Advertisement: