From 3474b827b06b3a285d04aba64873243d87d4823a Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 19 Mar 2016 15:16:38 +0000 Subject: [PATCH 01/21] add raw signing test --- core/java/src/net/i2p/crypto/KeyGenerator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/java/src/net/i2p/crypto/KeyGenerator.java b/core/java/src/net/i2p/crypto/KeyGenerator.java index 4297fcae2..6a087c50a 100644 --- a/core/java/src/net/i2p/crypto/KeyGenerator.java +++ b/core/java/src/net/i2p/crypto/KeyGenerator.java @@ -15,6 +15,7 @@ import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; +import java.security.MessageDigest; import java.security.ProviderException; import java.security.interfaces.ECPrivateKey; import java.security.interfaces.ECPublicKey; @@ -416,19 +417,30 @@ public final class KeyGenerator { else System.out.println(type + " private-to-public test FAILED"); //System.out.println("privkey " + keys[1]); + MessageDigest md = type.getDigestInstance(); for (int i = 0; i < runs; i++) { RandomSource.getInstance().nextBytes(src); + md.update(src); + byte[] sha = md.digest(); + SimpleDataStructure hash = type.getHashInstance(); + hash.setData(sha); long start = System.nanoTime(); Signature sig = DSAEngine.getInstance().sign(src, privkey); + Signature sig2 = DSAEngine.getInstance().sign(hash, privkey); if (sig == null) throw new GeneralSecurityException("signature generation failed"); + if (sig2 == null) + throw new GeneralSecurityException("signature generation (H) failed"); long mid = System.nanoTime(); boolean ok = DSAEngine.getInstance().verifySignature(sig, src, pubkey); + boolean ok2 = DSAEngine.getInstance().verifySignature(sig2, hash, pubkey); long end = System.nanoTime(); stime += mid - start; vtime += end - mid; if (!ok) throw new GeneralSecurityException(type + " V(S(data)) fail"); + if (!ok2) + throw new GeneralSecurityException(type + " V(S(H(data))) fail"); } stime /= 1000*1000; vtime /= 1000*1000; From 2e7a7f26f88b99f7dcf96196c524c5164883a55b Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 19 Mar 2016 15:18:07 +0000 Subject: [PATCH 02/21] take out code for stats removed in .24 --- router/java/src/net/i2p/router/StatisticsManager.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/router/java/src/net/i2p/router/StatisticsManager.java b/router/java/src/net/i2p/router/StatisticsManager.java index 9379df350..eeda3709c 100644 --- a/router/java/src/net/i2p/router/StatisticsManager.java +++ b/router/java/src/net/i2p/router/StatisticsManager.java @@ -71,9 +71,8 @@ public class StatisticsManager { public Properties publishStatistics(Hash h) { Properties stats = new Properties(); stats.setProperty("router.version", RouterVersion.VERSION); - // scheduled for removal, never used - if (CoreVersion.VERSION.equals("0.9.23")) - stats.setProperty("coreVersion", CoreVersion.VERSION); + // never used + //stats.setProperty("coreVersion", CoreVersion.VERSION); stats.setProperty(RouterInfo.PROP_NETWORK_ID, _networkID); stats.setProperty(RouterInfo.PROP_CAPABILITIES, _context.router().getCapabilities()); @@ -168,9 +167,7 @@ public class StatisticsManager { } // So that we will still get build requests - not required since 0.7.9 2010-01-12 - // scheduled for removal - if (CoreVersion.VERSION.equals("0.9.23")) - stats.setProperty("stat_uptime", "90m"); + //stats.setProperty("stat_uptime", "90m"); if (FloodfillNetworkDatabaseFacade.isFloodfill(_context.router().getRouterInfo())) { int ri = _context.router().getUptime() > 30*60*1000 ? _context.netDb().getKnownRouters() : From ed72847374f1d0081e46b9e9159519b8ab3fcea3 Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 20 Mar 2016 13:21:40 +0000 Subject: [PATCH 03/21] Add SystemVersion.isOpenJDK() Add warning for OpenJDK + ARM --- .../src/net/i2p/router/web/RouterConsoleRunner.java | 10 ++++++++-- core/java/src/net/i2p/util/CommandLine.java | 2 +- core/java/src/net/i2p/util/SystemVersion.java | 13 +++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java index 8315cdd6b..d6c0be0a7 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java @@ -293,6 +293,7 @@ public class RouterConsoleRunner implements RouterApp { private void checkJavaVersion() { boolean noJava7 = !SystemVersion.isJava7(); boolean noPack200 = !FileUtil.isPack200Supported(); + boolean openARM = SystemVersion.isARM() && SystemVersion.isOpenJDK(); if (noJava7 || noPack200) { String s = "Java version: " + System.getProperty("java.version") + " OS: " + System.getProperty("os.name") + ' ' + @@ -302,12 +303,17 @@ public class RouterConsoleRunner implements RouterApp { log.logAlways(net.i2p.util.Log.WARN, s); System.out.println("Warning: " + s); if (noJava7) { - s = "Java 7 will be required by late 2015, please upgrade soon"; + s = "Java 7 is now required, please upgrade"; log.logAlways(net.i2p.util.Log.WARN, s); System.out.println("Warning: " + s); } if (noPack200) { - s = "Pack200 will be required by late 2015, please upgrade Java soon"; + s = "Pack200 is required for automatic updates, please upgrade Java"; + log.logAlways(net.i2p.util.Log.WARN, s); + System.out.println("Warning: " + s); + } + if (openARM) { + s = "OpenJDK is not recommended for ARM. Use Oracle Java 8"; log.logAlways(net.i2p.util.Log.WARN, s); System.out.println("Warning: " + s); } diff --git a/core/java/src/net/i2p/util/CommandLine.java b/core/java/src/net/i2p/util/CommandLine.java index 737187488..f2d57f534 100644 --- a/core/java/src/net/i2p/util/CommandLine.java +++ b/core/java/src/net/i2p/util/CommandLine.java @@ -37,7 +37,7 @@ public class CommandLine { "net.i2p.util.PartialEepGet", "net.i2p.util.ShellCommand", "net.i2p.util.SSLEepGet", - //"net.i2p.util.SystemVersion", + "net.i2p.util.SystemVersion", "net.i2p.util.TranslateReader", "net.i2p.util.ZipFileComment" }); diff --git a/core/java/src/net/i2p/util/SystemVersion.java b/core/java/src/net/i2p/util/SystemVersion.java index 47644f427..a8d83755b 100644 --- a/core/java/src/net/i2p/util/SystemVersion.java +++ b/core/java/src/net/i2p/util/SystemVersion.java @@ -26,6 +26,7 @@ public abstract class SystemVersion { private static final boolean _isAndroid; private static final boolean _isApache; private static final boolean _isGNU; + private static final boolean _isOpenJDK; private static final boolean _is64; private static final boolean _hasWrapper = System.getProperty("wrapper.version") != null; @@ -53,6 +54,8 @@ public abstract class SystemVersion { _isApache = vendor.startsWith("Apache"); _isGNU = vendor.startsWith("GNU Classpath") || // JamVM vendor.startsWith("Free Software Foundation"); // gij + String runtime = System.getProperty("java.runtime.name"); + _isOpenJDK = runtime != null && runtime.contains("OpenJDK"); int sdk = 0; if (_isAndroid) { @@ -110,6 +113,13 @@ public abstract class SystemVersion { return _isGentoo; } + /** + * @since 0.9.26 + */ + public static boolean isOpenJDK() { + return _isOpenJDK; + } + /** * @since 0.9.8 */ @@ -238,7 +248,6 @@ public abstract class SystemVersion { /** * @since 0.9.24 */ -/**** public static void main(String[] args) { System.out.println("64 bit : " + is64Bit()); System.out.println("Java 6 : " + isJava6()); @@ -253,11 +262,11 @@ public abstract class SystemVersion { System.out.println("Mac : " + isMac()); System.out.println("Gentoo : " + isGentoo()); System.out.println("GNU : " + isGNU()); + System.out.println("OpenJDK : " + isOpenJDK()); System.out.println("Windows : " + isWindows()); System.out.println("Wrapper : " + hasWrapper()); System.out.println("x86 : " + isX86()); System.out.println("Max mem : " + getMaxMemory()); } -****/ } From 557f16b8d5e5932fc5e6510c35d6c385008cfd40 Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 20 Mar 2016 13:41:26 +0000 Subject: [PATCH 04/21] NetDB: Improve handling of deferred search result jobs --- .../networkdb/kademlia/FloodOnlySearchJob.java | 1 + .../router/networkdb/kademlia/FloodSearchJob.java | 13 +++++++++++-- .../networkdb/kademlia/IterativeSearchJob.java | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java index 39e410185..6a8e6da17 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java @@ -232,6 +232,7 @@ class FloodOnlySearchJob extends FloodSearchJob { synchronized (this) { if (_dead) return; _dead = true; + super.success(); } if (_log.shouldLog(Log.INFO)) _log.info(getJobId() + ": Floodfill search for " + _key + " successful"); diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/FloodSearchJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodSearchJob.java index 316cf3ff6..99e212e97 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodSearchJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodSearchJob.java @@ -33,6 +33,7 @@ public class FloodSearchJob extends JobImpl { protected final AtomicInteger _lookupsRemaining = new AtomicInteger(); protected volatile boolean _dead; protected final long _created; + protected boolean _success; /** * @param onFind may be null @@ -69,6 +70,7 @@ public class FloodSearchJob extends JobImpl { * @param isLease ignored */ void addDeferred(Job onFind, Job onFailed, long timeoutMs, boolean isLease) { + boolean success; synchronized (this) { if (!_dead) { if (onFind != null) @@ -77,9 +79,13 @@ public class FloodSearchJob extends JobImpl { _onFailed.add(onFailed); return; } + success = _success; } // outside synch to avoid deadlock with job queue - getContext().jobQueue().addJob(onFailed); + if (success && onFind != null) + getContext().jobQueue().addJob(onFind); + else if (!success && onFailed != null) + getContext().jobQueue().addJob(onFailed); } /** using context clock */ @@ -193,8 +199,11 @@ public class FloodSearchJob extends JobImpl { * Deprecated, unused, see FOSJ override */ void success() { - throw new UnsupportedOperationException("use override"); + synchronized(this) { + _success = true; + } /**** + throw new UnsupportedOperationException("use override"); if (_dead) return; if (_log.shouldLog(Log.INFO)) _log.info(getJobId() + ": Floodfill search for " + _key.toBase64() + " successful"); diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/IterativeSearchJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/IterativeSearchJob.java index 58f045c28..014924bab 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/IterativeSearchJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/IterativeSearchJob.java @@ -587,6 +587,7 @@ class IterativeSearchJob extends FloodSearchJob { synchronized(this) { if (_dead) return; _dead = true; + _success = true; tries = _unheardFrom.size() + _failedPeers.size(); if (_unheardFrom.size() == 1) { peer = _unheardFrom.iterator().next(); From 7eed4fa97b34a3d989a20933709c9ce84bced220 Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 23 Mar 2016 13:46:33 +0000 Subject: [PATCH 05/21] build dependency tweak --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 4d8e1bd3f..3120ae555 100644 --- a/build.xml +++ b/build.xml @@ -318,7 +318,7 @@ - + From 1da9c21f13a002d84167c9aaa03373fffbcc020c Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 23 Mar 2016 13:53:26 +0000 Subject: [PATCH 06/21] drop kytv certs --- .../news/killyourtv_at_mail.i2p.crt | 32 ------------------- .../router/killyourtv_at_mail.i2p.crt | 32 ------------------- installer/resources/deletelist.txt | 2 ++ 3 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 installer/resources/certificates/news/killyourtv_at_mail.i2p.crt delete mode 100644 installer/resources/certificates/router/killyourtv_at_mail.i2p.crt diff --git a/installer/resources/certificates/news/killyourtv_at_mail.i2p.crt b/installer/resources/certificates/news/killyourtv_at_mail.i2p.crt deleted file mode 100644 index 597f455f3..000000000 --- a/installer/resources/certificates/news/killyourtv_at_mail.i2p.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFhTCCA22gAwIBAgIELuRWgDANBgkqhkiG9w0BAQ0FADBzMQswCQYDVQQGEwJY -WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt -b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEcMBoGA1UEAwwTa2lsbHlvdXJ0dkBt -YWlsLmkycDAeFw0xMzEwMDYyMTM5MzFaFw0yMzEwMDYyMTM5MzFaMHMxCzAJBgNV -BAYTAlhYMQswCQYDVQQIEwJYWDELMAkGA1UEBxMCWFgxHjAcBgNVBAoTFUkyUCBB -bm9ueW1vdXMgTmV0d29yazEMMAoGA1UECxMDSTJQMRwwGgYDVQQDDBNraWxseW91 -cnR2QG1haWwuaTJwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAig3u -niLWm0y/TFJtciHgmWUt20FOdQrxkiSZ87G8xjuGfq7TbGIiVDn7pQZcHidpq+Dk -47sm+Swqhb4psSijj0AXUEVKlV39jF5IZE+VUgmEtMqQbnBkWudaTJPWcEe9T/Kd -8Oz2jgsnrD/EGVTMKBBjt/gk8VqTWvpCdCF1GhqcCeUTFHzjhN9jtoRCaJ2DClpO -Px+86+d3s9PqUFo8gcD/dbbyJCMqUCMBLtIy/Ooouxb9cfWtXfyOlphU+enmdvuA -0BDewb9pOJg2/kVd9/9moDWcBGChLOlfSlxpDwyUtcclcpvwnG7c6o4or6gqLeOf -AbCpse623utV7fWlFWG7M4AQ/2emhhe4YoMJQnflydzV8bPRJxRTeW1j/9UfpvLT -nO5LHp0oBXE0GqAPjxuAr+r5IDXFbkKYNjK5oWQB/Ul3LkexulYdCzHWbGd1Ja5b -sbiOy6t/hH6G8DD75HYb+PQZaNZWBv90EyOq1JDSUPw6nxVbhiBldi3ipc8/1X51 -FbzBqJ+QO1XKrKqxWxBKoTekuy38KRzsmkSCpY+WJ9f0gLOKtxzVO2HNNqqVFGQf -RGIbrNA0JSRQ1fgelccfrcRIXIZ3B8Tk/wxCIzCY6Yvg2jezz2xJkVdqOUsznS2v -+xJe67PYIAeMVtcfO4kmuCvyIYhsUEpob2n/5lkCAwEAAaMhMB8wHQYDVR0OBBYE -FCLneov6QMtvra5FSoSLhdymi++rMA0GCSqGSIb3DQEBDQUAA4ICAQAIcqbiwjdQ -M9VlGBiHe5eVsL6OM9zfRqR1wnRg4Q6ce65XDfEOYleBWaaNJA4BdykcA4fkUN1h -M2D9FDQScsyPTOuzJ6o75TYh0JOtF51yCi9iuemcosxAwsm90ZXGuMDfDYeyND5c -PAkWfyCP+jwLYbNo/hkNqyv+XWHXPQmT2adRnPXINVUQuBxVPC//C9wv2uDYWhgS -f8M425VPp4/R/uks9mlzTx08DwacvouD0YOC+HZE4sWq+2smgeBInMiyr/THYzl+ -baMtYgVs8IKUD2gtjfXZoaQNg3eq5SedSf/5F0S/LCdu9/ccQ8CzSEoVTiQFtO78 -SaU37xai8+QTSVpPuINigxCoXmkubBd+voEmWRcBd/XB5L+u+MFU/jXyyBj2BXVj -6agqVzY53KVYt23/63QliAUWyxT+ns9gRxVN1jrMhHdiDwsdT4NbzHxg1Su4eiHv -C/wjD3Dga0BRTEGylpHZGzb1U1rZRHM3ho3f1QkmRPPLcBUMTyUTxJm+GEeuhPvp -+TBf3Kg/YkdpnEMlagqcyHuIrf3m8Z/pTmpOIbekJWbbA7tluvWbMWw2ARB7dUOE -fHYVISh0DTw2oVXxM82/q8XXHnhEXv2nW3K40x1VabxUN+sF4M/7YA8nJqwsPJei -749STYJRfZXdIe69M9zpM5unxENAsiPJgQ== ------END CERTIFICATE----- diff --git a/installer/resources/certificates/router/killyourtv_at_mail.i2p.crt b/installer/resources/certificates/router/killyourtv_at_mail.i2p.crt deleted file mode 100644 index 597f455f3..000000000 --- a/installer/resources/certificates/router/killyourtv_at_mail.i2p.crt +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFhTCCA22gAwIBAgIELuRWgDANBgkqhkiG9w0BAQ0FADBzMQswCQYDVQQGEwJY -WDELMAkGA1UECBMCWFgxCzAJBgNVBAcTAlhYMR4wHAYDVQQKExVJMlAgQW5vbnlt -b3VzIE5ldHdvcmsxDDAKBgNVBAsTA0kyUDEcMBoGA1UEAwwTa2lsbHlvdXJ0dkBt -YWlsLmkycDAeFw0xMzEwMDYyMTM5MzFaFw0yMzEwMDYyMTM5MzFaMHMxCzAJBgNV -BAYTAlhYMQswCQYDVQQIEwJYWDELMAkGA1UEBxMCWFgxHjAcBgNVBAoTFUkyUCBB -bm9ueW1vdXMgTmV0d29yazEMMAoGA1UECxMDSTJQMRwwGgYDVQQDDBNraWxseW91 -cnR2QG1haWwuaTJwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAig3u -niLWm0y/TFJtciHgmWUt20FOdQrxkiSZ87G8xjuGfq7TbGIiVDn7pQZcHidpq+Dk -47sm+Swqhb4psSijj0AXUEVKlV39jF5IZE+VUgmEtMqQbnBkWudaTJPWcEe9T/Kd -8Oz2jgsnrD/EGVTMKBBjt/gk8VqTWvpCdCF1GhqcCeUTFHzjhN9jtoRCaJ2DClpO -Px+86+d3s9PqUFo8gcD/dbbyJCMqUCMBLtIy/Ooouxb9cfWtXfyOlphU+enmdvuA -0BDewb9pOJg2/kVd9/9moDWcBGChLOlfSlxpDwyUtcclcpvwnG7c6o4or6gqLeOf -AbCpse623utV7fWlFWG7M4AQ/2emhhe4YoMJQnflydzV8bPRJxRTeW1j/9UfpvLT -nO5LHp0oBXE0GqAPjxuAr+r5IDXFbkKYNjK5oWQB/Ul3LkexulYdCzHWbGd1Ja5b -sbiOy6t/hH6G8DD75HYb+PQZaNZWBv90EyOq1JDSUPw6nxVbhiBldi3ipc8/1X51 -FbzBqJ+QO1XKrKqxWxBKoTekuy38KRzsmkSCpY+WJ9f0gLOKtxzVO2HNNqqVFGQf -RGIbrNA0JSRQ1fgelccfrcRIXIZ3B8Tk/wxCIzCY6Yvg2jezz2xJkVdqOUsznS2v -+xJe67PYIAeMVtcfO4kmuCvyIYhsUEpob2n/5lkCAwEAAaMhMB8wHQYDVR0OBBYE -FCLneov6QMtvra5FSoSLhdymi++rMA0GCSqGSIb3DQEBDQUAA4ICAQAIcqbiwjdQ -M9VlGBiHe5eVsL6OM9zfRqR1wnRg4Q6ce65XDfEOYleBWaaNJA4BdykcA4fkUN1h -M2D9FDQScsyPTOuzJ6o75TYh0JOtF51yCi9iuemcosxAwsm90ZXGuMDfDYeyND5c -PAkWfyCP+jwLYbNo/hkNqyv+XWHXPQmT2adRnPXINVUQuBxVPC//C9wv2uDYWhgS -f8M425VPp4/R/uks9mlzTx08DwacvouD0YOC+HZE4sWq+2smgeBInMiyr/THYzl+ -baMtYgVs8IKUD2gtjfXZoaQNg3eq5SedSf/5F0S/LCdu9/ccQ8CzSEoVTiQFtO78 -SaU37xai8+QTSVpPuINigxCoXmkubBd+voEmWRcBd/XB5L+u+MFU/jXyyBj2BXVj -6agqVzY53KVYt23/63QliAUWyxT+ns9gRxVN1jrMhHdiDwsdT4NbzHxg1Su4eiHv -C/wjD3Dga0BRTEGylpHZGzb1U1rZRHM3ho3f1QkmRPPLcBUMTyUTxJm+GEeuhPvp -+TBf3Kg/YkdpnEMlagqcyHuIrf3m8Z/pTmpOIbekJWbbA7tluvWbMWw2ARB7dUOE -fHYVISh0DTw2oVXxM82/q8XXHnhEXv2nW3K40x1VabxUN+sF4M/7YA8nJqwsPJei -749STYJRfZXdIe69M9zpM5unxENAsiPJgQ== ------END CERTIFICATE----- diff --git a/installer/resources/deletelist.txt b/installer/resources/deletelist.txt index ef420c376..e68113e60 100644 --- a/installer/resources/deletelist.txt +++ b/installer/resources/deletelist.txt @@ -97,3 +97,5 @@ certificates/ssl/ieb9oopo.mooo.com2.crt certificates/ssl/netdb.i2p2.no2.crt certificates/ssl/i2p.mooo.com2.crt certificates/ssl/ieb9oopo.mooo.com.crt +certificates/news/killyourtv_at_mail.i2p.crt +certificates/router/killyourtv_at_mail.i2p.crt From 2eb89e938a806fc5f2e2c9d2c5935dd7dd828ba9 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 4 Jun 2016 12:50:24 +0000 Subject: [PATCH 07/21] i2ptunnel CLI: Don't set the listen host to the I2CP host --- apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java index 99d225a34..fc9ecebfd 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java @@ -1338,7 +1338,6 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging { } if (i < args.length) { host = args[i++]; - listenHost = host; } if (i < args.length) port = args[i]; From 126a4d8443b94e447bfd016b7175d43769bf62b4 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 4 Jun 2016 13:23:05 +0000 Subject: [PATCH 08/21] jbigi: Fix GMP version reporting for shared library (ticket #1800) --- core/c/jbigi/jbigi/src/jbigi.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/core/c/jbigi/jbigi/src/jbigi.c b/core/c/jbigi/jbigi/src/jbigi.c index a9c5db544..dda0a5f6a 100644 --- a/core/c/jbigi/jbigi/src/jbigi.c +++ b/core/c/jbigi/jbigi/src/jbigi.c @@ -1,4 +1,5 @@ #include +#include #include #include "jbigi.h" @@ -15,7 +16,7 @@ void convert_mp2j(JNIEnv* env, mpz_t mvalue, jbyteArray* jvalue); * 2: (I2P 0.8.7) * Removed nativeDoubleValue() * - * 3: (I2P 0.9.18) + * 3: (I2P 0.9.26) * Added: * nativeJbigiVersion() * nativeGMPMajorVersion() @@ -26,8 +27,12 @@ void convert_mp2j(JNIEnv* env, mpz_t mvalue, jbyteArray* jvalue); * Support negative base value in modPow() * Throw ArithmeticException for bad arguments in modPow() * + * 4: (I2P 0.9.27) + * Fix nativeGMPMajorVersion(), nativeGMPMinorVersion(), and nativeGMPPatchVersion() + * when built as a shared library + * */ -#define JBIGI_VERSION 3 +#define JBIGI_VERSION 4 /***************************************** *****Native method implementations******* @@ -39,22 +44,31 @@ JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeJbigiVersion return (jint) JBIGI_VERSION; } -/* since version 3 */ +/* since version 3, fixed for dynamic builds in version 4 */ JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeGMPMajorVersion (JNIEnv* env, jclass cls) { - return (jint) __GNU_MP_VERSION; + int v = gmp_version[0] - '0'; + return (jint) v; } -/* since version 3 */ +/* since version 3, fixed for dynamic builds in version 4 */ JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeGMPMinorVersion (JNIEnv* env, jclass cls) { - return (jint) __GNU_MP_VERSION_MINOR; + int v = 0; + if (strlen(gmp_version) > 2) { + v = gmp_version[2] - '0'; + } + return (jint) v; } -/* since version 3 */ +/* since version 3, fixed for dynamic builds in version 4 */ JNIEXPORT jint JNICALL Java_net_i2p_util_NativeBigInteger_nativeGMPPatchVersion (JNIEnv* env, jclass cls) { - return (jint) __GNU_MP_VERSION_PATCHLEVEL; + int v = 0; + if (strlen(gmp_version) > 4) { + v = gmp_version[4] - '0'; + } + return (jint) v; } /******** nativeModPow() */ From f564d4dc22af38be1a122ef4cfe3037e2bb5b0dd Mon Sep 17 00:00:00 2001 From: str4d Date: Sun, 5 Jun 2016 12:57:32 +0000 Subject: [PATCH 09/21] Fixes for a bunch of old unused code to make it compile --- .../src/net/i2p/router/admin/AdminRunner.java | 8 +++++--- .../net/i2p/sam/TestCreateSessionDatagram.java | 1 + .../test/net/i2p/sam/TestCreateSessionRaw.java | 1 + .../test/net/i2p/sam/TestDatagramTransfer.java | 12 +++--------- apps/sam/java/test/net/i2p/sam/TestDest.java | 1 + apps/sam/java/test/net/i2p/sam/TestNaming.java | 1 + .../java/test/net/i2p/sam/TestRawTransfer.java | 13 ++++--------- .../test/net/i2p/sam/TestStreamTransfer.java | 17 +++++------------ apps/sam/java/test/net/i2p/sam/TestSwarm.java | 8 ++++---- 9 files changed, 25 insertions(+), 37 deletions(-) diff --git a/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java b/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java index d5c63c60d..af9eeb6cb 100644 --- a/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java +++ b/apps/admin/java/src/net/i2p/router/admin/AdminRunner.java @@ -11,9 +11,10 @@ import java.util.Iterator; import java.util.Set; import net.i2p.data.Hash; -import net.i2p.data.DataHelper +import net.i2p.data.DataHelper; import net.i2p.router.Router; import net.i2p.router.RouterContext; +import net.i2p.router.web.StatsGenerator; import net.i2p.util.I2PThread; import net.i2p.util.Log; @@ -49,7 +50,7 @@ class AdminRunner implements Runnable { } else if ( (command.indexOf("routerStats.html") >= 0) || (command.indexOf("oldstats.jsp") >= 0) ) { try { out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n")); - _generator.generateStatsPage(new OutputStreamWriter(out)); + _generator.generateStatsPage(new OutputStreamWriter(out), true); out.close(); } catch (IOException ioe) { if (_log.shouldLog(Log.WARN)) @@ -63,7 +64,8 @@ class AdminRunner implements Runnable { } else if (true || command.indexOf("routerConsole.html") > 0) { try { out.write(DataHelper.getASCII("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n")); - _context.router().renderStatusHTML(new OutputStreamWriter(out)); + // TODO Not technically the same as router().renderStatusHTML() was + _context.routerAppManager().renderStatusHTML(new OutputStreamWriter(out)); out.close(); } catch (IOException ioe) { if (_log.shouldLog(Log.WARN)) diff --git a/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java b/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java index 612a0424d..a1b903f2a 100644 --- a/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java +++ b/apps/sam/java/test/net/i2p/sam/TestCreateSessionDatagram.java @@ -5,6 +5,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Socket; +import net.i2p.data.DataHelper; import net.i2p.util.Log; public class TestCreateSessionDatagram { diff --git a/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java b/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java index 7ce071623..36af253d7 100644 --- a/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java +++ b/apps/sam/java/test/net/i2p/sam/TestCreateSessionRaw.java @@ -5,6 +5,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Socket; +import net.i2p.data.DataHelper; import net.i2p.util.Clock; import net.i2p.util.Log; diff --git a/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java b/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java index 52c0e2a10..1bb01b280 100644 --- a/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java +++ b/apps/sam/java/test/net/i2p/sam/TestDatagramTransfer.java @@ -37,11 +37,8 @@ public class TestDatagramTransfer { line = reader.readLine(); _log.info("Response from the lookup for ME: " + line); _log.debug("The above should be a NAMING REPLY"); - - StringTokenizer tok = new StringTokenizer(line); - String maj = tok.nextToken(); - String min = tok.nextToken(); - Properties props = SAMUtils.parseParams(tok); + + Properties props = SAMUtils.parseParams(line); String value = props.getProperty("VALUE"); if (value == null) { _log.error("No value for ME found! [" + line + "]"); @@ -53,10 +50,7 @@ public class TestDatagramTransfer { String send = "DATAGRAM SEND DESTINATION=" + value + " SIZE=3\nYo!"; out.write(DataHelper.getASCII(send)); line = reader.readLine(); - tok = new StringTokenizer(line); - maj = tok.nextToken(); - min = tok.nextToken(); - props = SAMUtils.parseParams(tok); + props = SAMUtils.parseParams(line); String size = props.getProperty("SIZE"); String from = props.getProperty("DESTINATION"); if ( (value == null) || (size == null) || diff --git a/apps/sam/java/test/net/i2p/sam/TestDest.java b/apps/sam/java/test/net/i2p/sam/TestDest.java index 2662b5835..9a2cdec63 100644 --- a/apps/sam/java/test/net/i2p/sam/TestDest.java +++ b/apps/sam/java/test/net/i2p/sam/TestDest.java @@ -5,6 +5,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Socket; +import net.i2p.data.DataHelper; import net.i2p.util.Log; public class TestDest { diff --git a/apps/sam/java/test/net/i2p/sam/TestNaming.java b/apps/sam/java/test/net/i2p/sam/TestNaming.java index a926b828b..79d889a78 100644 --- a/apps/sam/java/test/net/i2p/sam/TestNaming.java +++ b/apps/sam/java/test/net/i2p/sam/TestNaming.java @@ -5,6 +5,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.net.Socket; +import net.i2p.data.DataHelper; import net.i2p.util.Log; public class TestNaming { diff --git a/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java b/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java index 584a7fb78..0bff5939d 100644 --- a/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java +++ b/apps/sam/java/test/net/i2p/sam/TestRawTransfer.java @@ -7,6 +7,7 @@ import java.net.Socket; import java.util.Properties; import java.util.StringTokenizer; +import net.i2p.data.DataHelper; import net.i2p.util.Log; public class TestRawTransfer { @@ -36,11 +37,8 @@ public class TestRawTransfer { line = reader.readLine(); _log.info("Response from the lookup for ME: " + line); _log.debug("The above should be a NAMING REPLY"); - - StringTokenizer tok = new StringTokenizer(line); - String maj = tok.nextToken(); - String min = tok.nextToken(); - Properties props = SAMUtils.parseParams(tok); + + Properties props = SAMUtils.parseParams(line); String value = props.getProperty("VALUE"); if (value == null) { _log.error("No value for ME found! [" + line + "]"); @@ -53,10 +51,7 @@ public class TestRawTransfer { out.write(DataHelper.getASCII(send)); line = reader.readLine(); try { - tok = new StringTokenizer(line); - maj = tok.nextToken(); - min = tok.nextToken(); - props = SAMUtils.parseParams(tok); + props = SAMUtils.parseParams(line); } catch (Exception e) { _log.error("Error parsing response line: [" + line + "]", e); return; diff --git a/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java b/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java index 70188d2d2..4071f1c1b 100644 --- a/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java +++ b/apps/sam/java/test/net/i2p/sam/TestStreamTransfer.java @@ -75,10 +75,7 @@ public class TestStreamTransfer { req = "NAMING LOOKUP NAME=ME\n"; out.write(DataHelper.getASCII(req)); line = reader.readLine(); - StringTokenizer tok = new StringTokenizer(line); - String maj = tok.nextToken(); - String min = tok.nextToken(); - Properties props = SAMUtils.parseParams(tok); + Properties props = SAMUtils.parseParams(line); String value = props.getProperty("VALUE"); if (value == null) { _log.error("No value for ME found! [" + line + "]"); @@ -124,10 +121,9 @@ public class TestStreamTransfer { private void doRun() throws IOException, SAMException { String line = _reader.readLine(); _log.debug("Read: " + line); - StringTokenizer tok = new StringTokenizer(line); - String maj = tok.nextToken(); - String min = tok.nextToken(); - Properties props = SAMUtils.parseParams(tok); + Properties props = SAMUtils.parseParams(line); + String maj = props.getProperty(SAMUtils.COMMAND); + String min = props.getProperty(SAMUtils.OPCODE); if ( ("STREAM".equals(maj)) && ("CONNECTED".equals(min)) ) { String dest = props.getProperty("DESTINATION"); String id = props.getProperty("ID"); @@ -225,10 +221,7 @@ public class TestStreamTransfer { out.write(DataHelper.getASCII(req)); line = reader.readLine(); _log.info("Response to the stream connect from "+sessionName+" to Alice: " + line); - StringTokenizer tok = new StringTokenizer(line); - String maj = tok.nextToken(); - String min = tok.nextToken(); - Properties props = SAMUtils.parseParams(tok); + Properties props = SAMUtils.parseParams(line); _log.info("props = " + props); String result = props.getProperty("RESULT"); if (!("OK".equals(result))) { diff --git a/apps/sam/java/test/net/i2p/sam/TestSwarm.java b/apps/sam/java/test/net/i2p/sam/TestSwarm.java index 8d96ed2f5..f9862b467 100644 --- a/apps/sam/java/test/net/i2p/sam/TestSwarm.java +++ b/apps/sam/java/test/net/i2p/sam/TestSwarm.java @@ -143,15 +143,15 @@ public class TestSwarm { _samOut.write(DataHelper.getASCII("HELLO VERSION MIN=1.0 MAX=1.0\n")); _samOut.flush(); _log.debug("Hello sent"); - boolean ok = _eventHandler.waitForHelloReply(); - _log.debug("Hello reply found: " + ok); - if (!ok) + String serverVersion = _eventHandler.waitForHelloReply(); + _log.debug("Hello reply found: " + serverVersion); + if (serverVersion == null) throw new IOException("wtf, hello failed?"); String req = "SESSION CREATE STYLE=STREAM DESTINATION=" + _destFile + " " + _conOptions + "\n"; _samOut.write(DataHelper.getUTF8(req)); _samOut.flush(); _log.debug("Session create sent"); - ok = _eventHandler.waitForSessionCreateReply(); + boolean ok = _eventHandler.waitForSessionCreateReply(); _log.debug("Session create reply found: " + ok); req = "NAMING LOOKUP NAME=ME\n"; From 280ca2cf2fd5abbe0f5a78ed535775f6bc7abef9 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 6 Jun 2016 12:12:16 +0000 Subject: [PATCH 10/21] CPUID: Add CLI output for new AMD tests Add @since for new AMD methods --- .../support/CPUInformation/AMDCPUInfo.java | 5 +++ .../freenet/support/CPUInformation/CPUID.java | 38 +++++++++++-------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java b/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java index 5cb677273..4b4b0ec68 100644 --- a/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java +++ b/core/java/src/freenet/support/CPUInformation/AMDCPUInfo.java @@ -41,6 +41,7 @@ public interface AMDCPUInfo extends CPUInfo { public boolean IsAthlon64Compatible(); /** * @return true if the CPU present in the machine is at least an 'k10' CPU + * @since 0.9.26 */ public boolean IsK10Compatible(); /** @@ -49,6 +50,7 @@ public interface AMDCPUInfo extends CPUInfo { public boolean IsBobcatCompatible(); /** * @return true if the CPU present in the machine is at least an 'jaguar' CPU + * @since 0.9.26 */ public boolean IsJaguarCompatible(); /** @@ -57,14 +59,17 @@ public interface AMDCPUInfo extends CPUInfo { public boolean IsBulldozerCompatible(); /** * @return true if the CPU present in the machine is at least a 'piledriver' CPU + * @since 0.9.26 */ public boolean IsPiledriverCompatible(); /** * @return true if the CPU present in the machine is at least a 'steamroller' CPU + * @since 0.9.26 */ public boolean IsSteamrollerCompatible(); /** * @return true if the CPU present in the machine is at least a 'excavator' CPU + * @since 0.9.26 */ public boolean IsExcavatorCompatible(); diff --git a/core/java/src/freenet/support/CPUInformation/CPUID.java b/core/java/src/freenet/support/CPUInformation/CPUID.java index d23f4f23b..5bd79d0ae 100644 --- a/core/java/src/freenet/support/CPUInformation/CPUID.java +++ b/core/java/src/freenet/support/CPUInformation/CPUID.java @@ -376,27 +376,33 @@ public class CPUID { System.out.println("CPU has ABM: " + c.hasABM()); if(c instanceof IntelCPUInfo){ System.out.println("\n **Intel-info**"); - System.out.println("Is PII-compatible: "+((IntelCPUInfo)c).IsPentium2Compatible()); - System.out.println("Is PIII-compatible: "+((IntelCPUInfo)c).IsPentium3Compatible()); - System.out.println("Is PIV-compatible: "+((IntelCPUInfo)c).IsPentium4Compatible()); - System.out.println("Is Atom-compatible: "+((IntelCPUInfo)c).IsAtomCompatible()); + System.out.println("Is PII-compatible: "+((IntelCPUInfo)c).IsPentium2Compatible()); + System.out.println("Is PIII-compatible: "+((IntelCPUInfo)c).IsPentium3Compatible()); + System.out.println("Is PIV-compatible: "+((IntelCPUInfo)c).IsPentium4Compatible()); + System.out.println("Is Atom-compatible: "+((IntelCPUInfo)c).IsAtomCompatible()); System.out.println("Is Pentium M compatible: "+((IntelCPUInfo)c).IsPentiumMCompatible()); - System.out.println("Is Core2-compatible: "+((IntelCPUInfo)c).IsCore2Compatible()); - System.out.println("Is Corei-compatible: "+((IntelCPUInfo)c).IsCoreiCompatible()); - System.out.println("Is Sandy-compatible: "+((IntelCPUInfo)c).IsSandyCompatible()); - System.out.println("Is Ivy-compatible: "+((IntelCPUInfo)c).IsIvyCompatible()); - System.out.println("Is Haswell-compatible: "+((IntelCPUInfo)c).IsHaswellCompatible()); + System.out.println("Is Core2-compatible: "+((IntelCPUInfo)c).IsCore2Compatible()); + System.out.println("Is Corei-compatible: "+((IntelCPUInfo)c).IsCoreiCompatible()); + System.out.println("Is Sandy-compatible: "+((IntelCPUInfo)c).IsSandyCompatible()); + System.out.println("Is Ivy-compatible: "+((IntelCPUInfo)c).IsIvyCompatible()); + System.out.println("Is Haswell-compatible: "+((IntelCPUInfo)c).IsHaswellCompatible()); System.out.println("Is Broadwell-compatible: "+((IntelCPUInfo)c).IsBroadwellCompatible()); } if(c instanceof AMDCPUInfo){ System.out.println("\n **AMD-info**"); - System.out.println("Is K6-compatible: "+((AMDCPUInfo)c).IsK6Compatible()); - System.out.println("Is K6_2-compatible: "+((AMDCPUInfo)c).IsK6_2_Compatible()); - System.out.println("Is K6_3-compatible: "+((AMDCPUInfo)c).IsK6_3_Compatible()); - System.out.println("Is Geode-compatible: "+((AMDCPUInfo)c).IsGeodeCompatible()); - System.out.println("Is Athlon-compatible: "+((AMDCPUInfo)c).IsAthlonCompatible()); - System.out.println("Is Athlon64-compatible: "+((AMDCPUInfo)c).IsAthlon64Compatible()); - System.out.println("Is Bobcat-compatible: "+((AMDCPUInfo)c).IsBobcatCompatible()); + System.out.println("Is K6-compatible: "+((AMDCPUInfo)c).IsK6Compatible()); + System.out.println("Is K6_2-compatible: "+((AMDCPUInfo)c).IsK6_2_Compatible()); + System.out.println("Is K6_3-compatible: "+((AMDCPUInfo)c).IsK6_3_Compatible()); + System.out.println("Is Geode-compatible: "+((AMDCPUInfo)c).IsGeodeCompatible()); + System.out.println("Is Athlon-compatible: "+((AMDCPUInfo)c).IsAthlonCompatible()); + System.out.println("Is Athlon64-compatible: "+((AMDCPUInfo)c).IsAthlon64Compatible()); + System.out.println("Is Bobcat-compatible: "+((AMDCPUInfo)c).IsBobcatCompatible()); + System.out.println("Is K10-compatible: "+((AMDCPUInfo)c).IsK10Compatible()); + System.out.println("Is Jaguar-compatible: "+((AMDCPUInfo)c).IsJaguarCompatible()); + System.out.println("Is Bulldozer-compatible: "+((AMDCPUInfo)c).IsBulldozerCompatible()); + System.out.println("Is Piledriver-compatible: "+((AMDCPUInfo)c).IsPiledriverCompatible()); + System.out.println("Is Steamroller-compatible: "+((AMDCPUInfo)c).IsSteamrollerCompatible()); + System.out.println("Is Excavator-compatible: "+((AMDCPUInfo)c).IsExcavatorCompatible()); } } From 78d0a54e966a26970bd2ce7252f13ecbf4e662d1 Mon Sep 17 00:00:00 2001 From: str4d Date: Mon, 6 Jun 2016 12:34:17 +0000 Subject: [PATCH 11/21] Typo --- core/java/src/net/i2p/client/naming/BlockfileNamingService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/src/net/i2p/client/naming/BlockfileNamingService.java b/core/java/src/net/i2p/client/naming/BlockfileNamingService.java index 7a3eb8adc..0c1f6a6d7 100644 --- a/core/java/src/net/i2p/client/naming/BlockfileNamingService.java +++ b/core/java/src/net/i2p/client/naming/BlockfileNamingService.java @@ -1492,7 +1492,7 @@ public class BlockfileNamingService extends DummyNamingService { rv = lookupAll2(hostname, lookupOptions, storedOptions); } } - // we sort the destinations in addDestionation(), + // we sort the destinations in addDestination(), // which is a lot easier than sorting them here return rv; } From 63272d3cfcf432e873636b511d40c39a3a79bbbb Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 6 Jun 2016 12:37:06 +0000 Subject: [PATCH 12/21] mbuild-all script fixes --- core/c/jbigi/mbuild-all.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/core/c/jbigi/mbuild-all.sh b/core/c/jbigi/mbuild-all.sh index be3072ac8..8c2b1d89e 100755 --- a/core/c/jbigi/mbuild-all.sh +++ b/core/c/jbigi/mbuild-all.sh @@ -79,34 +79,32 @@ if [ ! -f "$JAVA_HOME/include/jni.h" ]; then fi if ! command -v m4 > /dev/null; then - printf "\aWARNING: \`m4\` not found. If this process fails to complete, install m4 " >&2 + printf "\aWARNING: \`m4\` not found. Install m4 " >&2 printf "and re-run this script.\n\n\n\a" >&2 exit 1 fi if [ -z $BITS ]; then - UNAME="$(uname -a)" - if test "${UNAME#*x86_64}" != "x86_&4"; then + UNAME="$(uname -m)" + if test "${UNAME#*x86_64}" != "$UNAME"; then BITS=64 - elif test "${UNAME#*i386}" != "i386"; then + elif test "${UNAME#*i386}" != "$UNAME"; then BITS=32 - elif test "${UNAME#*i686}" != "i686"; then + elif test "${UNAME#*i686}" != "$UNAME"; then BITS=32 - elif test "${UNAME#*armv6}" != "armv6"; then + elif test "${UNAME#*armv6}" != "$UNAME"; then BITS=32 - elif test "${UNAME#*armv7}" != "armv7"; then + elif test "${UNAME#*armv7}" != "$UNAME"; then BITS=32 - elif test "${UNAME#*aarch32}" != "aarch32"; then + elif test "${UNAME#*aarch32}" != "$UNAME"; then BITS=32 - elif test "${UNAME#*aarch64}" != "aarch64"; then + elif test "${UNAME#*aarch64}" != "$UNAME"; then BITS=64 else - echo "Unable to detect default setting for BITS variable" - exit + exit 1 fi - printf "\aBITS variable not set, $BITS bit system detected\n\a" >&2 fi @@ -116,6 +114,7 @@ if [ -z $CC ]; then printf "\aCC variable not set, defaulting to $CC\n\a" >&2 fi +# FIXME -m32 and -m64 are only for x86 if [ $BITS -eq 32 ]; then export ABI=32 export CFLAGS="-m32" From aa8fd85d654b7148db2ba4512d0bb231bda1b957 Mon Sep 17 00:00:00 2001 From: zzz Date: Tue, 7 Jun 2016 16:55:05 +0000 Subject: [PATCH 13/21] Fix eepget Deb classpath via patch 0001 Launchpad doc tweaks --- debian-alt/doc/launchpad.txt | 5 ++++- debian/patches/0001-path-substitution.patch | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian-alt/doc/launchpad.txt b/debian-alt/doc/launchpad.txt index d95482f6c..7d7a50ce8 100644 --- a/debian-alt/doc/launchpad.txt +++ b/debian-alt/doc/launchpad.txt @@ -134,6 +134,9 @@ Creating milestone, release, and uploading files You must first create a milestone, then create a release and attach it to the milestone. + +(Enable referer sending in your browser if necessary) + Go to https://launchpad.net/i2p/trunk Down at bottom, click 'create milestone' Name: 0.9.xx (NOT i2p 0.9.xx) @@ -160,7 +163,7 @@ For each of the four files Sig: i2pinstall_0.9.xx_windows.exe.sig File Content Type: Installer File i2pinstall_0.9.xx.jar - Description: I2P 0.9.xx Installer (Linux / OSX / FreeBSD / Solaris) + Description: I2P 0.9.xx Installer (Linux / OSX / FreeBSD / Solaris / Mac) Sig: i2pinstall_0.9.xx.jar.sig File Content Type: Installer File i2pupdate_0.9.xx.zip diff --git a/debian/patches/0001-path-substitution.patch b/debian/patches/0001-path-substitution.patch index 1c1746e75..7f0d1f833 100644 --- a/debian/patches/0001-path-substitution.patch +++ b/debian/patches/0001-path-substitution.patch @@ -19,8 +19,9 @@ Debian wrapper.config to try to prevent confusion. @@ -1,3 +1,3 @@ #!/bin/sh -I2P="%INSTALL_PATH" +-java -cp "$I2P/lib/i2p.jar" net.i2p.util.EepGet "$@" +I2P="/usr/share/i2p" - java -cp "$I2P/lib/i2p.jar" net.i2p.util.EepGet "$@" ++java -cp "$I2P/lib/i2p.jar:/usr/share/java/gnu-getopt.jar" net.i2p.util.EepGet "$@" --- a/installer/resources/i2prouter +++ b/installer/resources/i2prouter @@ -10,7 +10,7 @@ From bfbd15970604ef52e698c8e726a6ce1e95fb7d35 Mon Sep 17 00:00:00 2001 From: zzz Date: Tue, 7 Jun 2016 19:15:00 +0000 Subject: [PATCH 14/21] Release tarball build fixes Precise build tweaks Precise and Trusty changelogs --- build.xml | 13 ++++++++++--- debian-alt/doc/launchpad.txt | 2 +- debian-alt/precise/changelog | 6 ++++++ debian-alt/trusty/changelog | 6 ++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/build.xml b/build.xml index 3e14c6510..5e3a03f86 100644 --- a/build.xml +++ b/build.xml @@ -2094,8 +2094,11 @@ - - + + @@ -2104,7 +2107,7 @@ - + @@ -2112,6 +2115,8 @@ + + @@ -2192,6 +2197,8 @@ + + diff --git a/debian-alt/doc/launchpad.txt b/debian-alt/doc/launchpad.txt index 7d7a50ce8..f252a677b 100644 --- a/debian-alt/doc/launchpad.txt +++ b/debian-alt/doc/launchpad.txt @@ -49,7 +49,7 @@ Generate files to upload (or add -kkeyid argument to debuild, which you must do if you want to sign with a subkey) run gpg -K to list your private keys -- ant debian-release-tarball +- ant debian-release-tarball (ant precise-release-tarball for precise) this will make a directory ../i2p-0.9.XX-0-xxxxxxxx/ and a tarball ../i2p_0.9.XX.orig.tar.bz2 - cp debian/changelog ../i2p-0.9.XX-0-xxxxxxxx/debian/ diff --git a/debian-alt/precise/changelog b/debian-alt/precise/changelog index 61ca84a73..2d9270228 100644 --- a/debian-alt/precise/changelog +++ b/debian-alt/precise/changelog @@ -1,3 +1,9 @@ +i2p (0.9.26p-1~precise+1) precise; urgency=medium + + * Backport to Precise + + -- zzz on i2p Tue, 07 Jun 2016 12:12:12 +0000 + i2p (0.9.25-1~precise+1) precise; urgency=medium * Backport to Precise diff --git a/debian-alt/trusty/changelog b/debian-alt/trusty/changelog index 18b5f9038..585343cd2 100644 --- a/debian-alt/trusty/changelog +++ b/debian-alt/trusty/changelog @@ -1,3 +1,9 @@ +i2p (0.9.26-1ubuntu1) trusty; urgency=medium + + * New upstream version 0.9.26 + + -- zzz on i2p (key signing) Tue, 07 Jun 2016 12:12:12 +0000 + i2p (0.9.25-1ubuntu1) trusty; urgency=medium * New upstream version 0.9.25 From 471ff5b9397f0ce7f5c1271fb246a9eaf7c3d9f9 Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 8 Jun 2016 16:41:01 +0000 Subject: [PATCH 15/21] Fix distclean for deb builds Deb build doc updates Checklist updates Deb 8 changelog --- apps/susidns/src/build.xml | 1 + apps/susimail/build.xml | 1 + debian-alt/doc/debian-build.txt | 24 +++++++++++------- debian/changelog | 6 +++++ installer/resources/checklist.md | 42 +++++++++++++++++++++++--------- 5 files changed, 54 insertions(+), 20 deletions(-) diff --git a/apps/susidns/src/build.xml b/apps/susidns/src/build.xml index 6d14865f9..77d63bc22 100644 --- a/apps/susidns/src/build.xml +++ b/apps/susidns/src/build.xml @@ -182,6 +182,7 @@ + diff --git a/apps/susimail/build.xml b/apps/susimail/build.xml index 572fd59b7..ca0a32e22 100644 --- a/apps/susimail/build.xml +++ b/apps/susimail/build.xml @@ -150,6 +150,7 @@ + diff --git a/debian-alt/doc/debian-build.txt b/debian-alt/doc/debian-build.txt index bdaa00f29..2aef1ceac 100644 --- a/debian-alt/doc/debian-build.txt +++ b/debian-alt/doc/debian-build.txt @@ -17,7 +17,7 @@ cd i2p_0.9.xx-x-xxxxxxxx/ ant debchange vi debian/changelog change i2p_0.9.xx-x-xxxxxxxx-1 to i2p_0.9.xx-1 - change UNRELEASED to unstable + change UNRELEASED to stable change comment to "New upstream version 0.9.xx" fix your name and email # fix up the control and rules files as necessary @@ -57,16 +57,22 @@ This will make the following files in ..: ssh to reprepro server sudo su kytv (he owns the reprepro directories) -reprepro includedeb unstable i2p-doc_0.9.xx-1_all.deb -reprepro includedeb unstable i2p-router_0.9.xx-1_all.deb -reprepro includedeb unstable i2p_0.9.xx-1_all.deb -reprepro includedeb unstable libjbigi-jni_0.9.xx-1_amd64.deb +reprepro includedeb stable i2p-doc_0.9.xx-1_all.deb +reprepro includedeb stable i2p-router_0.9.xx-1_all.deb +reprepro includedeb stable libjbigi-jni_0.9.xx-1_amd64.deb +reprepro includedeb stable i2p_0.9.xx-1_all.deb # if you already got the source from launchpad # with reprepro update, skip this? -reprepro includedsc unstable i2p_0.9.XX-1.dsc +reprepro includedsc stable i2p_0.9.XX-1.dsc + +# copy built packages from launchpad +reprepro -v update precise +reprepro -v update trusty +reprepro -v update vivid +reprepro -v update wily +reprepro -v update xenial -# To copy precise to wheezy if you build precise on launchpad -# and then did a reprepro update: +# To copy precise to wheezy: # Note that syntax is reprepro copysrc TO FROM package! -reprepro copysrc wheezy precise i2p +reprepro -v copysrc wheezy precise i2p diff --git a/debian/changelog b/debian/changelog index c515372c8..dc213f9ce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +i2p (0.9.26-1~deb8u+1) stable; urgency=medium + + * Backport to Jessie + + -- zzz on i2p Tue, 08 Jun 2016 12:12:12 +0000 + i2p (0.9.25-1~deb8u+1) stable; urgency=medium * Backport to Jessie diff --git a/installer/resources/checklist.md b/installer/resources/checklist.md index 55beba2b8..ead1f93d7 100644 --- a/installer/resources/checklist.md +++ b/installer/resources/checklist.md @@ -2,6 +2,10 @@ ## One week before +- Announce string freeze on #i2p-dev +- Update local English po files: `ant poupdate` +- Revert non-English changes if any +- Push to Transifex: `tx push -s` - Make announcement on Transifex with checkin deadline @@ -52,7 +56,8 @@ mtn -d i2p.mtn co --branch=i2p.i2p /path/to/releasedir ``` - - You may build with Java 7 or higher, but ensure you have the Java 6 JRE installed for the bootclasspath + - You must build with Java 7 or higher, but ensure you also have the Java 6 JRE installed for the bootclasspath. + If you build with Java 8 or higher, you must also have the Java 7 JRE installed for the bootclasspath. 4. Create override.properties with (adjust as necessary): @@ -165,21 +170,21 @@ - Reconnect ethernet / turn wifi back on - Load torrents in i2psnark on your production router, verify infohashes -3. If all goes well, tag and sync the release: +3. If all goes well, tag and push the release: ``` mtn tag h: i2p-0.x.xx mtn cert t:i2p-0.x.xx branch i2p.i2p.release - mtn sync (with e.g. mtn.killyourtv.i2p) + mtn push ``` ### Distribute updates 1. Update news with new version: - Add magnet links, change release dates and release number in to old-format - news.xml, and distribute to news hosts + news.xml, and distribute to news hosts (no longer necessary) - In the i2p.newsxml branch, edit magnet links, release dates and release - number in data/releases.json, and check in + number in data/releases.json, check in and push 2. Add i2pupdate-0.9.xx.su3 torrent to tracker2.postman.i2p and start seeding @@ -198,22 +203,37 @@ 6. Tell news hosts to flip the switch +7. Monitor torrent for activity to verify that the new news is now live + + ### Notify release -1. Wait for files to be updated on download server +1. Upload files to launchpad release (download mirror) + (see debian-alt/doc/launchpad.txt for instructions) -2. Website files to change: +2. Wait for files to be updated on download server + Verify at http://download.i2p2.no/releases/ + +3. Website files to change: - Sync with mtn.i2p-projekt.i2p - `i2p2www/static/hosts.txt` if it changed (copy from i2p.i2p mtn branch) - `i2p2www/__init__.py` (release number) - - `i2p2www/pages/downloads/list.html` (release signer) + - `i2p2www/pages/downloads/list.html` (release signer, if changed) - `i2p2www/pages/downloads/macros` (checksums) - - `i2p2www/static/news/news.xml` + - `i2p2www/static/news/news.xml` (no longer necessary) - Sync with mtn.i2p-projekt.i2p -3. Wait for debian packages to be ready - 4. Announce on: - #i2p, #i2p-dev (also on Freenode side) - forum.i2p - Twitter + +5. Launchpad builds + (see debian-alt/doc/launchpad.txt for instructions) + +6. Debian builds + (see debian-alt/doc/debian-build.txt for instructions) + +7. Announce Launchpad and Debian builds on Twitter + +8. Notify Tails that new Debian builds are available From e27af374b0c4de685c75f711db43802bee76ac1b Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 10 Jun 2016 19:10:59 +0000 Subject: [PATCH 16/21] i2psnark standalone: - Cherry-pick fixes from psi's github i2psnark_rpc branch - Fix up Jetty XML file for Jetty 8 - Start with JettyStart - Add UrlLauncher to launch browser - Move RunStandalone to standalone/ directory - Fix up paths in CSS files during build - Force startup delay to 0 when in router context - Fix theme selection when not in router context - Adjust CSS and image paths when not in router context - Add hosts.txt so announces work --- apps/i2psnark/java/build.xml | 118 +++++++++++-- .../src/org/klomp/snark/SnarkManager.java | 13 +- .../klomp/snark/standalone/RunStandalone.java | 62 +++++++ .../org/klomp/snark/web/I2PSnarkServlet.java | 41 +++-- .../org/klomp/snark/web/RunStandalone.java | 61 ------- apps/i2psnark/jetty-i2psnark.xml | 165 ++++++++++++------ apps/i2psnark/launch-i2psnark | 2 +- apps/i2psnark/readme-standalone.txt | 16 +- build.xml | 7 +- 9 files changed, 326 insertions(+), 159 deletions(-) create mode 100644 apps/i2psnark/java/src/org/klomp/snark/standalone/RunStandalone.java delete mode 100644 apps/i2psnark/java/src/org/klomp/snark/web/RunStandalone.java diff --git a/apps/i2psnark/java/build.xml b/apps/i2psnark/java/build.xml index 683e81285..5375b3324 100644 --- a/apps/i2psnark/java/build.xml +++ b/apps/i2psnark/java/build.xml @@ -50,6 +50,10 @@ + + + + @@ -71,7 +75,7 @@ - + @@ -179,29 +183,111 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + - - - - diff --git a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java index abfc32097..5d001e929 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java +++ b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java @@ -388,6 +388,8 @@ public class SnarkManager implements CompleteListener { } private int getStartupDelayMinutes() { + if (!_context.isRouterContext()) + return 0; try { return Integer.parseInt(_config.getProperty(PROP_STARTUP_DELAY)); } catch (NumberFormatException nfe) { @@ -675,7 +677,8 @@ public class SnarkManager implements CompleteListener { * @return String[] -- Array of all the themes found, non-null, unsorted */ public String[] getThemes() { - String[] themes; + String[] themes; + if (_context.isRouterContext()) { // "docs/themes/snark/" File dir = new File(_context.getBaseDir(), "docs/themes/snark"); FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } }; @@ -689,8 +692,10 @@ public class SnarkManager implements CompleteListener { } else { themes = new String[0]; } - // return the map. - return themes; + } else { + themes = new String[] { "light", "ubergine", "vanilla" }; + } + return themes; } @@ -815,7 +820,7 @@ public class SnarkManager implements CompleteListener { } } - if (startDelay != null){ + if (startDelay != null && _context.isRouterContext()) { int minutes = _util.getStartupDelay(); try { minutes = Integer.parseInt(startDelay.trim()); } catch (NumberFormatException nfe) {} if ( minutes != _util.getStartupDelay()) { diff --git a/apps/i2psnark/java/src/org/klomp/snark/standalone/RunStandalone.java b/apps/i2psnark/java/src/org/klomp/snark/standalone/RunStandalone.java new file mode 100644 index 000000000..521d0ec58 --- /dev/null +++ b/apps/i2psnark/java/src/org/klomp/snark/standalone/RunStandalone.java @@ -0,0 +1,62 @@ +package org.klomp.snark.standalone; + +import java.io.File; + +import net.i2p.I2PAppContext; +import net.i2p.apps.systray.UrlLauncher; +import net.i2p.jetty.JettyStart; + +/** + * @since moved from ../web and fixed in 0.9.27 + */ +public class RunStandalone { + + private final JettyStart _jettyStart; + private final I2PAppContext _context; + private int _port = 8002; + private String _host = "127.0.0.1"; + + private RunStandalone(String args[]) throws Exception { + _context = I2PAppContext.getGlobalContext(); + File base = _context.getBaseDir(); + File xml = new File(base, "jetty-i2psnark.xml"); + _jettyStart = new JettyStart(_context, null, new String[] { xml.getAbsolutePath() } ); + if (args.length > 1) { + _port = Integer.parseInt(args[1]); + } + if (args.length > 0) { + _host = args[0]; + } + } + + /** + * Usage: RunStandalone [host [port]] (but must match what's in the jetty-i2psnark.xml file) + */ + public static void main(String args[]) { + try { + RunStandalone runner = new RunStandalone(args); + runner.start(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } + + public void start() { + try { + _jettyStart.startup(); + String url = "http://" + _host + ':' + _port + "/i2psnark/"; + try { + Thread.sleep(1000); + } catch (InterruptedException ie) {} + UrlLauncher launch = new UrlLauncher(_context, null, new String[] { url } ); + launch.startup(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void stop() { + _jettyStart.shutdown(null); + } +} diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index 74688f2c7..fd914e27b 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -4,7 +4,6 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.Serializable; -import java.text.Collator; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -192,7 +191,10 @@ public class I2PSnarkServlet extends BasicServlet { return; } - _themePath = "/themes/snark/" + _manager.getTheme() + '/'; + if (_context.isRouterContext()) + _themePath = "/themes/snark/" + _manager.getTheme() + '/'; + else + _themePath = _contextPath + WARBASE + "themes/snark/" + _manager.getTheme() + '/'; _imgPath = _themePath + "images/"; req.setCharacterEncoding("UTF-8"); @@ -285,8 +287,9 @@ public class I2PSnarkServlet extends BasicServlet { if (!isConfigure) { delay = _manager.getRefreshDelaySeconds(); if (delay > 0) { + String jsPfx = _context.isRouterContext() ? "" : ".resources"; //out.write("\n"); - out.write("\n" + + out.write("\n" + "