Changeset 7197d22 for router


Ignore:
Timestamp:
Nov 4, 2016 1:44:24 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
84335195
Parents:
b77c4c67
Message:

Transports: New config option i2np.allowLocal,
replaces i2np.udp.allowLocal and i2np.ntcp.allowLocal,
fixes test networks (ticket #1875)

Location:
router/java
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/MultiRouter.java

    rb77c4c67 r7197d22  
    194194        props.setProperty("i2np.ntcp.port", BASE_PORT + id + "");
    195195        props.setProperty("i2np.udp.port", BASE_PORT + id + "");
    196         props.setProperty("i2np.ntcp.allowLocal", "true");
    197         props.setProperty("i2np.udp.allowLocal", "true");
     196        props.setProperty("i2np.allowLocal", "true");
    198197        props.setProperty("i2np.udp.internalPort", BASE_PORT + id + "");
    199198        props.setProperty("i2cp.port", Integer.toString((BASE_PORT + nbrRouters + id)));   
  • router/java/src/net/i2p/router/transport/TransportImpl.java

    rb77c4c67 r7197d22  
    945945
    946946    /**
     947     * Are we allowed to connect to local addresses?
     948     *
     949     * @since 0.9.28 moved from UDPTransport
     950     */
     951    protected boolean allowLocal() {
     952        return _context.getBooleanProperty("i2np.allowLocal");
     953    }
     954
     955    /**
    947956     * IP of the peer from the last connection (in or out, any transport).
    948957     *
  • router/java/src/net/i2p/router/transport/TransportUtil.java

    rb77c4c67 r7197d22  
    1414import java.util.Map;
    1515
     16import net.i2p.I2PAppContext;
    1617import net.i2p.data.router.RouterAddress;
    1718import net.i2p.router.RouterContext;
     
    132133     */
    133134    public static boolean isPubliclyRoutable(byte addr[], boolean allowIPv4, boolean allowIPv6) {
     135        if (I2PAppContext.getGlobalContext().getBooleanProperty("i2np.allowLocal"))
     136            return true;
    134137        if (addr.length == 4) {
    135138            if (!allowIPv4)
  • router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java

    rb77c4c67 r7197d22  
    437437            }
    438438            if (!isValid(ip)) {
    439                 if (! _context.getBooleanProperty("i2np.ntcp.allowLocal")) {
     439                if (! allowLocal()) {
    440440                    //_context.statManager().addRateData("ntcp.bidRejectedLocalAddress", 1);
    441441                    //if (_log.shouldLog(Log.DEBUG))
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    rb77c4c67 r7197d22  
    10941094        return allowLocal();
    10951095    }
    1096    
    1097     /**
    1098      * Are we allowed to connect to local addresses?
    1099      *
    1100      * @since IPv6
    1101      */
    1102     boolean allowLocal() {
    1103         return _context.getBooleanProperty("i2np.udp.allowLocal");
    1104     }
    1105    
     1096
    11061097    /**
    11071098     *  Was true before 0.9.2
  • router/java/test/junit/net/i2p/router/SSUDemo.java

    rb77c4c67 r7197d22  
    6565        // allow 127.0.0.1/10.0.0.1/etc (useful for testing).  If this is false,
    6666        // peers who say they're on an invalid IP are banlisted
    67         envProps.setProperty("i2np.udp.allowLocal", "true");
    68         envProps.setProperty("i2np.ntcp.allowLocal", "true");
     67        envProps.setProperty("i2np.allowLocal", "true");
    6968        // IPv6
    7069        envProps.setProperty("i2np.udp.ipv6", "enable");
Note: See TracChangeset for help on using the changeset viewer.