[TYPO3-core] RFC: Bug 331: Support IPv6 addresses

Michael Stucki michael at typo3.org
Wed Mar 8 18:47:05 CET 2006


Hi Bernhard,

please notice that I have already committed my proposed change to CVS.

I didn't have a closer look to your comment and the patch but as it seems
you are really familar with it, and so I'm sure you have tested it very
well :-)

+1

Michael

Bernhard Kraft wrote:

> Franz Holzinger wrote:
> 
>> It's not so easy to find with Google because you have 100 000 matches.
>> 
>> http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/x439.html
> 
> thx. tldp.org is what I used.
> 
> 
>> You have changed interface of the original function and allow a wildcard.
> 
> Yes. As those wildcards are already there for IPv4 I think we should keep
> it that "*" matches a whole "subpart" of an IP either v4 or v6.
> 
> 
>>>I do comparison and masking by using boolean arithmetic. just simple
>>>shifts and bit-wise &'s.
>>>
>>>I also changed cmpIPv4 to this style ... I tought it would be much faster
>>>but only about 2%. does that count :?
>>>
>>>
>>> 
>>>
>> 
>> I do not understand why your version of the validIPv6Addr function
>> should be faster to put the ip into an array and call the regexp in a
>> loop. Here you  did not use bit shifts or bitwise '&'.
> 
> Ok. The cmpIPv6 routine works the following way:
> 
> When an IP-Mask which hasn't a mask gets encountered the "old-school"
> match-algorythm where ever full IP-part of the IP-to-check (separated by
> :) is checked against the single parts of the current IP from the list to
> check against.
> 
> When now an IP with mask is encountered the number of bit's the mask has
> is put into an variable. and a loop get's run through for each single part
> of the IP: 1. When the mask still has more or equal than 16-bits this
> means that the full current part has to get compared (each part has 2bytes
> = 16bit). 2. When the mask has less than 16-bit I do the boolean-magic
> again:
>               $maskInt = ~((1<<(16-$mask))-1) & 0xffff;
>               if (($testI & $maskInt)!=($baseParts[$x] & $maskInt)) {
> But this time for single 16-bit values and not for a whole 32-bit value
> like IPv4 is.
> 
> I can't do ONE compare of the list-value to the test-value cause those
> addresses are 128-bit long. I could split them up in 4x32bit checks but
> that would almost be the same as the current 8x16bit checks.
> 
> I think it's faster than you code because you have this IPv6 Hex2bin ...
> and I think this one is not really fast. I do a compare right now ... a
> moment please ....
> 
> ok. result: i can't compare them. you version franz, doesn't seem to
> properly expand the "::" - shortcut. "::" means that this space has to get
> filled with "0000" IP elements - howmany there are required to have an
> 8x16-bit IP address.
> 
> Just one example of the attached output of my test-program:
> 
> The IPv6 Address "4030:00bc:0000:00a4:0267:01ff:fe01:7352" didn't match
> "4030:00bc::/48" altough it should !
> 
> 4030:00bc::/48 would be:
> 4030:00bc:0000:0000::0000:0000:0000:0000 / 48
> 
> and 48 bits are 16 * 3 =
> 
> 4030:00bc:0000
> 
> and this of course matches the first part (first 3 elements) of
> "4030:00bc:0000:00a4:0267:01ff:fe01:7352".
> 
> 
> In the output rather not look at the:
> Negatively failed negative test :
> lines they are just a result of testing if the cmpIP method works also
> with lists of IP's properly.
> 
> 
> greets,
> Bernhard

-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/



More information about the TYPO3-team-core mailing list