From 39e859c368c0e141a477a827e589763da83d3a5f Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 11 Jul 2014 19:29:44 +0000 Subject: [PATCH 01/20] javadoc --- router/java/src/net/i2p/router/package.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/router/java/src/net/i2p/router/package.html b/router/java/src/net/i2p/router/package.html index e18dbdf96..dc610cc0c 100644 --- a/router/java/src/net/i2p/router/package.html +++ b/router/java/src/net/i2p/router/package.html @@ -10,6 +10,9 @@ Classes in this package, sub-packages, and others in router.jar are not for use by apps, clients or plugins (except for routerconsole). Subject to change. Not necessarily maintained as a stable API. +

+For applications bundling the I2P router, instantiate Router and call runRouter(), or use Router.main() or RouterLaunch. +Most public methods in Router are maintained as a stable I2P for those bundling the router.

From 2c185ea76c456e3af26a1e0f47f566710f6ae7ee Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 11 Jul 2014 19:31:44 +0000 Subject: [PATCH 02/20] * Datagrams: - Redefine the repliable datagram signature for non-DSA_SHA1 sig types; was the sig of the SHA-256 of the payload, now the sig of the payload itself. This is an incompatible change but nobody is yet using the new sig types for datagram applications. - Don't pollute the hash cache with hashes of payloads - Check for too-big datagrams - Remove assertion check - Cleanups --- .../client/datagram/I2PDatagramDissector.java | 69 ++++++++++++++----- .../i2p/client/datagram/I2PDatagramMaker.java | 45 ++++++++++-- .../src/net/i2p/client/datagram/package.html | 7 +- .../src/net/i2p/router/RouterVersion.java | 2 +- 4 files changed, 97 insertions(+), 26 deletions(-) diff --git a/core/java/src/net/i2p/client/datagram/I2PDatagramDissector.java b/core/java/src/net/i2p/client/datagram/I2PDatagramDissector.java index d22bafd2e..246af5403 100644 --- a/core/java/src/net/i2p/client/datagram/I2PDatagramDissector.java +++ b/core/java/src/net/i2p/client/datagram/I2PDatagramDissector.java @@ -19,6 +19,7 @@ import net.i2p.data.DataFormatException; import net.i2p.data.Destination; import net.i2p.data.Hash; import net.i2p.data.Signature; +import net.i2p.data.SigningPublicKey; import net.i2p.util.Log; /** @@ -34,16 +35,11 @@ public final class I2PDatagramDissector { private final DSAEngine dsaEng = DSAEngine.getInstance(); private final SHA256Generator hashGen = SHA256Generator.getInstance(); - private Hash rxHash; - + private byte[] rxHash; private Signature rxSign; - private Destination rxDest; - private final byte[] rxPayload = new byte[DGRAM_BUFSIZE]; - private int rxPayloadLen; - private boolean valid; /** @@ -56,6 +52,17 @@ public final class I2PDatagramDissector { * Load an I2P repliable datagram into the dissector. * Does NOT verify the signature. * + * Format is: + *
    + *
  1. Destination (387+ bytes) + *
  2. Signature (40+ bytes, type and length as implied by signing key type in the Destination) + *
  3. Payload + *
+ * + * For DSA_SHA1 Destinations, the signature is of the SHA-256 Hash of the payload. + * + * As of 0.9.14, for non-DSA_SHA1 Destinations, the signature is of the payload itself. + * * @param dgram non-null I2P repliable datagram to be loaded * * @throws DataFormatException If there's an error in the datagram format @@ -79,14 +86,21 @@ public final class I2PDatagramDissector { rxPayloadLen = dgStream.read(rxPayload); // calculate the hash of the payload - this.rxHash = hashGen.calculateHash(rxPayload, 0, rxPayloadLen); - assert this.hashGen.calculateHash(this.extractPayload()).equals(this.rxHash); + if (type == SigType.DSA_SHA1) { + if (rxHash == null) + rxHash = new byte[Hash.HASH_LENGTH]; + // non-caching + hashGen.calculateHash(rxPayload, 0, rxPayloadLen, rxHash, 0); + //assert this.hashGen.calculateHash(this.extractPayload()).equals(this.rxHash); + } else { + rxHash = null; + } } catch (IOException e) { Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class); log.error("Caught IOException - INCONSISTENT STATE!", e); - } catch(AssertionError e) { - Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class); - log.error("Assertion failed!", e); + //} catch(AssertionError e) { + // Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class); + // log.error("Assertion failed!", e); } //_log.debug("Datagram payload size: " + rxPayloadLen + "; content:\n" @@ -125,14 +139,16 @@ public final class I2PDatagramDissector { * Extract the hash of the payload of an I2P repliable datagram (previously * loaded with the loadI2PDatagram() method), verifying the datagram * signature. + * + * As of 0.9.14, for signature types other than DSA_SHA1, this returns null. + * * @return The hash of the payload of the I2P repliable datagram * @throws I2PInvalidDatagramException if the signature verification fails */ public Hash getHash() throws I2PInvalidDatagramException { // make sure it has a valid signature this.verifySignature(); - - return this.extractHash(); + return extractHash(); } /** @@ -178,10 +194,18 @@ public final class I2PDatagramDissector { * Extract the hash of the payload of an I2P repliable datagram (previously * loaded with the loadI2PDatagram() method), without verifying the datagram * signature. + * + * As of 0.9.14, for signature types other than DSA_SHA1, this returns null. + * * @return The hash of the payload of the I2P repliable datagram */ public Hash extractHash() { - return this.rxHash; + if (rxHash == null) + return null; + // make a copy as we will reuse rxHash + byte[] hash = new byte[Hash.HASH_LENGTH]; + System.arraycopy(rxHash, 0, hash, 0, Hash.HASH_LENGTH); + return new Hash(hash); } /** @@ -194,12 +218,21 @@ public final class I2PDatagramDissector { if(this.valid) return; - if (rxSign == null || rxSign.getData() == null || rxDest == null || rxDest.getSigningPublicKey() == null) + if (rxSign == null || rxSign.getData() == null || rxDest == null) throw new I2PInvalidDatagramException("Datagram not yet read"); - + // now validate - if (!this.dsaEng.verifySignature(rxSign, rxHash.getData(), rxDest.getSigningPublicKey())) - throw new I2PInvalidDatagramException("Incorrect I2P repliable datagram signature"); + SigningPublicKey spk = rxDest.getSigningPublicKey(); + SigType type = spk.getType(); + if (type == null) + throw new I2PInvalidDatagramException("unsupported sig type"); + if (type == SigType.DSA_SHA1) { + if (!this.dsaEng.verifySignature(rxSign, rxHash, spk)) + throw new I2PInvalidDatagramException("Incorrect I2P repliable datagram signature"); + } else { + if (!this.dsaEng.verifySignature(rxSign, rxPayload, 0, rxPayloadLen, spk)) + throw new I2PInvalidDatagramException("Incorrect I2P repliable datagram signature"); + } // set validated this.valid = true; diff --git a/core/java/src/net/i2p/client/datagram/I2PDatagramMaker.java b/core/java/src/net/i2p/client/datagram/I2PDatagramMaker.java index 28336e412..015bbdbcd 100644 --- a/core/java/src/net/i2p/client/datagram/I2PDatagramMaker.java +++ b/core/java/src/net/i2p/client/datagram/I2PDatagramMaker.java @@ -16,8 +16,12 @@ import net.i2p.client.I2PSession; import net.i2p.crypto.DSAEngine; import net.i2p.crypto.SHA256Generator; import net.i2p.data.DataFormatException; +import net.i2p.data.Hash; +import net.i2p.data.Signature; import net.i2p.data.SigningPrivateKey; +import net.i2p.crypto.SigType; import net.i2p.util.Log; +import net.i2p.util.SimpleByteCache; /** * Class for creating I2P repliable datagrams. Note that objects of this class @@ -44,9 +48,9 @@ public final class I2PDatagramMaker { * @param session I2PSession used to send I2PDatagrams through */ public I2PDatagramMaker(I2PSession session) { - this(); this.setI2PDatagramMaker(session); } + /** * Construct a new I2PDatagramMaker that is null. * Use setI2PDatagramMaker to set the parameters. @@ -59,22 +63,53 @@ public final class I2PDatagramMaker { sxPrivKey = session.getPrivateKey(); sxDestBytes = session.getMyDestination().toByteArray(); } + /** * Make a repliable I2P datagram containing the specified payload. * + * Format is: + *
    + *
  1. Destination (387+ bytes) + *
  2. Signature (40+ bytes, type and length as implied by signing key type in the Destination) + *
  3. Payload + *
+ * + * Maximum datagram size is 32768, so maximum payload size is 32341, or less for + * non-DSA_SHA1 destinations. Practical maximum is a few KB less due to + * ElGamal/AES overhead. 10 KB or less is recommended for best results. + * + * For DSA_SHA1 Destinations, the signature is of the SHA-256 Hash of the payload. + * + * As of 0.9.14, for non-DSA_SHA1 Destinations, the signature is of the payload itself. + * * @param payload non-null Bytes to be contained in the I2P datagram. + * @return null on error + * @throws IllegalArgumentException if payload is too big + * @throws IllegalStateException if Destination signature type unsupported */ public byte[] makeI2PDatagram(byte[] payload) { sxDGram.reset(); try { sxDGram.write(sxDestBytes); + SigType type = sxPrivKey.getType(); + if (type == null) + throw new IllegalStateException("Unsupported sig type"); - dsaEng.sign(hashGen.calculateHash(payload).toByteArray(), - sxPrivKey).writeBytes(sxDGram); - + Signature sig; + if (type == SigType.DSA_SHA1) { + byte[] hash = SimpleByteCache.acquire(Hash.HASH_LENGTH); + // non-caching + hashGen.calculateHash(payload, 0, payload.length, hash, 0); + sig = dsaEng.sign(hash, sxPrivKey); + SimpleByteCache.release(hash); + } else { + sig = dsaEng.sign(payload, sxPrivKey); + } + sig.writeBytes(sxDGram); sxDGram.write(payload); - + if (sxDGram.size() > DGRAM_BUFSIZE) + throw new IllegalArgumentException("Too big"); return sxDGram.toByteArray(); } catch (IOException e) { Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramMaker.class); diff --git a/core/java/src/net/i2p/client/datagram/package.html b/core/java/src/net/i2p/client/datagram/package.html index da3a87140..085df6568 100644 --- a/core/java/src/net/i2p/client/datagram/package.html +++ b/core/java/src/net/i2p/client/datagram/package.html @@ -10,6 +10,9 @@ in turn, use the {@link net.i2p.client.datagram.I2PDatagramMaker} to build a message that can be parsed.

The datagram format implemented here includes -the sender's {@link net.i2p.data.Destination}, the payload, and a hash of the -payload (signed by the sender's {@link net.i2p.data.SigningPrivateKey}).

+the sender's {@link net.i2p.data.Destination}, the payload, and a signature +(signed by the sender's {@link net.i2p.data.SigningPrivateKey}). +For DSA_SHA1 destinations, the signature is of the SHA-256 Hash of the payload. +For other destination types, the signature is of the payload itself. +

diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 31c35f8c3..ea17ad55f 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 14; + public final static long BUILD = 15; /** for example "-test" */ public final static String EXTRA = ""; From 9dabc7586670324cdcfb4dcc5cd4a91dd891f8a7 Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 13 Jul 2014 13:29:55 +0000 Subject: [PATCH 03/20] * SU3File: Disable the X.509 CN checking of local certs on Android, as the javax.naming classes are not available. Any issues with local certs will be discovered in non-Android testing. --- core/java/src/net/i2p/crypto/CertUtil.java | 10 ++++++++- core/java/src/net/i2p/crypto/DirKeyRing.java | 23 +++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/core/java/src/net/i2p/crypto/CertUtil.java b/core/java/src/net/i2p/crypto/CertUtil.java index 359ce7aac..aa484a522 100644 --- a/core/java/src/net/i2p/crypto/CertUtil.java +++ b/core/java/src/net/i2p/crypto/CertUtil.java @@ -18,6 +18,7 @@ import net.i2p.I2PAppContext; import net.i2p.data.Base64; import net.i2p.util.Log; import net.i2p.util.SecureFileOutputStream; +import net.i2p.util.SystemVersion; /** * Java X.509 certificate utilities, consolidated from various places. @@ -65,11 +66,18 @@ public class CertUtil { } /** - * Get a value out of the subject distinguished name + * Get a value out of the subject distinguished name. + * + * Warning - unsupported in Android (no javax.naming), returns null. + * * @param type e.g. "CN" * @return value or null if not found */ public static String getSubjectValue(X509Certificate cert, String type) { + if (SystemVersion.isAndroid()) { + error("Don't call this in Android", new UnsupportedOperationException("I did it")); + return null; + } type = type.toUpperCase(Locale.US); X500Principal p = cert.getSubjectX500Principal(); String subj = p.getName(); diff --git a/core/java/src/net/i2p/crypto/DirKeyRing.java b/core/java/src/net/i2p/crypto/DirKeyRing.java index 6085694ea..38ba45bf8 100644 --- a/core/java/src/net/i2p/crypto/DirKeyRing.java +++ b/core/java/src/net/i2p/crypto/DirKeyRing.java @@ -14,9 +14,11 @@ import java.security.PublicKey; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; +import net.i2p.util.SystemVersion; + /** - * Dumb storage in a directory for testing. - * No sanitization of filenames, unsafe. + * Simple storage of each cert in a separate file in a directory. + * Limited sanitization of filenames. * * @since 0.9.9 */ @@ -30,7 +32,9 @@ class DirKeyRing implements KeyRing { /** * Cert must be in the file (escaped keyName).crt, - * and have a CN == keyName + * and have a CN == keyName. + * + * CN check unsupported on Android. */ public PublicKey getKey(String keyName, String scope, SigType type) throws GeneralSecurityException, IOException { @@ -49,14 +53,21 @@ class DirKeyRing implements KeyRing { CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)cf.generateCertificate(fis); cert.checkValidity(); - String cn = CertUtil.getSubjectValue(cert, "CN"); - if (!keyName.equals(cn)) - throw new GeneralSecurityException("CN mismatch: " + cn); + if (!SystemVersion.isAndroid()) { + // getSubjectValue() unsupported on Android. + // Any cert problems will be caught in non-Android testing. + String cn = CertUtil.getSubjectValue(cert, "CN"); + if (!keyName.equals(cn)) + throw new GeneralSecurityException("CN mismatch: " + cn); + } return cert.getPublicKey(); } finally { try { if (fis != null) fis.close(); } catch (IOException foo) {} } } + /** + * Unimplemented, unused. + */ public void setKey(String keyName, String scope, PublicKey key) {} } From f364a83f4f2090ca9d4a1feed4151b3596754da2 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 14 Jul 2014 20:40:36 +0000 Subject: [PATCH 04/20] mtn.i2p-projekt.i2p --- installer/resources/hosts.txt | 1 + installer/resources/i2ptunnel.config | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/installer/resources/hosts.txt b/installer/resources/hosts.txt index 527653924..662b4995c 100644 --- a/installer/resources/hosts.txt +++ b/installer/resources/hosts.txt @@ -357,3 +357,4 @@ anoncoin.i2p=vA4OWvaW6ChyRACDUSq0SiWBB88SBd-3sBAPphzAsUGfQeZMvcmCLM1KuZ9kRLPZnzA jisko.i2p=YSXAtZN7atC3kAoMLFr6vRcEYf3oUpBonrePtfzt6ydtXIqt501dUqwDXVzKP2Hkmg2Zg9HCdMy8a1JCUZLS-T9sPgYn44FEnWg4j2QFFRafpSTLrdDXMK1CpyQhZUYJr4mzg3MEY37cBGSlodFlAgm-J2sgcog7SEpoZrLJ3wNZU8aisQZlUjvn83McMEnLH-AmcTyO3feLaTX7BJE6L6OB67MBieUH0-uNeolHIne1GzcHBuC-0F~wW6pd1eDFDdoQV81VMWAPnkCPzdIW-rmF0C7nvSqzgBpeoywBmIs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M-A5SOx60EsL26YX1VXh1zQ3Rsg2lNXbSPI4dLb9taGWxpZS914L-N3Htgih7VM-Zl1QYQGuNV-9LaEEUQKRPCeKdyG14Yry4YOVDItMFE5CHIDaoFcpD24jPE~0aHmVk~RXOIzVhmtVj~HcpBXWxT4lpIO2V3kzA-ZTvo5I0ollbP5Ep3s0Cj~EfikBhUL6zHsWVC0AAAA +mtn.i2p-projekt.i2p=I6Ha4I7rgR0JyExQnN~4sZz5CfRqdN7o-2t1i2YOExd2CxC4MHHz3nJ5KgBIqeNa0dZbugwMEYMWneXAf8nuy9RKUrjcDvGLqScuU8QCpG-e7UDR8lNregfaOwTuypBQiPh9nrc86Zc2JXyTv0eG3T5Yl1tydqs3qEz5w1vn64uRCrGLEMsnGMIZ4aXexseL6McW9ObIQ0qOIfRG9kc~3~bpD9UM4G04BXPZ1Ao5MUjGoQyxlaNCt1DrvAYcrRArzvv0QGyPjb6HpHLlK2UIoR6SumRuNYpEXCaqbXEnEicx1kB5Pyhcwm0cyaMCx-ZaUU-F1~23VurE41xNMbq4GwXtev4bVP4ycHGHjH-XYJmKrqnesIEp7InSAWfm0gdDHuy9377nSIyAhGLLFlWKtzrZPiKm57SN4~BZSQIF6CI4JutGa0x9EaO8hvzFgaYKgwS~a7-YuZNfx4VHEF2J34DrsJo4qetdPTWTKX1o-ztMP6f7DpWjp4JTKb36YstvAAAA diff --git a/installer/resources/i2ptunnel.config b/installer/resources/i2ptunnel.config index d2a0b113e..8f2fdb925 100644 --- a/installer/resources/i2ptunnel.config +++ b/installer/resources/i2ptunnel.config @@ -57,13 +57,13 @@ tunnel.1.option.outbound.priority=15 tunnel.1.startOnLoad=true # I2P's mtn server -tunnel.2.name=mtn.i2p2.i2p +tunnel.2.name=mtn.i2p-projekt.i2p tunnel.2.description=I2P Monotone Server tunnel.2.type=client tunnel.2.sharedClient=true tunnel.2.interface=127.0.0.1 tunnel.2.listenPort=8998 -tunnel.2.targetDestination=mtn.i2p2.i2p:4691 +tunnel.2.targetDestination=mtn.i2p-projekt.i2p:4691 tunnel.2.i2cpHost=127.0.0.1 tunnel.2.i2cpPort=7654 tunnel.2.option.inbound.nickname=shared clients @@ -107,7 +107,6 @@ tunnel.4.option.outbound.nickname=shared clients tunnel.4.option.i2cp.reduceIdleTime=900000 tunnel.4.option.i2cp.reduceOnIdle=true tunnel.4.option.i2cp.reduceQuantity=1 -tunnel.4.option.i2p.streaming.connectDelay=1000 tunnel.4.option.inbound.length=3 tunnel.4.option.inbound.lengthVariance=0 tunnel.4.option.outbound.length=3 From 0c7a3a3a39713638f31728d722042bc7f678d28d Mon Sep 17 00:00:00 2001 From: str4d Date: Tue, 15 Jul 2014 12:54:22 +0000 Subject: [PATCH 05/20] Stubs for I2CP connections over Unix domain sockets --- .../net/i2p/client/DomainSocketFactory.java | 45 +++++++++++++++++++ .../src/net/i2p/client/I2PSessionImpl.java | 23 ++++++++-- .../router/client/ClientListenerRunner.java | 7 +-- .../net/i2p/router/client/ClientManager.java | 34 ++++++++++---- .../client/DomainClientListenerRunner.java | 29 ++++++++++++ .../client/SSLClientListenerRunner.java | 2 +- 6 files changed, 125 insertions(+), 15 deletions(-) create mode 100644 core/java/src/net/i2p/client/DomainSocketFactory.java create mode 100644 router/java/src/net/i2p/router/client/DomainClientListenerRunner.java diff --git a/core/java/src/net/i2p/client/DomainSocketFactory.java b/core/java/src/net/i2p/client/DomainSocketFactory.java new file mode 100644 index 000000000..280236e5e --- /dev/null +++ b/core/java/src/net/i2p/client/DomainSocketFactory.java @@ -0,0 +1,45 @@ +package net.i2p.client; + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; + +import net.i2p.I2PAppContext; + +/** + * Bridge to Unix domain socket (or similar). + *

+ * This is a stub that does nothing. + * This class is replaced in the Android build. + * + * @author str4d + * @since 0.9.15 + */ +public class DomainSocketFactory { + public static String I2CP_SOCKET_ADDRESS = "net.i2p.client.i2cp"; + + /** + * @throws UnsupportedOperationException always + */ + public DomainSocketFactory(I2PAppContext context) { + throw new UnsupportedOperationException(); + } + + /** + * Override in Android. + * @throws IOException + * @throws UnsupportedOperationException always + */ + public Socket createSocket(String name) throws IOException { + throw new UnsupportedOperationException(); + } + + /** + * Override in Android. + * @throws IOException + * @throws UnsupportedOperationException always + */ + public ServerSocket createServerSocket(String name) throws IOException { + throw new UnsupportedOperationException(); + } +} diff --git a/core/java/src/net/i2p/client/I2PSessionImpl.java b/core/java/src/net/i2p/client/I2PSessionImpl.java index 20aa43550..fd60b7404 100644 --- a/core/java/src/net/i2p/client/I2PSessionImpl.java +++ b/core/java/src/net/i2p/client/I2PSessionImpl.java @@ -52,6 +52,7 @@ import net.i2p.util.LHMCache; import net.i2p.util.Log; import net.i2p.util.OrderedProperties; import net.i2p.util.SimpleTimer2; +import net.i2p.util.SystemVersion; import net.i2p.util.VersionComparator; /** @@ -157,6 +158,12 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa protected static final String PROP_USER = "i2cp.username"; protected static final String PROP_PW = "i2cp.password"; + /** + * Use Unix domain socket (or similar) to connect to a router + * @since 0.9.15 + */ + protected static final String PROP_DOMAIN_SOCKET = "i2cp.domainSocket"; + private static final long VERIFY_USAGE_TIME = 60*1000; private static final long MAX_SEND_WAIT = 10*1000; @@ -279,6 +286,10 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa if (_context.isRouterContext()) // just for logging return "[internal connection]"; + else if (SystemVersion.isAndroid() && + Boolean.parseBoolean(_options.getProperty(PROP_DOMAIN_SOCKET))) + // just for logging + return "[Domain socket connection]"; return _options.getProperty(I2PClient.PROP_TCP_HOST, "127.0.0.1"); } @@ -287,7 +298,9 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa * @since 0.9.7 was in loadConfig() */ private int getPort() { - if (_context.isRouterContext()) + if (_context.isRouterContext() || + (SystemVersion.isAndroid() && + Boolean.parseBoolean(_options.getProperty(PROP_DOMAIN_SOCKET)))) // just for logging return 0; String portNum = _options.getProperty(I2PClient.PROP_TCP_PORT, LISTEN_PORT + ""); @@ -447,7 +460,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa try { // protect w/ closeSocket() synchronized(_stateLock) { - // If we are in the router JVM, connect using the interal queue + // If we are in the router JVM, connect using the internal queue if (_context.isRouterContext()) { // _socket and _writer remain null InternalClientManager mgr = _context.internalClientManager(); @@ -457,7 +470,11 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa _queue = mgr.connect(); _reader = new QueuedI2CPMessageReader(_queue, this); } else { - if (Boolean.parseBoolean(_options.getProperty(PROP_ENABLE_SSL))) { + if (SystemVersion.isAndroid() && + Boolean.parseBoolean(_options.getProperty(PROP_DOMAIN_SOCKET))) { + final DomainSocketFactory fact = new DomainSocketFactory(_context); + _socket = fact.createSocket(DomainSocketFactory.I2CP_SOCKET_ADDRESS); + } else if (Boolean.parseBoolean(_options.getProperty(PROP_ENABLE_SSL))) { try { I2PSSLSocketFactory fact = new I2PSSLSocketFactory(_context, false, "certificates/i2cp"); _socket = fact.createSocket(_hostname, _portNum); diff --git a/router/java/src/net/i2p/router/client/ClientListenerRunner.java b/router/java/src/net/i2p/router/client/ClientListenerRunner.java index 9b169ca75..44d7811b6 100644 --- a/router/java/src/net/i2p/router/client/ClientListenerRunner.java +++ b/router/java/src/net/i2p/router/client/ClientListenerRunner.java @@ -64,7 +64,9 @@ class ClientListenerRunner implements Runnable { return new ServerSocket(_port, 0, InetAddress.getByName(listenInterface)); } } - + + public void run() { runServer(); } + /** * Start up the socket listener, listens for connections, and * fires those connections off via {@link #runConnection runConnection}. @@ -72,7 +74,7 @@ class ClientListenerRunner implements Runnable { * failure. * */ - public void runServer() { + protected void runServer() { _running = true; int curDelay = 1000; while (_running) { @@ -173,5 +175,4 @@ class ClientListenerRunner implements Runnable { _socket = null; } catch (IOException ioe) {} } - public void run() { runServer(); } } diff --git a/router/java/src/net/i2p/router/client/ClientManager.java b/router/java/src/net/i2p/router/client/ClientManager.java index 96e6ac20b..c982671b7 100644 --- a/router/java/src/net/i2p/router/client/ClientManager.java +++ b/router/java/src/net/i2p/router/client/ClientManager.java @@ -10,8 +10,10 @@ package net.i2p.router.client; import java.io.IOException; import java.io.Writer; +import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.LinkedBlockingQueue; @@ -37,6 +39,7 @@ import net.i2p.router.JobImpl; import net.i2p.router.RouterContext; import net.i2p.util.I2PThread; import net.i2p.util.Log; +import net.i2p.util.SystemVersion; /** * Coordinate connections and various tasks @@ -45,7 +48,7 @@ import net.i2p.util.Log; */ class ClientManager { private final Log _log; - protected ClientListenerRunner _listener; + protected List _listeners; // Destination --> ClientConnectionRunner // Locked for adds/removes but not lookups private final Map _runners; @@ -87,6 +90,7 @@ class ClientManager { // "How large are messages received by the client?", // "ClientMessages", // new long[] { 60*1000l, 60*60*1000l, 24*60*60*1000l }); + _listeners = new ArrayList(); _runners = new ConcurrentHashMap(); _runnersByHash = new ConcurrentHashMap(); _pendingRunners = new HashSet(); @@ -105,14 +109,22 @@ class ClientManager { /** Todo: Start a 3rd listener for IPV6? */ protected void startListeners() { + ClientListenerRunner listener; + if (SystemVersion.isAndroid()) { + listener = new DomainClientListenerRunner(_ctx, this); + Thread t = new I2PThread(listener, "DomainClientListener", true); + t.start(); + _listeners.add(listener); + } if (!_ctx.getBooleanProperty(PROP_DISABLE_EXTERNAL)) { // there's no option to start both an SSL and non-SSL listener if (_ctx.getBooleanProperty(PROP_ENABLE_SSL)) - _listener = new SSLClientListenerRunner(_ctx, this, _port); + listener = new SSLClientListenerRunner(_ctx, this, _port); else - _listener = new ClientListenerRunner(_ctx, this, _port); - Thread t = new I2PThread(_listener, "ClientListener:" + _port, true); + listener = new ClientListenerRunner(_ctx, this, _port); + Thread t = new I2PThread(listener, "ClientListener:" + _port, true); t.start(); + _listeners.add(listener); } _isStarted = true; } @@ -132,8 +144,9 @@ class ClientManager { public synchronized void shutdown(String msg) { _isStarted = false; _log.info("Shutting down the ClientManager"); - if (_listener != null) - _listener.stopListening(); + for (ClientListenerRunner listener : _listeners) + listener.stopListening(); + _listeners.clear(); Set runners = new HashSet(); synchronized (_runners) { for (ClientConnectionRunner runner : _runners.values()) { @@ -169,8 +182,13 @@ class ClientManager { return hisQueue; } - public boolean isAlive() { - return _isStarted && (_listener == null || _listener.isListening()); + public synchronized boolean isAlive() { + boolean listening = true; + if (!_listeners.isEmpty()) { + for (ClientListenerRunner listener : _listeners) + listening = listening && listener.isListening(); + } + return _isStarted && (_listeners.isEmpty() || listening); } public void registerConnection(ClientConnectionRunner runner) { diff --git a/router/java/src/net/i2p/router/client/DomainClientListenerRunner.java b/router/java/src/net/i2p/router/client/DomainClientListenerRunner.java new file mode 100644 index 000000000..89dbae6b7 --- /dev/null +++ b/router/java/src/net/i2p/router/client/DomainClientListenerRunner.java @@ -0,0 +1,29 @@ +package net.i2p.router.client; + +import java.io.IOException; +import java.net.ServerSocket; + +import net.i2p.client.DomainSocketFactory; +import net.i2p.router.RouterContext; + +/** + * Unix domain socket version of ClientListenerRunner. + * This is a stub that does nothing. + * This class is replaced in the Android build. + * + * @since 0.9.15 + */ +public class DomainClientListenerRunner extends ClientListenerRunner { + public DomainClientListenerRunner(RouterContext context, ClientManager manager) { + super(context, manager, -1); + } + + /** + * @throws IOException + */ + @Override + protected ServerSocket getServerSocket() throws IOException { + final DomainSocketFactory fact = new DomainSocketFactory(_context); + return fact.createServerSocket(DomainSocketFactory.I2CP_SOCKET_ADDRESS); + } +} diff --git a/router/java/src/net/i2p/router/client/SSLClientListenerRunner.java b/router/java/src/net/i2p/router/client/SSLClientListenerRunner.java index fcd008ad6..948cb7527 100644 --- a/router/java/src/net/i2p/router/client/SSLClientListenerRunner.java +++ b/router/java/src/net/i2p/router/client/SSLClientListenerRunner.java @@ -181,7 +181,7 @@ class SSLClientListenerRunner extends ClientListenerRunner { * Create (if necessary) and load the key store, then run. */ @Override - public void runServer() { + protected void runServer() { File keyStore = new File(_context.getConfigDir(), "keystore/i2cp.ks"); if (verifyKeyStore(keyStore) && initializeFactory(keyStore)) { super.runServer(); From c04062bbdff1df7ee1b6f2b2203ebc52c06cf4af Mon Sep 17 00:00:00 2001 From: str4d Date: Tue, 15 Jul 2014 12:58:58 +0000 Subject: [PATCH 06/20] Forgot to update @since --- core/java/src/net/i2p/client/DomainSocketFactory.java | 2 +- core/java/src/net/i2p/client/I2PSessionImpl.java | 2 +- .../src/net/i2p/router/client/DomainClientListenerRunner.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/java/src/net/i2p/client/DomainSocketFactory.java b/core/java/src/net/i2p/client/DomainSocketFactory.java index 280236e5e..cf8908499 100644 --- a/core/java/src/net/i2p/client/DomainSocketFactory.java +++ b/core/java/src/net/i2p/client/DomainSocketFactory.java @@ -13,7 +13,7 @@ import net.i2p.I2PAppContext; * This class is replaced in the Android build. * * @author str4d - * @since 0.9.15 + * @since 0.9.14 */ public class DomainSocketFactory { public static String I2CP_SOCKET_ADDRESS = "net.i2p.client.i2cp"; diff --git a/core/java/src/net/i2p/client/I2PSessionImpl.java b/core/java/src/net/i2p/client/I2PSessionImpl.java index fd60b7404..d14672647 100644 --- a/core/java/src/net/i2p/client/I2PSessionImpl.java +++ b/core/java/src/net/i2p/client/I2PSessionImpl.java @@ -160,7 +160,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa /** * Use Unix domain socket (or similar) to connect to a router - * @since 0.9.15 + * @since 0.9.14 */ protected static final String PROP_DOMAIN_SOCKET = "i2cp.domainSocket"; diff --git a/router/java/src/net/i2p/router/client/DomainClientListenerRunner.java b/router/java/src/net/i2p/router/client/DomainClientListenerRunner.java index 89dbae6b7..0f28a494f 100644 --- a/router/java/src/net/i2p/router/client/DomainClientListenerRunner.java +++ b/router/java/src/net/i2p/router/client/DomainClientListenerRunner.java @@ -8,10 +8,12 @@ import net.i2p.router.RouterContext; /** * Unix domain socket version of ClientListenerRunner. + *

* This is a stub that does nothing. * This class is replaced in the Android build. * - * @since 0.9.15 + * @author str4d + * @since 0.9.14 */ public class DomainClientListenerRunner extends ClientListenerRunner { public DomainClientListenerRunner(RouterContext context, ClientManager manager) { From 0998738e94221041636f7c692b9ee044df556aac Mon Sep 17 00:00:00 2001 From: str4d Date: Tue, 15 Jul 2014 12:59:56 +0000 Subject: [PATCH 07/20] Updated history --- history.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/history.txt b/history.txt index 5fcdc5897..f539d9397 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2014-07-15 str4d + * I2CP: Stubs for I2CP connections over Unix domain sockets + 2014-07-03 zzz * Base64: - Catch numerous decoding errors that were previously misdecoded (ticket #1318) From 8b2ffada10ed7cc87ae8396a0da57696ee8b6262 Mon Sep 17 00:00:00 2001 From: zzz Date: Tue, 15 Jul 2014 14:30:19 +0000 Subject: [PATCH 08/20] - fix test - final - last week's history --- history.txt | 5 +++++ router/java/src/net/i2p/router/client/ClientManager.java | 2 +- .../test/junit/net/i2p/router/client/LocalClientManager.java | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/history.txt b/history.txt index f539d9397..a1927b350 100644 --- a/history.txt +++ b/history.txt @@ -1,6 +1,11 @@ 2014-07-15 str4d * I2CP: Stubs for I2CP connections over Unix domain sockets +2014-07-11 zzz + * Datagrams: + - Redefine the repliable datagram signature for non-DSA_SHA1 sig types; + was the sig of the SHA-256 of the payload, now the sig of the payload itself. + 2014-07-03 zzz * Base64: - Catch numerous decoding errors that were previously misdecoded (ticket #1318) diff --git a/router/java/src/net/i2p/router/client/ClientManager.java b/router/java/src/net/i2p/router/client/ClientManager.java index c982671b7..9a8850c9b 100644 --- a/router/java/src/net/i2p/router/client/ClientManager.java +++ b/router/java/src/net/i2p/router/client/ClientManager.java @@ -48,7 +48,7 @@ import net.i2p.util.SystemVersion; */ class ClientManager { private final Log _log; - protected List _listeners; + protected final List _listeners; // Destination --> ClientConnectionRunner // Locked for adds/removes but not lookups private final Map _runners; diff --git a/router/java/test/junit/net/i2p/router/client/LocalClientManager.java b/router/java/test/junit/net/i2p/router/client/LocalClientManager.java index fb7bf15fc..f8df02989 100644 --- a/router/java/test/junit/net/i2p/router/client/LocalClientManager.java +++ b/router/java/test/junit/net/i2p/router/client/LocalClientManager.java @@ -36,9 +36,10 @@ class LocalClientManager extends ClientManager { @Override protected void startListeners() { - _listener = new LocalClientListenerRunner(_ctx, this, _port); - Thread t = new I2PThread(_listener, "ClientListener:" + _port, true); + ClientListenerRunner listener = new LocalClientListenerRunner(_ctx, this, _port); + Thread t = new I2PThread(listener, "ClientListener:" + _port, true); t.start(); + _listeners.add(listener); _isStarted = true; } From b1caa8d5a365d653e986b3fc3c6c2756a7b8914a Mon Sep 17 00:00:00 2001 From: kytv Date: Tue, 15 Jul 2014 23:46:08 +0000 Subject: [PATCH 09/20] fix URL in initialNews: It's i2p-projekt not i2p-project (thanks to SeekingFor for the heads-up) --- installer/resources/initialNews/initialNews.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/resources/initialNews/initialNews.xml b/installer/resources/initialNews/initialNews.xml index a91ae226e..0432286e0 100644 --- a/installer/resources/initialNews/initialNews.xml +++ b/installer/resources/initialNews/initialNews.xml @@ -14,7 +14,7 @@ _("Do not use SOCKS for this.") _("More information can be found on the {0}I2P browser proxy setup page{1}.", "", "")

-_("Once you have a \"shared clients\" destination listed on the left, please {0}check out{1} our {2}FAQ{3}.", "", "", "", "") +_("Once you have a \"shared clients\" destination listed on the left, please {0}check out{1} our {2}FAQ{3}.", "", "", "", "")

_("Point your IRC client to {0}localhost:6668{1} and say hi to us on {2}#i2p{3}.", "", "", "", "") From 2c7006e9bd126604e58b63684833bf0312b3762b Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 19 Jul 2014 12:39:37 +0000 Subject: [PATCH 10/20] Streaming; Disable fail-fast for now. It's failing on leaseset lookup far too often. Need to fix that first. --- .../java/src/net/i2p/client/streaming/impl/PacketQueue.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/streaming/java/src/net/i2p/client/streaming/impl/PacketQueue.java b/apps/streaming/java/src/net/i2p/client/streaming/impl/PacketQueue.java index 1fdbb943f..102bfa6cc 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/impl/PacketQueue.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/impl/PacketQueue.java @@ -44,6 +44,7 @@ class PacketQueue implements SendMessageStatusListener { private static final int FINAL_TAGS_TO_SEND = 4; private static final int FINAL_TAG_THRESHOLD = 2; private static final long REMOVE_EXPIRED_TIME = 67*1000; + private static final boolean ENABLE_STATUS_LISTEN = false; public PacketQueue(I2PAppContext context, I2PSession session, ConnectionManager mgr) { _context = context; @@ -134,7 +135,7 @@ class PacketQueue implements SendMessageStatusListener { if (con != null) { if (con.isInbound()) options.setSendLeaseSet(false); - else + else if (ENABLE_STATUS_LISTEN) listenForStatus = true; } options.setTagsToSend(INITIAL_TAGS_TO_SEND); From df81006b42d35f273cf3b86e312f62c346a6749d Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 19 Jul 2014 12:40:23 +0000 Subject: [PATCH 11/20] javadoc --- core/java/src/net/i2p/crypto/SessionKeyManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/crypto/SessionKeyManager.java b/core/java/src/net/i2p/crypto/SessionKeyManager.java index cb67c9f3f..c8da3537a 100644 --- a/core/java/src/net/i2p/crypto/SessionKeyManager.java +++ b/core/java/src/net/i2p/crypto/SessionKeyManager.java @@ -29,7 +29,7 @@ public class SessionKeyManager { /** * A dummy SessionKeyManager for testing or for passing to - * ElGamalAESEngine.encrypt() + * ElGamalAESEngine.decrypt() * * @since 0.9.14 */ @@ -37,7 +37,7 @@ public class SessionKeyManager { /** * A dummy SessionKeyManager for testing or for passing to - * ElGamalAESEngine.encrypt() + * ElGamalAESEngine.decrypt() * * @param context unused * @since public since 0.9.14; protected before that From 5d217384100264b57dc52bb87e0cf7549e8cd5cd Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 19 Jul 2014 12:48:16 +0000 Subject: [PATCH 12/20] * i2psnark: Don't prefer leeches during end game, to prevent slowdowns or stalls --- .../java/src/org/klomp/snark/PeerCoordinator.java | 13 +++++++------ history.txt | 5 +++++ router/java/src/net/i2p/router/RouterVersion.java | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java index c43651610..3dcb535cb 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java +++ b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java @@ -1202,22 +1202,23 @@ class PeerCoordinator implements PeerListener boolean skipped = false; for(Piece piece : wantedPieces) { if (piece.getId() == savedPiece) { - if (peer.isCompleted() && piece.getPeerCount() > 1) { + if (peer.isCompleted() && piece.getPeerCount() > 1 && + wantedPieces.size() > 2*END_GAME_THRESHOLD) { // Try to preserve rarest-first - // by not requesting a partial piece that non-seeders also have + // by not requesting a partial piece that at least two non-seeders also have // from a seeder - boolean nonSeeds = false; + int nonSeeds = 0; for (Peer pr : peers) { PeerState state = pr.state; if (state == null) continue; BitField bf = state.bitfield; if (bf == null) continue; if (bf.get(savedPiece) && !pr.isCompleted()) { - nonSeeds = true; - break; + if (++nonSeeds > 1) + break; } } - if (nonSeeds) { + if (nonSeeds > 1) { skipped = true; break; } diff --git a/history.txt b/history.txt index a1927b350..dc1b1f86e 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,8 @@ +2014-07-19 zzz + * i2psnark: Don't prefer leeches during end game, to + prevent slowdowns or stalls + * Streaming; Disable fail-fast for now. + 2014-07-15 str4d * I2CP: Stubs for I2CP connections over Unix domain sockets diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index ea17ad55f..e1f87e077 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 15; + public final static long BUILD = 16; /** for example "-test" */ public final static String EXTRA = ""; From 4b0019c732391feb793d42d941997f86c320618f Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 19 Jul 2014 15:43:51 +0000 Subject: [PATCH 13/20] * SAM: Add support for RAW on the bridge socket in v3 (ticket #1334) log fixes --- apps/sam/java/src/net/i2p/sam/SAMv3Handler.java | 12 ++++++++---- history.txt | 1 + router/java/src/net/i2p/router/RouterVersion.java | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java b/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java index 6a5bf7fa3..043baba68 100644 --- a/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java +++ b/apps/sam/java/src/net/i2p/sam/SAMv3Handler.java @@ -391,7 +391,11 @@ class SAMv3Handler extends SAMv1Handler } else if (domain.equals("NAMING")) { canContinue = execNamingMessage(opcode, props); } else if (domain.equals("DATAGRAM")) { + // TODO not yet overridden, ID is ignored, most recent DATAGRAM session is used canContinue = execDatagramMessage(opcode, props); + } else if (domain.equals("RAW")) { + // TODO not yet overridden, ID is ignored, most recent RAW session is used + canContinue = execRawMessage(opcode, props); } else { if (_log.shouldLog(Log.DEBUG)) _log.debug("Unrecognized message domain: \"" @@ -694,10 +698,10 @@ class SAMv3Handler extends SAMv1Handler else { if (_log.shouldLog(Log.DEBUG)) - _log.debug ( "Unrecognized RAW message opcode: \"" + _log.debug ( "Unrecognized STREAM message opcode: \"" + opcode + "\"" ); try { - notifyStreamResult(true, "I2P_ERROR", "Unrecognized RAW message opcode: "+opcode ); + notifyStreamResult(true, "I2P_ERROR", "Unrecognized STREAM message opcode: "+opcode ); } catch (IOException e) {} return false; } @@ -716,9 +720,9 @@ class SAMv3Handler extends SAMv1Handler String dest = props.getProperty("DESTINATION"); if (dest == null) { - notifyStreamResult(verbose, "I2P_ERROR", "Destination not specified in RAW SEND message"); + notifyStreamResult(verbose, "I2P_ERROR", "Destination not specified in STREAM CONNECT message"); if (_log.shouldLog(Log.DEBUG)) - _log.debug("Destination not specified in RAW SEND message"); + _log.debug("Destination not specified in STREAM CONNECT message"); return false; } props.remove("DESTINATION"); diff --git a/history.txt b/history.txt index dc1b1f86e..cb73fe89f 100644 --- a/history.txt +++ b/history.txt @@ -1,6 +1,7 @@ 2014-07-19 zzz * i2psnark: Don't prefer leeches during end game, to prevent slowdowns or stalls + * SAM: Add support for RAW on the bridge socket in v3 (ticket #1334) * Streaming; Disable fail-fast for now. 2014-07-15 str4d diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index e1f87e077..8ab24107c 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 16; + public final static long BUILD = 17; /** for example "-test" */ public final static String EXTRA = ""; From a2567b0ee2d3f26e36a29c39de601bf0e1b880ca Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 19 Jul 2014 16:31:59 +0000 Subject: [PATCH 14/20] * SusiMail: Better error message on decode fail http://forum.i2p/viewtopic.php?t=11469 --- apps/susimail/src/src/i2p/susi/webmail/WebMail.java | 2 +- history.txt | 1 + router/java/src/net/i2p/router/RouterVersion.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java index eee7e9fbc..12132726d 100644 --- a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java +++ b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java @@ -614,7 +614,7 @@ public class WebMail extends HttpServlet } catch (Exception e1) { showBody = false; - reason += _("Part ({0}) not shown, because of {1}", ident, e1.getClass().getName()) + br; + reason += _("Part ({0}) not shown, because of {1}", ident, e1.toString()) + br; } } if( html ) diff --git a/history.txt b/history.txt index cb73fe89f..8748f6f5b 100644 --- a/history.txt +++ b/history.txt @@ -3,6 +3,7 @@ prevent slowdowns or stalls * SAM: Add support for RAW on the bridge socket in v3 (ticket #1334) * Streaming; Disable fail-fast for now. + * SusiMail: Better error message on decode fail 2014-07-15 str4d * I2CP: Stubs for I2CP connections over Unix domain sockets diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 8ab24107c..80cfb9c84 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 17; + public final static long BUILD = 18; /** for example "-test" */ public final static String EXTRA = ""; From 3a899d52d15f162bf1964fca79f38751c6e0ae9a Mon Sep 17 00:00:00 2001 From: str4d Date: Sat, 19 Jul 2014 23:55:43 +0000 Subject: [PATCH 15/20] Don't grab the ClientApp if we don't need to --- .../java/src/net/i2p/router/web/PluginStarter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java index baad6df99..5d385024f 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java @@ -671,9 +671,9 @@ public class PluginStarter implements Runnable { for(ClientAppConfig app : apps) { // If the client is a running ClientApp that we want to stop, // bypass all the logic below. - ClientApp ca = ctx.routerAppManager().getClientApp(app.className, LoadClientAppsJob.parseArgs(app.args)); - if (ca != null && ca.getState() == ClientAppState.RUNNING) { - if (action.equals("stop")) { + if (action.equals("stop")) { + ClientApp ca = ctx.routerAppManager().getClientApp(app.className, LoadClientAppsJob.parseArgs(app.args)); + if (ca != null && ca.getState() == ClientAppState.RUNNING) { try { ca.shutdown(LoadClientAppsJob.parseArgs(app.stopargs)); } catch (Throwable t) { From f38b7418136d7cceb91458451f173cc181991acf Mon Sep 17 00:00:00 2001 From: meeh Date: Mon, 21 Jul 2014 01:47:37 +0000 Subject: [PATCH 16/20] Adding sindu's reseed key. ( i2p-netdb.innovatio.no ) --- .../certificates/reseed/sindu_at_mail.i2p.crt | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 installer/resources/certificates/reseed/sindu_at_mail.i2p.crt diff --git a/installer/resources/certificates/reseed/sindu_at_mail.i2p.crt b/installer/resources/certificates/reseed/sindu_at_mail.i2p.crt new file mode 100644 index 000000000..be1010f9b --- /dev/null +++ b/installer/resources/certificates/reseed/sindu_at_mail.i2p.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFezCCA2OgAwIBAgIEPSs1SjANBgkqhkiG9w0BAQ0FADBuMQswCQYDVQQGEwJY +WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt +b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEXMBUGA1UEAwwOc2luZHVAbWFpbC5p +MnAwHhcNMTQwNzIxMDAwNjUwWhcNMjQwNzIwMDAwNjUwWjBuMQswCQYDVQQGEwJY +WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt +b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEXMBUGA1UEAwwOc2luZHVAbWFpbC5p +MnAwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnYMNclgj1gIJfot6f +65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ADC5w5HdVvIGJ +1Czva8kTcmC6AMc+4tACGqYZEAEokkeXn+pIIqKVj2eQukT/0dLGGHbKmxp3Z0f2 +pIH2Draq8JPdacr9P/xqEWUuViaOuC5OBjY8Fg3fmVCpwefIuk+DBhbJjEugB0Cu +brJpqNznoYahkbyAXIA8T+QJYMhoGWmaIcaPWK6K3nArvaxzwJbb9Egyivhyp9Rr +r2QMEZ+cPO8p1mEhKpL/wGqAzYyla8SJ06PzLc1lQeGiClu1nbZj5AgkZ1DLa8SD +iO7+e6rS0q1bzc7smE5JzZRiOVqKij/ReKa2uebLLI4wgAhz5ymaD1HfZY+3dV9T +WX89Xn2UyQf5kHifiDKL +-----END CERTIFICATE----- From b282ccd89026209c3a8389864b10f24977f0930f Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 21 Jul 2014 13:23:14 +0000 Subject: [PATCH 17/20] increment error count on exception --- router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java | 1 + 1 file changed, 1 insertion(+) diff --git a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java index 3bcb7d8d9..78bda0b40 100644 --- a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java +++ b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java @@ -535,6 +535,7 @@ public class Reseeder { } } catch (Throwable t) { _log.warn("Error reseeding", t); + errors++; } finally { if (contentRaw != null) contentRaw.delete(); From c3bf1000820d2b980052dafbbffbd3559bf4470a Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 21 Jul 2014 13:24:13 +0000 Subject: [PATCH 18/20] readme_fr.html thx hummingbird --- installer/resources/readme/readme_fr.html | 287 ++++++++++------------ 1 file changed, 131 insertions(+), 156 deletions(-) diff --git a/installer/resources/readme/readme_fr.html b/installer/resources/readme/readme_fr.html index f30a4003e..1060c7253 100644 --- a/installer/resources/readme/readme_fr.html +++ b/installer/resources/readme/readme_fr.html @@ -1,109 +1,96 @@

-
From 9b408b67ef76b7b32f681b2e147c799c8cb00c8c Mon Sep 17 00:00:00 2001 From: meeh Date: Mon, 21 Jul 2014 18:07:02 +0000 Subject: [PATCH 19/20] Adding Matt's SU3 reseed key. --- .../reseed/matt_at_drollette.com.crt | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 installer/resources/certificates/reseed/matt_at_drollette.com.crt diff --git a/installer/resources/certificates/reseed/matt_at_drollette.com.crt b/installer/resources/certificates/reseed/matt_at_drollette.com.crt new file mode 100644 index 000000000..e490a152a --- /dev/null +++ b/installer/resources/certificates/reseed/matt_at_drollette.com.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIEB52rdjANBgkqhkiG9w0BAQ0FADByMQswCQYDVQQGEwJY +WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt +b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEbMBkGA1UEAwwSbWF0dEBkcm9sbGV0 +dGUuY29tMB4XDTE0MDcyMTEzMjYxM1oXDTI0MDcyMDEzMjYxM1owcjELMAkGA1UE +BhMCWFgxCzAJBgNVBAgTAlhYMQswCQYDVQQHEwJYWDEeMBwGA1UEChMVSTJQIEFu +b255bW91cyBOZXR3b3JrMQwwCgYDVQQLEwNJMlAxGzAZBgNVBAMMEm1hdHRAZHJv +bGxldHRlLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL5M9wKT +csNLg4EA3fW7LleTQdrm3stPnoUvFmsNZHGgsKt1Nc1qCNis3kr2QEY+4Z398U7r +7xGEQFa7D/9SPHf6n1uVXc9DIcmwBtEB0FPB1XPFp2h00ZXIv24yiLN3GQT1woAM +yEbBWsUgn8K/iMBeA5dU2vPwAbGO/0ibD62frgGdYqU2EeiJ/U6vBmKxvC+q2noL +gnyfQJEJANXgf+Cw/gBaS6yn5ZsYcenLNenID2TQKQ6Q/NxYrD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Ik+xFqC5oHUTSEmfqA6sA5o/RqdwDpkfpgI5mCwhYzDSLD +jfS+263ylhanl7oz0sM+GtH63owVbYJAFT2EozT9siTIErvJESL4Z80yUQG63d/7 +fss8T6gOo19esb/KEMZGZE4pAApakWM= +-----END CERTIFICATE----- From ce4874d825e4a2b6b8ca566f778785e5565784d2 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 21 Jul 2014 20:05:05 +0000 Subject: [PATCH 20/20] better logging of reseed su3 errors --- router/java/src/net/i2p/router/RouterVersion.java | 2 +- router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 80cfb9c84..5b1ba79e3 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 18; + public final static long BUILD = 19; /** for example "-test" */ public final static String EXTRA = ""; diff --git a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java index 78bda0b40..af605cc8e 100644 --- a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java +++ b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java @@ -534,7 +534,8 @@ public class Reseeder { break; } } catch (Throwable t) { - _log.warn("Error reseeding", t); + System.err.println("Error reseeding: " + t); + _log.error("Error reseeding", t); errors++; } finally { if (contentRaw != null)