Skip to content

Commit af89979

Browse files
tzaeschkeTilmann Zäschke
andauthored
Improved Async SCMP (#1)
* Improved Async SCMP --------- Co-authored-by: Tilmann Zäschke <[email protected]>
1 parent c9e980f commit af89979

File tree

11 files changed

+414
-248
lines changed

11 files changed

+414
-248
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6+
7+
8+
9+
## [Unreleased]
10+
11+
### Added
12+
- Support `echo` requests in addition to traceroute.
13+
[#1](https://github.com/netsec-ethz/scion-java-multiping/pull/1)
14+
- Added CHANGELOG
15+
- EchoResponder
16+
17+
## [0.1.0] - 2024-09-16
18+
19+
### Added
20+
- Everything
21+
22+
### Changed
23+
- Nothing
24+
25+
### Fixed
26+
- Nothing
27+
28+
### Removed
29+
- Nothing
30+
31+
[Unreleased]: https://github.com/netsec-ethz/scion-java-multiping/compare/v0.1.0...HEAD
32+
[0.1.0]: https://github.com/netsec-ethz/scion-java-multiping/compare/init_root_commit...v0.1.0

EchoRepeatDestinations-short.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"64-3303","Swisscom CH"
22
"64-13030","Init7 CH"
33
"64-2:0:4","Mobile Connections POC (Swisscom SIM cards)"
4-
"64-2:0:9","ETH Zurich (ETHZ)"
5-
"64-2:0:4c","AWS PoC Anapaya"
4+
64-2:0:9,"ETH Zurich (ETHZ)"
5+
"64-2:0:4c","AWS PoC Anapaya",192.168.0.1
66
"65-2:0:58","Mysten Labs"
77
"65-2:0:5a","Mysten Labs London"
88
"66-2:0:5b","Mysten Labs Japan"

EchoRepeatOutput.csv

Lines changed: 147 additions & 123 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ The tool uses a configuration file `EchoRepeatConfig.json` that can contain the
5858
}
5959
```
6060

61+
## Input
62+
63+
The input file is a csv file with ISD/AS, label and IP (optional). The ISD/AS can optionally be enclosed in `"`.
64+
When an IP is given then the tool will execute an `echo` requerst to the IP, otherwise it will execute a `traceroute` request to the border router of the destination AS. Example:
65+
66+
```
67+
64-2:0:9,"ETH Zurich (ETHZ)"
68+
"64-2:0:4c","AWS PoC Anapaya",192.168.0.1
69+
```
70+
71+
This will result in a traceroute request to th ETH border router of `64-2:0:9` and a echo request
72+
to `64-2:0:4c,192.168.0.1 `.
73+
6174
## Execution
6275

6376
To run, the tool requires a configuration file (see above or [here](/EchoRepeatConfig.json)) and an input file
@@ -68,7 +81,7 @@ the [GitHub Releases section](https://github.com/netsec-ethz/scion-java-multipin
6881
It can be executed
6982
with:
7083

71-
```dtd
84+
```
7285
java -jar scion-multiping-0.1.0-shaded.jar
7386
```
7487

@@ -82,6 +95,7 @@ Each row consists of:
8295
* ISD/AS
8396
* Remote IP (if known)
8497
* Time stamp
98+
* Type: can be ECHO or TRACE
8599
* Result: can be SUCCESS, NO_PATH (no path found to destination), LOCAL_AS (the destination AS
86100
is the local AS) or ERROR
87101
* Hop count of the path taken

pom.xml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<scion.bnd-maven-plugin.version>6.4.0</scion.bnd-maven-plugin.version>
1818
<scion.build-helper-maven-plugin.version>3.3.0</scion.build-helper-maven-plugin.version>
19-
<scion.fmt-maven.version>2.20</scion.fmt-maven.version>
19+
<scion.fmt-maven.version>2.23</scion.fmt-maven.version>
2020
<scion.maven-clean-plugin.version>3.2.0</scion.maven-clean-plugin.version>
2121
<scion.maven-compiler-plugin.version>3.11.0</scion.maven-compiler-plugin.version>
2222
<scion.maven-enforcer-plugin.version>3.3.0</scion.maven-enforcer-plugin.version>
@@ -123,8 +123,8 @@
123123
<artifactId>maven-compiler-plugin</artifactId>
124124
<version>3.11.0</version>
125125
<configuration>
126-
<source>1.8</source>
127-
<target>1.8</target>
126+
<source>11</source>
127+
<target>11</target>
128128
</configuration>
129129
</plugin>
130130
<plugin>
@@ -153,12 +153,12 @@
153153
<plugin>
154154
<groupId>org.apache.maven.plugins</groupId>
155155
<artifactId>maven-surefire-plugin</artifactId>
156-
<version>3.1.2</version>
156+
<version>3.2.5</version>
157157
</plugin>
158158
<plugin>
159159
<groupId>org.jacoco</groupId>
160160
<artifactId>jacoco-maven-plugin</artifactId>
161-
<version>0.8.11</version>
161+
<version>0.8.12</version>
162162
<executions>
163163
<execution>
164164
<id>prepare-agent</id>
@@ -175,14 +175,6 @@
175175
</execution>
176176
</executions>
177177
</plugin>
178-
<plugin>
179-
<groupId>org.apache.maven.plugins</groupId>
180-
<artifactId>maven-compiler-plugin</artifactId>
181-
<configuration>
182-
<source>11</source>
183-
<target>11</target>
184-
</configuration>
185-
</plugin>
186178
</plugins>
187179
</build>
188180

@@ -293,7 +285,7 @@
293285
<plugin>
294286
<groupId>org.apache.maven.plugins</groupId>
295287
<artifactId>maven-shade-plugin</artifactId>
296-
<version>2.4.3</version>
288+
<version>3.6.0</version>
297289
<executions>
298290
<execution>
299291
<phase>package</phase>
@@ -302,19 +294,31 @@
302294
</goals>
303295
<configuration>
304296
<shadedArtifactAttached>true</shadedArtifactAttached>
297+
<shadedClassifierName>executable</shadedClassifierName>
305298
<transformers>
306-
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
299+
<transformer
300+
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
307301
<transformer implementation=
308302
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
309303
<mainClass>org.scion.multiping.EchoRepeat</mainClass>
304+
<manifestEntries>
305+
<Multi-Release>true</Multi-Release>
306+
</manifestEntries>
307+
</transformer>
308+
<transformer
309+
implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer">
310+
</transformer>
311+
<transformer
312+
implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
313+
<addHeader>false</addHeader>
310314
</transformer>
311315
</transformers>
312316
<filters>
313317
<filter>
314318
<artifact>*:*</artifact>
315319
<excludes>
320+
<exclude>META-INF/MANIFEST.MF</exclude>
316321
<exclude>**/module-info.class</exclude>
317-
<exclude>META-INF/versions/**</exclude>
318322
</excludes>
319323
</filter>
320324
</filters>

src/main/java/org/scion/multiping/EchoAll.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
import java.net.InetAddress;
2121
import java.net.InetSocketAddress;
2222
import java.nio.ByteBuffer;
23-
import java.util.ArrayList;
24-
import java.util.HashSet;
25-
import java.util.List;
26-
import java.util.Set;
23+
import java.util.*;
24+
2725
import org.scion.jpan.*;
2826
import org.scion.jpan.internal.PathRawParser;
2927
import org.scion.multiping.util.*;
@@ -92,7 +90,6 @@ public static void main(String[] args) throws IOException {
9290

9391
// Local port must be 30041 for networks that expect a dispatcher
9492
EchoAll demo = new EchoAll(30041);
95-
// List<ParseAssignments.HostEntry> list = ParseAssignments.getList();
9693
List<ParseAssignments.HostEntry> list = DownloadAssignments.getList();
9794
for (ParseAssignments.HostEntry e : list) {
9895
print(ScionUtil.toStringIA(e.getIsdAs()) + " \"" + e.getName() + "\" ");
@@ -111,8 +108,8 @@ public static void main(String[] args) throws IOException {
111108
// max:
112109
Result maxPing =
113110
results.stream().max((o1, o2) -> (int) (o1.getPingMs() - o2.getPingMs())).get();
114-
Result maxHops = results.stream().max((o1, o2) -> o1.getHopCount() - o2.getHopCount()).get();
115-
Result maxPaths = results.stream().max((o1, o2) -> o1.getPathCount() - o2.getPathCount()).get();
111+
Result maxHops = results.stream().max(Comparator.comparingInt(Result::getHopCount)).get();
112+
Result maxPaths = results.stream().max(Comparator.comparingInt(Result::getPathCount)).get();
116113

117114
println("");
118115
println("Max hops = " + maxHops.getHopCount() + ": " + maxHops);
@@ -210,10 +207,9 @@ private Scmp.EchoMessage findShortestEcho(List<Path> paths, Ref<Path> refBest) {
210207
Path path = PathPolicy.MIN_HOPS.filter(paths);
211208
refBest.set(path);
212209
ByteBuffer bb = ByteBuffer.allocate(0);
213-
int id = 0;
214-
try (ScmpChannel scmpChannel = Scmp.createChannel(localPort)) {
210+
try (ScmpSender sender = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
215211
nPathTried++;
216-
Scmp.EchoMessage msg = scmpChannel.sendEchoRequest(path, id, bb);
212+
Scmp.EchoMessage msg = sender.sendEchoRequest(path, bb);
217213
if (msg == null) {
218214
println(" -> local AS, no timing available");
219215
nPathSuccess++;
@@ -238,9 +234,9 @@ private Scmp.EchoMessage findShortestEcho(List<Path> paths, Ref<Path> refBest) {
238234
private Scmp.TracerouteMessage findShortestTR(List<Path> paths, Ref<Path> refBest) {
239235
Path path = PathPolicy.MIN_HOPS.filter(paths);
240236
refBest.set(path);
241-
try (ScmpChannel scmpChannel = Scmp.createChannel(localPort)) {
237+
try (ScmpSender sender = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
242238
nPathTried++;
243-
List<Scmp.TracerouteMessage> messages = scmpChannel.sendTracerouteRequest(path);
239+
List<Scmp.TracerouteMessage> messages = sender.sendTracerouteRequest(path);
244240
if (messages.isEmpty()) {
245241
println(" -> local AS, no timing available");
246242
nPathSuccess++;
@@ -269,10 +265,10 @@ private Scmp.TracerouteMessage findShortestTR(List<Path> paths, Ref<Path> refBes
269265

270266
private Scmp.TracerouteMessage findFastestTR(List<Path> paths, Ref<Path> refBest) {
271267
Scmp.TracerouteMessage best = null;
272-
try (ScmpChannel scmpChannel = Scmp.createChannel(localPort)) {
268+
try (ScmpSender sender = Scmp.newSenderBuilder().setLocalPort(localPort).build()) {
273269
for (Path path : paths) {
274270
nPathTried++;
275-
List<Scmp.TracerouteMessage> messages = scmpChannel.sendTracerouteRequest(path);
271+
List<Scmp.TracerouteMessage> messages = sender.sendTracerouteRequest(path);
276272
if (messages.isEmpty()) {
277273
println(" -> local AS, no timing available");
278274
nPathSuccess++;

0 commit comments

Comments
 (0)