vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Miscellaneous Hacks - IPV6 Support in VB3 (https://vborg.vbsupport.ru/showthread.php?t=219711)

wootalyzer 07-28-2009 10:00 PM

IPV6 Support in VB3
 
1 Attachment(s)
UPDATE - This mod works with vBulletin 3 AND vBulletin 4!

About

Ok, so let's get started. Got a web server that resolves IP addresses as ipv6? Don't want to remove that ipv6 functionality just so vBulletin will work well? Well, this mod will take care of all of that for you.

How it works

vBulletin 3 and 4 are (from a coding standpoint) completely reliant upon ipv4. Classes are coded all over the place which expect addresses to be in ipv4 format. This mod runs before ANYTHING in vB gets a chance to load and does the following:

- If the address is in ipv4-over-ipv6 format, it simply dumps the ipv4 portion of the address into vbulletin. Done. Simple as pie.
- If the address is in standard ipv6 format (it's a real ipv6 address), it generates a "psudo-ipv4" address to represent the ipv6 address. This "psudo-ipv4" address is in a reserved ipv4 address space, so it shouldn't interfere with any of the real ipv4 addresses, and is generated from a hash of the ipv6 address (so each of the ipv6 addresses should hopefully resolve to their own, unique ipv4 address).

And... that's about it! vB continues on it's merry way treating everyone's ip as a standard ipv4 address.

WATCH OUT!

See someone on your forum with an IP address starting in 204. after installing this mod? That means they are actually accessing your site via an ipv6 address, and the address LISTED doesn't really mean anything.

Installation

Not scared about what we just covered? Good, let's get started.

1. Upload ipv6_fix.php to your forum/includes directory.
2. Edit your includes/init.php file (VERY carefully)

Find

Code:

require_once(CWD . '/includes/class_core.php');
And insert JUST ABOVE IT

Code:

require_once(CWD . '/includes/ipv6_fix.php');
3. Every time you upgrade vB, repeat step 2.

And you're done!

This mod should have no effect if your web server is handling connections as ipv4 addresses. [S]This mod is no replacement for the REAL ipv6 support coming in vB4, so upgrade as soon as it is released![/S] Looks like ipv6 didn't make it into vB4 either -- On lives the mod!

Have fun :)

flapjack 07-29-2009 08:30 AM

Nifty little code, actually.

I don't know anyone who's using ipv6 yet, so it's no use to me, but I thought I'd give you kudos for working on this. :)

accludetuner 11-09-2009 12:56 AM

IPv6 is right around the corner. Installing now. Thanks ;)

heugabel 09-11-2010 03:07 PM

thank you

digibyte 10-15-2010 10:25 AM

Vote for IPv6 support in vBulletin: http://tracker.vbulletin.com/browse/VBIV-9397

PossumX 02-05-2011 09:40 AM

Quote:

Originally Posted by digibyte (Post 2110340)
Vote for IPv6 support in vBulletin: http://tracker.vbulletin.com/browse/VBIV-9397

Well, now they may do something about this, but, then again, who knows. Until supported natively by vB4, I have installed this simple work around. Thanks!!

Oh yeah, click on the vB tracker link and VOTE, as the fact that this has yet to even be scheduled (or at least planned to be) seems a bit inane for the "...largest international developer and distributor of proprietary community bulletin board software." (quoted from IB's site: http://www.internetbrands.com/our-brands/licensing/ )

Monarch.V 02-05-2011 10:41 AM

:up: Thanks

traen 02-06-2011 02:35 PM

Installed on 4.1.1 thanks.

empire10 05-24-2012 06:47 PM

Unfortunately this does not work anymore in 4.2. Is there any other workaround to use?

GHDpro 05-31-2012 12:40 PM

Quote:

Originally Posted by empire10 (Post 2332446)
Unfortunately this does not work anymore in 4.2. Is there any other workaround to use?

I've just hacked together the following, which seems to be working (in vB 4.2):

PHP Code:

function FixIPv6($ip) {
  
// No colon = No IPv6 (return unaltered)
  
if (stristr($ip,':') === false)
    return 
$ip;
  
// Remove IPv6 encapsulation from IPv4 address
  
if (strtolower(substr($ip,0,7)) == '::ffff:')
    return 
substr($ip,7);
  
// Else: Pack IPv6 address into IPv4 address
  
$crc sprintf('%x',crc32($ip));
  
$b ord(pack('H*',substr($crc,0,2)));
  
$c ord(pack('H*',substr($crc,2,2)));
  
$d ord(pack('H*',substr($crc,4,2)));
  
$ip '10.'.$b.'.'.$c.'.'.$d;
  return 
$ip;
}

$_SERVER['REMOTE_ADDR'] = FixIPv6($_SERVER['REMOTE_ADDR']);
$this->ipaddress FixIPv6($this->ipaddress); 


Put above code somewhere in /includes/config.php (the normal vB config file), for example just before the last line (with ?>).

Warning: you might want to make a backup of the config file as messing up editing it will probably cause your forum to stop loading (just blank pages).

I'm also not 100% sure if putting the hack in config.php is quite the right location, as ideally it should of course be run before any vB code that uses IP addresses. But (in v4.2) at least the config file is included (executed) right before the IPADDRESS constant is defined (from the $this->ipaddress variable), so it should work alright.

My main motivation for trying to put it in the config file is that you can now easily upgrade your forum without the need to re-apply the hacks to init.php (which the plugin does require every time).

Note that in my solution I've changed the way IPv6 addresses are encoded; so encoded IPv6 will not look the same as the plugin.

matrex722 05-31-2012 10:55 PM

installed 3.8.7
thanks

Chris8 05-30-2013 08:26 PM

So, what are the pros of doing this?

Zachery 05-31-2013 04:06 AM

For the record, vBulletin operates just fine with a server running ipv6.

AusPhotography 11-14-2013 08:23 AM

To fix this mod for vB 4.2 change the code as follows: (added %256 on 3 lines)
PHP Code:

function ipv6_to_ipv4($input) {
    
// Create a fake ipv4 address
    // that will "represent" the given
    // ipv6 address
    
$hash abs(crc32($input));
    if(
$hash 100000000$hash += 100000000;
    
$num1 intval(substr($hash03))%256;
    
$num2 intval(substr($hash33))%256;
    
$num3 intval(substr($hash63))%256;
    return 
"224." .$num1"." .$num2"." .$num3;



AusPhotography 11-16-2013 04:02 AM

WHM/cPanel 11.40.0.19 now supports IPv6

Here are some useful links...

Release notes
http://docs.cpanel.net/twiki/bin/vie...easeNotes#IPv6

Blog... (video how to)
http://blog.cpanel.net/ipv6-update/

Instructions...
http://docs.cpanel.net/twiki/bin/vie...ocs/EnableIpv6

I've setup to use IPv6 using WHM/cPanel 11.40.0.19 on a XEN Virtual server
http://www.ausphotography.net.au
IP 4/6 displays in page footer

TMM-TT 06-30-2014 09:52 AM

The actual problem seems to be a very simple variable in core - SESSION_HOST, at least for the "who's online"-part. Or are there more different methods that has to be changed also?

I have described the problem here: https://tornevall.net/forum/showthre...9-ipv6-support.


All times are GMT. The time now is 05:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01208 seconds
  • Memory Usage 1,771KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete