detect invalid programmed MAC address

This commit is contained in:
Sebastien Bourdeauducq 2017-08-07 11:18:19 +08:00
parent 115211c143
commit 5ef86b4516
1 changed files with 5 additions and 2 deletions

View File

@ -145,8 +145,11 @@ fn main() {
|_| |_|
"#); "#);
//let hardware_addr = EthernetAddress(board::get_mac_address()); let mut hardware_addr = EthernetAddress(board::get_mac_address());
let hardware_addr = EthernetAddress([0x10, 0xE2, 0xD5, 0x22, 0x23, 0x12]); if hardware_addr.is_multicast() {
println!("programmed MAC address is invalid, using default");
hardware_addr = EthernetAddress([0x10, 0xE2, 0xD5, 0x00, 0x03, 0x00]);
}
let mut protocol_addrs = [IpAddress::v4(192, 168, 69, 1)]; let mut protocol_addrs = [IpAddress::v4(192, 168, 69, 1)];
println!("MAC {} IP {}", hardware_addr, protocol_addrs[0]); println!("MAC {} IP {}", hardware_addr, protocol_addrs[0]);
let mut arp_cache_entries: [_; 8] = Default::default(); let mut arp_cache_entries: [_; 8] = Default::default();