forked from M-Labs/artiq
1
0
Fork 0

runtime: parse the "ip" configuration as IP, not CIDR.

Or it defaults to the default IP on settings that were previously
perfectly valid.
This commit is contained in:
whitequark 2017-10-30 03:39:21 +00:00
parent dc9327e056
commit 8e91856426
1 changed files with 7 additions and 7 deletions

View File

@ -95,15 +95,15 @@ fn startup() {
}
}
let protocol_cidr;
let protocol_addr;
match config::read_str("ip", |r| r?.parse()) {
Err(()) => {
protocol_cidr = IpCidr::new(IpAddress::v4(192, 168, 1, 50), 24);
info!("using default IP address {}", protocol_cidr);
protocol_addr = IpAddress::v4(192, 168, 1, 50);
info!("using default IP address {}", protocol_addr);
}
Ok(cidr) => {
protocol_cidr = cidr;
info!("using IP address {}", protocol_cidr);
Ok(addr) => {
protocol_addr = addr;
info!("using IP address {}", protocol_addr);
}
}
@ -119,7 +119,7 @@ fn startup() {
let arp_cache = smoltcp::iface::SliceArpCache::new([Default::default(); 8]);
let mut interface = smoltcp::iface::EthernetInterface::new(
Box::new(net_device), Box::new(arp_cache) as Box<smoltcp::iface::ArpCache>,
hardware_addr, [protocol_cidr], None);
hardware_addr, [IpCidr::new(protocol_addr, 0)], None);
let mut scheduler = sched::Scheduler::new();
let io = scheduler.io();