Changeset a1fd8f49


Ignore:
Timestamp:
Jul 20, 2016 2:45:29 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5368da2, c73a4a7
Parents:
a213799
Message:

SSU: Increase minimum peers if we have a IPv6 address
Check for 'B' cap for peer test
Fix peer test ip length check logic

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    ra213799 ra1fd8f49  
     12016-07-20 zzz
     2 * SSU:
     3   - Increase minimum peers if we have a IPv6 address
     4   - Check for 'B' cap for peer test
     5   - Fix peer test IP length check
     6
    172016-07-18 zzz
    28 * i2ptunnel: Block 'Proxy' header
  • router/java/src/net/i2p/router/RouterVersion.java

    ra213799 ra1fd8f49  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 6;
     21    public final static long BUILD = 7;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    ra213799 ra1fd8f49  
    17071707
    17081708    /** minimum active peers to maintain IP detection, etc. */
    1709     private static final int MIN_PEERS = 3;
     1709    private static final int MIN_PEERS = 5;
     1710    private static final int MIN_PEERS_IF_HAVE_V6 = 30;
    17101711    /** minimum peers volunteering to be introducers if we need that */
    17111712    private static final int MIN_INTRODUCER_POOL = 5;
     
    17651766                _log.debug("bidding on a message to an unestablished peer: " + to);
    17661767
    1767             // Try to maintain at least 3 peers so we can determine our IP address and
     1768            // Try to maintain at least 5 peers (30 for v6) so we can determine our IP address and
    17681769            // we have a selection to run peer tests with.
    17691770            // If we are firewalled, and we don't have enough peers that volunteered to
     
    17731774            int count = _peersByIdent.size();
    17741775            if (alwaysPreferUDP() || count < MIN_PEERS ||
     1776                (_haveIPv6Address && count < MIN_PEERS_IF_HAVE_V6) ||
    17751777                (introducersRequired() && _introManager.introducerCount() < MIN_INTRODUCER_POOL))
    17761778                return _cachedBid[SLOW_PREFERRED_BID];
     
    32243226            byte[] ip = peer.getRemoteIP();
    32253227            if (peerRole == BOB) {
    3226                 if ((!isIPv6 && ip.length != 4) ||
    3227                     (isIPv6 && ip.length != 16))
    3228                 continue;
     3228                if (isIPv6) {
     3229                    if (ip.length != 16)
     3230                        continue;
     3231                } else {
     3232                    if (ip.length != 4)
     3233                        continue;
     3234                }
    32293235            }
    32303236            // enforce IPv4/v6 advertised for all
     
    32403246            List<RouterAddress> addrs = getTargetAddresses(peerInfo);
    32413247            for (RouterAddress addr : addrs) {
    3242                 ip = addr.getIP();
    3243                 if (ip != null) {
    3244                     if ((!isIPv6 && ip.length != 4) ||
    3245                         (isIPv6 && ip.length != 16))
    3246                     break;
     3248                byte[] rip = addr.getIP();
     3249                if (rip != null) {
     3250                    if (isIPv6) {
     3251                        if (rip.length != 16)
     3252                            continue;
     3253                    } else {
     3254                        if (rip.length != 4)
     3255                            continue;
     3256                    }
     3257                    // as of 0.9.27, we trust the 'B' cap for IPv6
     3258                    String caps = addr.getOption(UDPAddress.PROP_CAPACITY);
     3259                    if (caps != null && caps.contains(CAP_TESTING)) {
     3260                        ip = rip;
     3261                        break;
     3262                    }
    32473263                }
    32483264            }
Note: See TracChangeset for help on using the changeset viewer.