closes #320 enable LinuxMACFetcher on Linux

This commit is contained in:
Anton Keks 2022-01-16 13:11:54 +02:00
parent 70e5397469
commit 417f10fbfa
3 changed files with 5 additions and 4 deletions

View File

@ -1,10 +1,10 @@
Changes in 3.8.0:
- Support for Mac M1 (provided that it runs an arm64 build of Java) - thanks to @aplr #284
- SWT updated for all platforms
- Java 11 is now the minimum required (due to SWT)
- Source can be built with Java 17
- Java 11 is now the minimum required (due to SWT), source can now be built with Java 17
- If real network netmask is known (e.g. LAN), then skipping of broadcast addresses will respect that instead of always skipping .0 and .255 #309
- Pressing IP^ button to prefill local network interfaces will now set netmask in Range Feeder
- LinuxMACFetcher will now read Kernel ARP table directly, not relying on the arp utility to be available #320
- Mac vendors updated
Changes in 3.7.6:

View File

@ -43,7 +43,8 @@ public class ComponentRegistry {
i.register(TXTExporter.class, CSVExporter.class, XMLExporter.class, IPListExporter.class);
i.register(IPFetcher.class, PingFetcher.class, PingTTLFetcher.class, HostnameFetcher.class, PortsFetcher.class);
i.register(MACFetcher.class, (MACFetcher) Class.forName(MACFetcher.class.getPackage().getName() + (Platform.WINDOWS ? ".WinMACFetcher" : ".UnixMACFetcher")).newInstance());
i.register(MACFetcher.class, (MACFetcher) Class.forName(MACFetcher.class.getPackage().getName() +
(Platform.WINDOWS ? ".WinMACFetcher" : Platform.LINUX ? ".LinuxMACFetcher" : ".UnixMACFetcher")).newInstance());
i.register(CommentFetcher.class, FilteredPortsFetcher.class, WebDetectFetcher.class, HTTPSenderFetcher.class,
NetBIOSInfoFetcher.class, PacketLossFetcher.class, HTTPProxyFetcher.class, MACVendorFetcher.class);
i.register(FeederRegistry.class, i.require(FeederGUIRegistry.class));

View File

@ -28,7 +28,7 @@ public class LinuxMACFetcher extends MACFetcher {
@Override public String resolveMAC(InetAddress address) {
try {
String ip = address.getHostAddress();
return arpLines().filter(line -> line.startsWith(ip)).findFirst()
return arpLines().filter(line -> line.startsWith(ip + " ")).findFirst()
.map(line -> line.substring(macIndex, macIndex + macLength).toUpperCase())
.filter(mac -> !unavailableMac.equals(mac))
.orElse(getLocalMAC(address));