Skip to content

Commit

Permalink
Code corrections to NTP version test faucetsdn#25
Browse files Browse the repository at this point in the history
  • Loading branch information
frgitdaq committed Jun 18, 2020
1 parent eddecb9 commit f2a7874
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions docker/include/bin/start_faux
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ elif [ -n "${options[bacnetfail]}" ]; then
FauxDeviceEngine.EntryPoint $local_ip $broadcast_ip "Faux-Device-Fail.json" &
fi

if [ -n "${options[ntp_client]}" ]; then
echo Starting ntp client.
java -jar NTPClient/build/libs/NTPClient-1.0-SNAPSHOT.jar "time.google.com" "123" "3" &
if [ -n "${options[ntpv4]}" ]; then
echo Starting ntp version 4 client.
java -jar NTPClient/build/libs/NTPClient-1.0-SNAPSHOT.jar time.google.com 123 3 4 &
elif [ -n "${options[ntpv3]}" ]; then
echo Starting ntp version 3 client.
java -jar NTPClient/build/libs/NTPClient-1.0-SNAPSHOT.jar time.google.com 123 3 3 &
fi

if [ -n "${options[broadcast_client]}" ]; then
Expand Down
6 changes: 4 additions & 2 deletions subset/network/NTPClient/src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ public class Main {
static String serverName = "time.google.com";
static int PORT = 123;
static int timerPeriod = 10;
static byte version = 4;

public static void main(String[] args) {
if (args.length < 2) {
throw new IllegalArgumentException("Usage: server_name port timerPeriod");
if (args.length != 4) {
throw new IllegalArgumentException("Usage: server_name port timerPeriod ntpVersion");
}
serverName = args[0];
PORT = Integer.parseInt(args[1]);
timerPeriod = Integer.parseInt(args[2]);
version = Byte.parseByte(args[3]);

Runnable senderRunnable = new Runnable() {
@Override
Expand Down
4 changes: 2 additions & 2 deletions testing/test_aux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ interfaces:
faux-1:
opts: brute broadcast_client
faux-2:
opts: nobrute expiredtls bacnetfail pubber passwordfail
opts: nobrute expiredtls bacnetfail pubber passwordfail ntpv3
faux-3:
opts: tls macoui passwordpass bacnet pubber ntp_client broadcast_client
opts: tls macoui passwordpass bacnet pubber ntpv4 broadcast_client
long_dhcp_response_sec: 0
monitor_scan_sec: 0
EOF
Expand Down

0 comments on commit f2a7874

Please sign in to comment.