On Dec 13, 2010, at 3:05 PM, S.P.Zeidler wrote:
>> ... until you would provide TECHNICAL REASONS showing how (a) ..., or some
>> revised rules, would ensure address-mapping reversibility, it is legitimate
>> to doubt, as I do, that your new proposal works in all identified cases.
>
> It's math. Doubt or opinion should not be involved.
Remi:
If you would like, I can send you the code I tested this with. However, lest
there be a bug in my code, may I suggest you try it for yourself?
Here are some subroutines you may find helpful:
/*
* return number1 + number2
*/
unsigned short
add1(number1, number2)
unsigned short number1;
unsigned short number2;
{
unsigned int result;
result = number1;
result += number2;
while (0xFFFF < result) {
result = result + 1 - 0x10000;
}
return result;
}
/*
* return number1 - number2
*/
unsigned short
sub1(number1, number2)
unsigned short number1;
unsigned short number2;
{
return add1(number1, ~number2);
}
unsigned short
sum1(numbers, count)
unsigned short *numbers;
int count;
{
unsigned int result;
result = *numbers++;
while (--count > 0) {
result += *numbers++;
}
while (0xFFFF < result) {
result = result + 1 - 0x10000;
}
return result;
}
I would have written those to test for "0xFFFF <= result", which would have the
coercion to the 0x0000 form of a one's complement zero (0xFFFF+1-0x10000 =
0x0000), but I wanted to do that explicitly for control purposes.
Now, pick two prefixes, any two you like. I used
unsigned short inner_init[] = {0xFD01, 0x0203, 0x0405, 1, 2, 3, 4, 5};
unsigned short outer_init[] = {0x2001, 0x0db8, 0x0001, 1, 2, 3, 4, 5};
for values in 0..0xFFFF, substitute the numbers into any of the first three
words (bits 0..47) of the addresses, and use the algorithm specified in the
note to convert the inner prefix to the outer prefix and then back to the inner
prefix. Check that the checksum is still correct, and flag it if it isn't.
I think you'll find that if you do the substitution, when the word you are
updating starts with 0xFFFF, you can't predictably get it back to 0xFFFF. Any
value from 0x0000 to 0xFFFE is perfectly reversible, though. I'll let you work
out the reason why.
I'll post a new version tomorrow. I got some comments from Ralph Droms, which I
will edit in, and I'll put the code for my test in an appendix.
_______________________________________________
nat66 mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/nat66