* @param route
* @return
*/
private HardwareAddress findDstHWAddress(IPv4Route route, IPv4Header hdr, SocketBuffer skbuf)
throws NetworkException {
final ARPNetworkLayer arp = getARP();
final IPv4Address dstAddr;
if (hdr.getDestination().isBroadcast()) {
return null;
} else if (route.isGateway()) {
dstAddr = route.getGateway();
} else {
dstAddr = hdr.getDestination();
}
try {
return arp.getHardwareAddress(dstAddr, hdr.getSource(), route.getDevice(), arpTimeout);
} catch (TimeoutException ex) {
throw new NetworkException("Cannot find hardware address of " + dstAddr, ex);
}
}