Update gateway.rs

main
shellrow 4 years ago
parent c91d650c37
commit 1c0d5d8cc9
  1. 1
      src/gateway.rs

@ -295,6 +295,7 @@ fn get_mac_through_arp(dst_ip: Ipv4Addr) -> Option<String> {
let arp = pnet::packet::arp::ArpPacket::new(&buf[pnet::packet::ethernet::MutableEthernetPacket::minimum_packet_size()..]).unwrap(); let arp = pnet::packet::arp::ArpPacket::new(&buf[pnet::packet::ethernet::MutableEthernetPacket::minimum_packet_size()..]).unwrap();
if arp.get_sender_hw_addr() != interface.mac.unwrap() { if arp.get_sender_hw_addr() != interface.mac.unwrap() {
target_mac_addr = arp.get_sender_hw_addr(); target_mac_addr = arp.get_sender_hw_addr();
break;
} }
} }
if target_mac_addr == pnet::datalink::MacAddr::zero() { if target_mac_addr == pnet::datalink::MacAddr::zero() {

Loading…
Cancel
Save