Skip to content

Commit

Permalink
Update NetworkUtils.java (#4898)
Browse files Browse the repository at this point in the history
Added Eli Fulkerson ARP Ping tool detection.
Added command line to nativeARPPing subrooting for Eli Fulkerson ARP Ping tool.

Signed-off-by: Konstantin Panchenko <[email protected]>
  • Loading branch information
kpanchen authored and David Gräff committed Feb 14, 2019
1 parent 1378cc3 commit 4127674
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ public ArpPingUtilEnum determineNativeARPpingMethod(String arpToolPath) {
}
} else if (result.contains("-w timeout")) {
return ArpPingUtilEnum.IPUTILS_ARPING;
} else if (result.contains("Usage: arp-ping.exe")) {
return ArpPingUtilEnum.ELI_FULKERSON_ARP_PING_FOR_WINDOWS;
}
return ArpPingUtilEnum.UNKNOWN_TOOL;
}
Expand Down Expand Up @@ -283,7 +285,8 @@ public enum ArpPingUtilEnum {
UNKNOWN_TOOL,
IPUTILS_ARPING,
THOMAS_HABERT_ARPING,
THOMAS_HABERT_ARPING_WITHOUT_TIMEOUT
THOMAS_HABERT_ARPING_WITHOUT_TIMEOUT,
ELI_FULKERSON_ARP_PING_FOR_WINDOWS
}

/**
Expand All @@ -293,7 +296,7 @@ public enum ArpPingUtilEnum {
* * https://github.com/ThomasHabets/arping which also works on Windows and MacOS.
*
* @param arpUtilPath The arping absolute path including filename. Example: "arping" or "/usr/bin/arping" or
* "C:\something\arping.exe"
* "C:\something\arping.exe" or "arp-ping.exe"
* @param interfaceName An interface name, on linux for example "wlp58s0", shown by ifconfig. Must not be null.
* @param ipV4address The ipV4 address. Must not be null.
* @param timeoutInMS A timeout in milliseconds
Expand All @@ -311,6 +314,9 @@ public boolean nativeARPPing(@Nullable ArpPingUtilEnum arpingTool, @Nullable Str
} else if (arpingTool == ArpPingUtilEnum.THOMAS_HABERT_ARPING) {
proc = new ProcessBuilder(arpUtilPath, "-w", String.valueOf(timeoutInMS / 1000), "-C", "1", "-i",
interfaceName, ipV4address).start();
} else if (arpingTool == ArpPingUtilEnum.ELI_FULKERSON_ARP_PING_FOR_WINDOWS) {
proc = new ProcessBuilder(arpUtilPath, "-w", String.valueOf(timeoutInMS),
"-x", ipV4address).start();
} else {
proc = new ProcessBuilder(arpUtilPath, "-w", String.valueOf(timeoutInMS / 1000), "-C", "1", "-I",
interfaceName, ipV4address).start();
Expand Down

0 comments on commit 4127674

Please sign in to comment.