Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[#3](https://github.com/netsec-ethz/scion-java-multiping/pull/3)
- Regression: fixed pom.xml
[#4](https://github.com/netsec-ethz/scion-java-multiping/pull/4)
- Bumped dependency on JPAN to 0.4.0
[#5](https://github.com/netsec-ethz/scion-java-multiping/pull/5)

## [0.2.0] - 2024-09-30

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ arguments:
"tryICMP": false,
"isdAsInputFile": "ping-repeat-destinations.csv",
"outputFile": "ping-repeat-output.csv",
"localPort": 30041,
"localPort": 30041, // This is only used by the PingResponder
"consoleOutput": true
}
```
Expand Down
270 changes: 123 additions & 147 deletions ping-repeat-output.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<dependency>
<groupId>org.scion</groupId>
<artifactId>jpan</artifactId>
<version>0.3.0</version>
<version>0.4.0</version>
</dependency>

<dependency>
Expand Down
15 changes: 4 additions & 11 deletions src/main/java/org/scion/multiping/PingAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public class PingAll {
config.tryICMP = false;
}

private final int localPort;

private int nAsTried = 0;
private int nAsSuccess = 0;
private int nAsError = 0;
Expand Down Expand Up @@ -79,16 +77,11 @@ private enum Policy {
private static final Policy POLICY = Policy.SHORTEST_TR;
private static final boolean SHOW_PATH = true;

public PingAll(int localPort) {
this.localPort = localPort;
}

public static void main(String[] args) throws IOException {
PRINT = true;
// System.setProperty(Constants.PROPERTY_DNS_SEARCH_DOMAINS, "ethz.ch.");

// Local port must be 30041 for networks that expect a dispatcher
PingAll demo = new PingAll(30041);
PingAll demo = new PingAll();
List<ParseAssignments.HostEntry> list = DownloadAssignmentsFromWeb.getList();
for (ParseAssignments.HostEntry e : list) {
print(ScionUtil.toStringIA(e.getIsdAs()) + " \"" + e.getName() + "\" ");
Expand Down Expand Up @@ -206,7 +199,7 @@ private Scmp.EchoMessage findShortestEcho(List<Path> paths, Ref<Path> refBest) {
Path path = PathPolicy.MIN_HOPS.filter(paths);
refBest.set(path);
ByteBuffer bb = ByteBuffer.allocate(0);
try (ScmpSender sender = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
try (ScmpSender sender = Scmp.newSenderBuilder().build()) {
nPathTried++;
Scmp.EchoMessage msg = sender.sendEchoRequest(path, bb);
if (msg == null) {
Expand All @@ -233,7 +226,7 @@ private Scmp.EchoMessage findShortestEcho(List<Path> paths, Ref<Path> refBest) {
private Scmp.TracerouteMessage findShortestTR(List<Path> paths, Ref<Path> refBest) {
Path path = PathPolicy.MIN_HOPS.filter(paths);
refBest.set(path);
try (ScmpSender sender = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
try (ScmpSender sender = Scmp.newSenderBuilder().build()) {
nPathTried++;
List<Scmp.TracerouteMessage> messages = sender.sendTracerouteRequest(path);
if (messages.isEmpty()) {
Expand Down Expand Up @@ -264,7 +257,7 @@ private Scmp.TracerouteMessage findShortestTR(List<Path> paths, Ref<Path> refBes

private Scmp.TracerouteMessage findFastestTR(List<Path> paths, Ref<Path> refBest) {
Scmp.TracerouteMessage best = null;
try (ScmpSender sender = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
try (ScmpSender sender = Scmp.newSenderBuilder().build()) {
for (Path path : paths) {
nPathTried++;
List<Scmp.TracerouteMessage> messages = sender.sendTracerouteRequest(path);
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/org/scion/multiping/PingRepeat.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class PingRepeat {
private static final String FILE_CONFIG = "ping-repeat-config.json";

private final InetSocketAddress dummyIP;
private final int localPort;

private int nPingTried = 0;
private int nPingSuccess = 0;
Expand All @@ -61,8 +60,7 @@ public class PingRepeat {

private static final boolean SHOW_PATH = true;

public PingRepeat(int localPort) throws UnknownHostException {
this.localPort = localPort;
public PingRepeat() throws UnknownHostException {
this.dummyIP = new InetSocketAddress(InetAddress.getByAddress(new byte[] {1, 2, 3, 4}), 12345);
}

Expand All @@ -75,8 +73,7 @@ public static void main(String[] args) throws IOException {
// Output: ISD/AS, remote IP, time, hopCount, path, [pings]
fileWriter = new FileWriter(config.outputFile);

// Local port must be 30041 for networks that expect a dispatcher
PingRepeat demo = new PingRepeat(config.localPort);
PingRepeat demo = new PingRepeat();
List<ParseAssignments.HostEntry> list = ParseAssignments.getList(config.isdAsInputFile);
for (int i = 0; i < config.roundRepeatCnt; i++) {
Instant start = Instant.now();
Expand Down Expand Up @@ -164,8 +161,7 @@ private Record measureLatency(List<Path> paths, Ref<Record.Attempt> refBest) {
Record best = null;
double currentBestMs = Double.MAX_VALUE;
ResponseHandler handler = new ResponseHandler();
try (ScmpSenderAsync sender =
Scmp.newSenderAsyncBuilder(handler).setLocalPort(localPort).build()) {
try (ScmpSenderAsync sender = Scmp.newSenderAsyncBuilder(handler).build()) {
for (int attemptCount = 0; attemptCount < config.attemptRepeatCnt; attemptCount++) {
Instant start = Instant.now();
Map<Integer, Record> seqToPathMap = new HashMap<>();
Expand Down
15 changes: 4 additions & 11 deletions src/main/java/org/scion/multiping/PingRepeatBlocking.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
public class PingRepeatBlocking {
private static final String FILE_CONFIG = "ping-repeat-config.json";

private final int localPort;

private int nAsTried = 0;
private int nAsSuccess = 0;
private int nAsError = 0;
Expand Down Expand Up @@ -80,10 +78,6 @@ private enum Policy {
private static final Policy POLICY = Policy.FASTEST_TR;
private static final boolean SHOW_PATH = true;

public PingRepeatBlocking(int localPort) {
this.localPort = localPort;
}

public static void main(String[] args) throws IOException {
// System.setProperty(Constants.PROPERTY_DNS_SEARCH_DOMAINS, "ethz.ch.");

Expand All @@ -93,8 +87,7 @@ public static void main(String[] args) throws IOException {
// Output: ISD/AS, remote IP, time, hopCount, path, [pings]
fileWriter = new FileWriter(config.outputFile);

// Local port must be 30041 for networks that expect a dispatcher
PingRepeatBlocking demo = new PingRepeatBlocking(config.localPort);
PingRepeatBlocking demo = new PingRepeatBlocking();
List<ParseAssignments.HostEntry> list = ParseAssignments.getList(config.isdAsInputFile);
for (int i = 0; i < config.roundRepeatCnt; i++) {
Instant start = Instant.now();
Expand Down Expand Up @@ -210,7 +203,7 @@ private Scmp.EchoMessage findShortestEcho(List<Path> paths, Ref<Path> refBest) {
Path path = PathPolicy.MIN_HOPS.filter(paths);
refBest.set(path);
ByteBuffer bb = ByteBuffer.allocate(0);
try (ScmpSender scmpChannel = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
try (ScmpSender scmpChannel = Scmp.newSenderBuilder().build()) {
nPathTried++;
Scmp.EchoMessage msg = scmpChannel.sendEchoRequest(path, bb);
if (msg == null) {
Expand All @@ -237,7 +230,7 @@ private Scmp.EchoMessage findShortestEcho(List<Path> paths, Ref<Path> refBest) {
private Scmp.TracerouteMessage findShortestTR(List<Path> paths, Ref<Path> refBest) {
Path path = PathPolicy.MIN_HOPS.filter(paths);
refBest.set(path);
try (ScmpSender scmpChannel = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
try (ScmpSender scmpChannel = Scmp.newSenderBuilder().build()) {
nPathTried++;
List<Scmp.TracerouteMessage> messages = scmpChannel.sendTracerouteRequest(path);
if (messages.isEmpty()) {
Expand All @@ -264,7 +257,7 @@ private Scmp.TracerouteMessage findShortestTR(List<Path> paths, Ref<Path> refBes

private Scmp.TracerouteMessage findFastestTR(List<Path> paths, Ref<Path> refBest) {
Scmp.TracerouteMessage best = null;
try (ScmpSender scmpChannel = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
try (ScmpSender scmpChannel = Scmp.newSenderBuilder().build()) {
for (int i = 0; i < paths.size() && i < config.maxPathsPerDestination; i++) {
Path path = paths.get(i);
nPathTried++;
Expand Down