Opened 3 years ago

Last modified 18 months ago

#1877 new defect

Test Networks: Check locally supplied addresses for IPv6

Reported by: Obscuratus Owned by: zzz
Priority: minor Milestone: 0.9.28
Component: router/transport Version: 0.9.27
Keywords: Cc:
Parent Tickets: Sensitive: no

Description

This trac ticket is to support local, sand-boxed testing networks running on private, normally unreachable IP addresses.

Normally, for a typical user, I2P will automatically detect the users IPv6 address, and everything works like it it supposed to.

On testing networks operating on private IPv6 address segments, you need to explicitly tell I2P to use the private IPv6 address (on the console network configuration page).

There is a minor nuance in the way IPv6 addresses are provisioned when you explicitly instruct I2P to use an IPv6 address. The _haveIPv6Address variable is not being set correctly. This causes I2P to skip Peer Testing for this IPv6 connection.

In order to test IPv6 peer testing on a testing network, I found I needed to make the following change:

router/transport: Check locally supplied addresses for IPv6

_haveIPv6Address is not being set when a IPv6 address is locally
supplied.

Set it so that IPv6 reachability testing will be performed on
locally supplied IPv6 addresses as long as introducers are not
required.

Signed-off-by: obscuratus <obscuratus@mail.i2p>
---

diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java
index e076f66..a68b318 100644
--- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java
+++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java
@@ -2192,6 +2192,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
                 // via CSFI.createAddresses->TM.getAddresses()->updateAddress()->REA
                 if (allowRebuildRouterInfo)
                     _context.router().rebuildRouterInfo();
+                if (isIPv6 && !introducersRequired)
+                    _haveIPv6Address = true;
             } else {
                 addr = null;
             }

Subtickets

Change History (5)

comment:1 Changed 3 years ago by Obscuratus

Component: unspecifiedrouter/transport
Owner: set to zzz

comment:2 Changed 3 years ago by zzz

Milestone: undecided0.9.28
Status: newinfoneeded_new

That seems to be like the wrong place to put it.
Not sure if externalAddressReceived() is called with SOURCE_CONFIG in your scenario…

would this work?

#
# old_revision [523ce194716673c94865463af6473403e855b301]
#
# patch "router/java/src/net/i2p/router/transport/udp/UDPTransport.java"
#  from [b72465c8fdda3647061004a152fe7130721de082]
#    to [3e0c8afc3cc62a1094f960489cc805108c8f738e]
#
============================================================
--- router/java/src/net/i2p/router/transport/udp/UDPTransport.java	b72465c8fdda3647061004a152fe7130721de082
+++ router/java/src/net/i2p/router/transport/udp/UDPTransport.java	3e0c8afc3cc62a1094f960489cc805108c8f738e
@@ -807,7 +807,7 @@ public class UDPTransport extends Transp
                 _log.warn("Invalid address: " + Addresses.toString(ip, port) + " from: " + source);
             return;
         }
-        if (source == SOURCE_INTERFACE && ip.length == 16) {
+        if ((source == SOURCE_INTERFACE || source == SOURCE_CONFIG) && ip.length == 16) {
             // NOW we can set it, it's a valid v6 address
             // (we don't want to set this for Teredo, 6to4, ...)
             _haveIPv6Address = true;

comment:3 Changed 3 years ago by zzz

No, the above won't work, SOURCE_CONFIG is only used for SSU to send to NTCP.

But how about something near the bottom of startup() - around line 550 or so…

comment:4 Changed 3 years ago by Obscuratus

Status: infoneeded_newnew

OK, I'll look into relocating this change.

I'll start around line 550. That might work.

comment:5 Changed 18 months ago by obscuratus

I apologize for letting this bug repeat languish.

I got lost trying to follow the logic for provisioning the transport addresses, and set the task aside.

Unfortunately, I lost track of this bug report.

So, on to business.

I've run into difficulty trying to find a more appropriate place in the code to conduct the test for _haveIPv6Address in the context of a local testing network.

When examining the location suggested in Comment 3 (around line 550), I've found that I never traverse that section of code during startup when I'm operating on local address in a testing network.

I'm finding that the list of transports provided by getSavedLocalAddresses() is empty when running on a local network, so no addresses are available for evaluation in this section. Local addresses are evaluated with another method.

I have located an alternative location for testing for _haveIPv6Address as shown in the following patch.

If this is not acceptable, it would be fine with me to simply close this bug at this point. It's not a big deal for me to carry this patch locally when building up my test network builds.

@@ -2264,6 +2301,14 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
                     cost--;
                 else if (config == IPV6_NOT_PREFERRED)
                     cost++;
+                // We now know we have an IPv6 address.  When allowLocal() is true
+                // (usually a testing environment), assume _haveIPv6Address is true.
+                if (allowLocal())
+                    _haveIPv6Address = true;
             }
             RouterAddress addr = new RouterAddress(STYLE, options, cost);
Note: See TracTickets for help on using tickets.