Changeset 2a681608


Ignore:
Timestamp:
Nov 22, 2014 2:05:06 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3ef89f4
Parents:
a52c06a6
Message:

PeerSelector?: If non-DSA, don't use incompatible peers
for exploratory tunnels or closest-hop in client tunnels

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    ra52c06a6 r2a681608  
     12014-11-22 zzz
     2 * PeerSelector: If non-DSA, don't use incompatible peers
     3   for exploratory tunnels or closest-hop in client tunnels
     4
     52014-11-17 zzz
     6 * NetDB: Exclude A1/A2 "countries" from auto-floodfill
     7
     82014-11-15 zzz
     9 * I2NP:
     10   - Set lookup type flags even if no reply tunnel specified
     11   - Reduce object churn when writing some messages
     12
    1132014-11-13 zzz
    214 * I2PTunnel:
  • router/java/src/net/i2p/router/RouterVersion.java

    ra52c06a6 r2a681608  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 7;
     21    public final static long BUILD = 8;
    2222
    2323    /** for example "-test" */
    24     public final static String EXTRA = "";
     24    public final static String EXTRA = "-rc";
    2525    public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
    2626    public static void main(String args[]) {
  • router/java/src/net/i2p/router/tunnel/pool/ClientPeerSelector.java

    ra52c06a6 r2a681608  
    3737            Set<Hash> matches = new HashSet<Hash>(length);
    3838            if (length == 1) {
     39                // closest-hop restrictions
     40                Set<Hash> moreExclude = getClosestHopExclude(settings.isInbound());
     41                if (moreExclude != null)
     42                    exclude.addAll(moreExclude);
    3943                ctx.profileOrganizer().selectFastPeers(length, exclude, matches, 0);
    4044                matches.remove(ctx.routerHash());
     
    4751                // OBEP or IB last hop
    4852                // group 0 or 1 if two hops, otherwise group 0
     53                Set<Hash> firstHopExclude;
    4954                if (!settings.isInbound()) {
    50                     // exclude existing OBEPs to get some diversity
     55                    // exclude existing OBEPs to get some diversity ?
     56
     57                    // closest-hop restrictions
     58                    Set<Hash> moreExclude = getClosestHopExclude(false);
     59                    if (moreExclude != null) {
     60                        moreExclude.addAll(exclude);
     61                        firstHopExclude = moreExclude;
     62                    } else {
     63                        firstHopExclude = exclude;
     64                    }
     65                } else {
     66                    firstHopExclude = exclude;
    5167                }
    52                 ctx.profileOrganizer().selectFastPeers(1, exclude, matches, settings.getRandomKey(), length == 2 ? 2 : 4);
     68                ctx.profileOrganizer().selectFastPeers(1, firstHopExclude, matches, settings.getRandomKey(), length == 2 ? 2 : 4);
    5369                matches.remove(ctx.routerHash());
    5470                exclude.addAll(matches);
     
    7490                // group 2 or 3 if two hops, otherwise group 1
    7591                if (settings.isInbound()) {
    76                     // exclude existing IBGWs to get some diversity
     92                    // exclude existing IBGWs to get some diversity ?
     93
     94                    // closest-hop restrictions
     95                    Set<Hash> moreExclude = getClosestHopExclude(true);
     96                    if (moreExclude != null)
     97                        exclude.addAll(moreExclude);
    7798                }
    7899                ctx.profileOrganizer().selectFastPeers(1, exclude, matches, settings.getRandomKey(), length == 2 ? 3 : 5);
  • router/java/src/net/i2p/router/tunnel/pool/ExploratoryPeerSelector.java

    ra52c06a6 r2a681608  
    4343        Set<Hash> exclude = getExclude(settings.isInbound(), true);
    4444        exclude.add(ctx.routerHash());
     45        // closest-hop restrictions
     46        // Since we're applying orderPeers() later, we don't know
     47        // which will be the closest hop, so just appply to all peers for now.
     48        Set<Hash> moreExclude = getClosestHopExclude(settings.isInbound());
     49        if (moreExclude != null)
     50            exclude.addAll(moreExclude);
     51
    4552        // Don't use ff peers for exploratory tunnels to lessen exposure to netDb searches and stores
    4653        // Hmm if they don't get explored they don't get a speed/capacity rating
  • router/java/src/net/i2p/router/tunnel/pool/TunnelPeerSelector.java

    ra52c06a6 r2a681608  
    1515import net.i2p.I2PAppContext;
    1616import net.i2p.crypto.SHA256Generator;
     17import net.i2p.crypto.SigType;
    1718import net.i2p.data.DataFormatException;
    1819import net.i2p.data.Hash;
     
    328329    }
    329330   
     331    /**
     332     *  Pick peers that we want to avoid for the first OB hop or last IB hop.
     333     *  This is only filled in if our router sig type is not DSA.
     334     *
     335     *  @param isInbound unused
     336     *  @return null if none
     337     *  @since 0.9.17
     338     */
     339    protected Set<Hash> getClosestHopExclude(boolean isInbound) {
     340        RouterInfo ri = ctx.router().getRouterInfo();
     341        if (ri == null)
     342            return null;
     343        SigType type = ri.getIdentity().getSigType();
     344        if (type == SigType.DSA_SHA1)
     345            return null;
     346        Set<Hash> rv = new HashSet<Hash>(1024);
     347        FloodfillNetworkDatabaseFacade fac = (FloodfillNetworkDatabaseFacade)ctx.netDb();
     348        List<RouterInfo> known = fac.getKnownRouterData();
     349        if (known != null) {
     350            for (int i = 0; i < known.size(); i++) {
     351                RouterInfo peer = known.get(i);
     352                String v = peer.getOption("router.version");
     353                if (v == null)
     354                    continue;
     355                // RI sigtypes added in 0.9.16
     356                // SSU inbound connection bug fixed in 0.9.17, but it won't bid, so NTCP only,
     357                // no need to check
     358                if (VersionComparator.comp(v, "0.9.16") < 0)
     359                    rv.add(peer.getIdentity().calculateHash());
     360            }
     361        }
     362        return rv;
     363    }
     364   
    330365    /** warning, this is also called by ProfileOrganizer.isSelectable() */
    331366    public static boolean shouldExclude(RouterContext ctx, RouterInfo peer) {
Note: See TracChangeset for help on using the changeset viewer.