final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
final IPv4ProtocolAddressInfo addrInfo;
addrInfo = (IPv4ProtocolAddressInfo) api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP);
if (addrInfo != null) {
final IPv4Address devAddr = (IPv4Address) addrInfo.getDefaultAddress();
if (devAddr.matches(target, mask)) {
return dev;
}
}
} catch (ApiNotFoundException ex) {
// Should not happen, but if it happens anyway, just ignore it.