BROADCAST ip to BROADCAST_MAC
This commit is contained in:
parent
f3cbc1def2
commit
966f054a63
@ -171,6 +171,15 @@ impl ArpInfo {
|
|||||||
if ip == BROADCAST_IPADDR {
|
if ip == BROADCAST_IPADDR {
|
||||||
return (BROADCAST_MAC, ip, false);
|
return (BROADCAST_MAC, ip, false);
|
||||||
}
|
}
|
||||||
|
let edge = get_edge();
|
||||||
|
let netbit = edge.device_config.get_net_bit();
|
||||||
|
let host_netmask = net_bit_len_to_mask(netbit);
|
||||||
|
let host_netmask_reverse = !host_netmask;
|
||||||
|
|
||||||
|
if (ip & host_netmask_reverse) == host_netmask_reverse {
|
||||||
|
return (BROADCAST_MAC, ip, false);
|
||||||
|
}
|
||||||
|
|
||||||
let first_ip = (ip >> 24) as u8 & 0xff;
|
let first_ip = (ip >> 24) as u8 & 0xff;
|
||||||
if first_ip >= 224 && first_ip <= 239 {
|
if first_ip >= 224 && first_ip <= 239 {
|
||||||
let mut multi = MULTICAST_MAC;
|
let mut multi = MULTICAST_MAC;
|
||||||
@ -180,10 +189,8 @@ impl ArpInfo {
|
|||||||
return (multi, ip, false);
|
return (multi, ip, false);
|
||||||
}
|
}
|
||||||
let mut target_ip = 0;
|
let mut target_ip = 0;
|
||||||
let edge = get_edge();
|
|
||||||
|
|
||||||
let host_ip = edge.device_config.get_ip();
|
let host_ip = edge.device_config.get_ip();
|
||||||
let host_netmask = net_bit_len_to_mask(edge.device_config.get_net_bit());
|
|
||||||
|
|
||||||
if (ip & host_netmask) == (host_ip & host_netmask) {
|
if (ip & host_netmask) == (host_ip & host_netmask) {
|
||||||
target_ip = ip;
|
target_ip = ip;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user