Handle MAC broadcast

This commit is contained in:
Baptiste Wicht 2016-09-26 10:28:26 +02:00
parent 407c393426
commit ef48b85e54
No known key found for this signature in database
GPG Key ID: C5566B6C7F884532

View File

@ -66,6 +66,11 @@ void prepare_packet(network::ethernet::packet& packet, network::interface_descri
}
std::expected<uint64_t> get_target_mac(network::interface_descriptor& interface, network::ip::address target_ip){
// Handle broadcast
if(target_ip == network::ip::make_address(255, 255, 255, 255)){
return 0xFFFFFFFFFFFF;
}
// For loopback, there is no gateway
if(interface.is_loopback()){
return network::arp::get_mac_force(interface, target_ip, ARP_TIMEOUT);