Changeset 19faa35
- Timestamp:
- Jul 25, 2013 6:52:45 PM (8 years ago)
- Branches:
- master
- Children:
- b2d72f9
- Parents:
- ffda7f63
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
history.txt
rffda7f63 r19faa35 1 2012-07-25 zzz 2 * Transports: 3 - Prefer IPv6 by default 4 - Fix IPv6-only option 5 - Don't try NTCP IPv6 addresses unless we have one 6 - Fix non-%16 SSU padding; enable by default 7 * Tunnels: 8 - Make expl. default 3 hops (ticket #966) 9 - Allow expl. fallback up to -2 hops 10 1 11 2012-07-24 zzz 2 12 * GeoIP: Fix lookups, broken in IPv6 branch -
router/java/src/net/i2p/router/RouterVersion.java
rffda7f63 r19faa35 19 19 public final static String ID = "Monotone"; 20 20 public final static String VERSION = CoreVersion.VERSION; 21 public final static long BUILD = 1 0;21 public final static long BUILD = 11; 22 22 23 23 /** for example "-test" */ -
router/java/src/net/i2p/router/transport/TransportImpl.java
rffda7f63 r19faa35 244 244 msg.transportFailed(getStyle()); 245 245 246 if (msToSend > 1 000) {247 if (_log.shouldLog(Log. WARN))246 if (msToSend > 1500) { 247 if (_log.shouldLog(Log.INFO)) 248 248 _log.warn(getStyle() + " afterSend slow: " + (sendSuccessful ? "success " : "FAIL ") 249 249 + msg.getMessageSize() + " byte " … … 578 578 protected List<RouterAddress> getTargetAddresses(RouterInfo target) { 579 579 List<RouterAddress> rv = target.getTargetAddresses(getStyle()); 580 if (rv.isEmpty()) 581 return rv; 580 582 // Shuffle so everybody doesn't use the first one 581 if (rv.size() > 1) {583 if (rv.size() > 1) 582 584 Collections.shuffle(rv, _context.random()); 583 584 585 585 TransportUtil.IPv6Config config = getIPv6Config(); 586 int adj; 587 switch (config) { 586 588 case IPV6_DISABLED: 587 adj = 10; break; 589 adj = 10; 590 /**** IPv6 addresses will be rejected in isPubliclyRoutable() 591 for (Iterator<RouterAddress> iter = rv.iterator(); iter.hasNext(); ) { 592 byte[] ip = iter.next().getIP(); 593 if (ip != null && ip.length == 16) 594 iter.remove(); 595 } 596 ****/ 597 break; 588 598 case IPV6_NOT_PREFERRED: 589 599 adj = 1; break; … … 594 604 adj = -1; break; 595 605 case IPV6_ONLY: 596 adj = -10; break; 597 } 606 adj = -10; 607 // IPv4 addresses not rejected in isPubliclyRoutable() 608 for (Iterator<RouterAddress> iter = rv.iterator(); iter.hasNext(); ) { 609 byte[] ip = iter.next().getIP(); 610 if (ip != null && ip.length == 4) 611 iter.remove(); 612 } 613 break; 614 } 615 if (rv.size() > 1) 598 616 Collections.sort(rv, new AddrComparator(adj)); 599 }600 617 return rv; 601 618 } -
router/java/src/net/i2p/router/transport/TransportUtil.java
rffda7f63 r19faa35 53 53 54 54 private static final Map<String, IPv6Config> BY_NAME = new HashMap<String, IPv6Config>(); 55 public static final IPv6Config DEFAULT_IPV6_CONFIG = IPv6Config.IPV6_ DISABLED;55 public static final IPv6Config DEFAULT_IPV6_CONFIG = IPv6Config.IPV6_PREFERRED; 56 56 57 57 static { … … 61 61 // alias 62 62 BY_NAME.put("true", IPv6Config.IPV6_ENABLED); 63 BY_NAME.put("disable", IPv6Config.IPV6_DISABLED); 63 64 } 64 65 -
router/java/src/net/i2p/router/transport/ntcp/EventPumper.java
rffda7f63 r19faa35 26 26 import net.i2p.router.RouterContext; 27 27 import net.i2p.router.transport.FIFOBandwidthLimiter; 28 import net.i2p.util.Addresses; 28 29 import net.i2p.util.ConcurrentHashSet; 29 30 import net.i2p.util.I2PThread; … … 782 783 key.attach(con); 783 784 con.setKey(key); 785 RouterAddress naddr = con.getRemoteAddress(); 784 786 try { 785 RouterAddress naddr = con.getRemoteAddress();786 787 if (naddr.getPort() <= 0) 787 788 throw new IOException("Invalid NTCP address: " + naddr); … … 795 796 } 796 797 } catch (IOException ioe) { 797 if (_log.shouldLog(Log.WARN)) _log.warn("error connecting", ioe); 798 if (_log.shouldLog(Log.WARN)) 799 _log.warn("error connecting to " + Addresses.toString(naddr.getIP(), naddr.getPort()), ioe); 798 800 _context.statManager().addRateData("ntcp.connectFailedIOE", 1); 799 801 _transport.markUnreachable(con.getRemotePeer().calculateHash()); -
router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java
rffda7f63 r19faa35 72 72 */ 73 73 private final Set<NTCPConnection> _establishing; 74 75 /** 76 * Do we have a public IPv6 address? 77 * TODO periodically update via CSFI.NetMonitor? 78 */ 79 private boolean _haveIPv6Address; 74 80 75 81 public final static String PROP_I2NP_NTCP_HOSTNAME = "i2np.ntcp.hostname"; … … 365 371 continue; 366 372 } 367 if (!is PubliclyRoutable(ip)) {373 if (!isValid(ip)) { 368 374 if (! _context.getBooleanProperty("i2np.ntcp.allowLocal")) { 369 375 //_context.statManager().addRateData("ntcp.bidRejectedLocalAddress", 1); … … 376 382 } 377 383 return null; 384 } 385 386 /** 387 * An IPv6 address is only valid if we are configured to support IPv6 388 * AND we have a public IPv6 address. 389 * 390 * @param addr may be null, returns false 391 * @since 0.9.8 392 */ 393 private boolean isValid(byte addr[]) { 394 if (addr == null) return false; 395 if (isPubliclyRoutable(addr) && 396 (addr.length != 16 || _haveIPv6Address)) 397 return true; 398 return false; 378 399 } 379 400 … … 810 831 if (_log.shouldLog(Log.WARN)) 811 832 _log.warn("Received address: " + Addresses.toString(ip, port) + " from: " + source); 812 if (ip != null && !isPubliclyRoutable(ip)) { 833 if ((source == SOURCE_INTERFACE || source == SOURCE_SSU) 834 && ip != null && ip.length == 16) { 835 // must be set before isValid() call 836 _haveIPv6Address = true; 837 } 838 if (ip != null && !isValid(ip)) { 813 839 if (_log.shouldLog(Log.WARN)) 814 840 _log.warn("Invalid address: " + Addresses.toString(ip, port) + " from: " + source); -
router/java/src/net/i2p/router/transport/udp/PacketBuilder.java
rffda7f63 r19faa35 162 162 163 163 private static final String PROP_PADDING = "i2np.udp.padding"; 164 private static final boolean DEFAULT_ENABLE_PADDING = true; 164 165 165 166 /** … … 409 410 // pad up so we're on the encryption boundary 410 411 off = pad1(data, off); 411 off = pad2(data, off, currentMTU );412 off = pad2(data, off, currentMTU - (ipHeaderSize + UDP_HEADER_SIZE)); 412 413 pkt.setLength(off); 413 414 … … 783 784 off += paddingRequired; 784 785 } 786 // We cannot have non-mod16 (pad2) padding here, since the signature 787 // is at the end. As of 0.9.7 we won't decrypt past the end of the packet 788 // so trailing non-mod-16 data is ignored. That truncates the sig. 785 789 786 790 // BUG: NPE here if null signature … … 793 797 // pad up so we're on the encryption boundary 794 798 off = pad1(data, off); 799 // allowed but untested 800 //off = pad2(data, off); 795 801 } 796 off = pad2(data, off);797 802 pkt.setLength(off); 798 803 authenticate(packet, state.getCipherKey(), state.getMACKey()); … … 1352 1357 */ 1353 1358 private int pad2(byte[] data, int off) { 1354 if (!_context.get BooleanProperty(PROP_PADDING))1359 if (!_context.getProperty(PROP_PADDING, DEFAULT_ENABLE_PADDING)) 1355 1360 return off; 1356 1361 int padSize = _context.random().nextInt(MAX_PAD2); … … 1371 1376 */ 1372 1377 private int pad2(byte[] data, int off, int maxLen) { 1373 if (!_context.get BooleanProperty(PROP_PADDING))1378 if (!_context.getProperty(PROP_PADDING, DEFAULT_ENABLE_PADDING)) 1374 1379 return off; 1375 1380 if (off >= maxLen)
Note: See TracChangeset
for help on using the changeset viewer.