From 567503abc740e6816fc1a207075a05da8e0f7e8a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 2 Jun 2018 19:26:33 +0200 Subject: [PATCH] Backends: print versions somewhere in log Signed-off-by: Jason A. Donenfeld --- .../main/java/com/wireguard/android/backend/GoBackend.java | 2 +- .../java/com/wireguard/android/backend/WgQuickBackend.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/wireguard/android/backend/GoBackend.java b/app/src/main/java/com/wireguard/android/backend/GoBackend.java index a6582cd6..21df018e 100644 --- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -187,7 +187,7 @@ public final class GoBackend implements Backend { try (final ParcelFileDescriptor tun = builder.establish()) { if (tun == null) throw new Exception("Unable to create tun device"); - + Log.d(TAG, "Go backend v" + wgVersion()); currentTunnelHandle = wgTurnOn(tunnel.getName(), tun.detachFd(), goConfig); } if (currentTunnelHandle < 0) diff --git a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java index 6de40431..49b562a0 100644 --- a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java +++ b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java @@ -109,8 +109,10 @@ public final class WgQuickBackend implements Backend { try (final FileOutputStream stream = new FileOutputStream(tempFile, false)) { stream.write(config.toString().getBytes(StandardCharsets.UTF_8)); } - final String command = String.format("wg-quick %s '%s'", + String command = String.format("wg-quick %s '%s'", state.toString().toLowerCase(), tempFile.getAbsolutePath()); + if (state == State.UP) + command = "cat /sys/module/wireguard/version && " + command; final int result = rootShell.run(null, command); // noinspection ResultOfMethodCallIgnored tempFile.delete();