Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/executor/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@ impl<'a> NetworkInterface<'a> {
#[cfg(feature = "trace")]
let mut device = Tracer::new(device, |timestamp, printer| trace!("{timestamp} {printer}"));

if hermit_var!("HERMIT_IP").is_some() {
warn!(
"A static IP address is specified with the environment variable HERMIT_IP, but the device is configured to use DHCPv4!"
);
if let Some(hermit_ip) = hermit_var!("HERMIT_IP") {
warn!("HERMIT_IP was set to {hermit_ip}, but Hermit was built with DHCPv4.");
warn!("Ignoring HERMIT_IP.");
}

let ethernet_addr = EthernetAddress([mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]]);
let hardware_addr = HardwareAddress::Ethernet(ethernet_addr);

info!("MAC address {hardware_addr}");
info!("MAC address: {hardware_addr}");
let capabilities = device.capabilities();
info!("{:?}", capabilities.checksum);
info!("MTU: {} bytes", capabilities.max_transmission_unit);
Expand Down Expand Up @@ -132,12 +131,12 @@ impl<'a> NetworkInterface<'a> {
let hardware_addr = HardwareAddress::Ethernet(ethernet_addr);
let ip_addr = IpCidr::from(Ipv4Cidr::from_netmask(myip, mymask).unwrap());

info!("MAC address {hardware_addr}");
info!("Configure network interface with address {ip_addr}");
info!("Configure gateway with address {mygw}");
info!("MAC address: {hardware_addr}");
let capabilities = device.capabilities();
info!("{:?}", capabilities.checksum);
info!("MTU: {} bytes", capabilities.max_transmission_unit);
info!("IP address: {ip_addr}");
info!("Gateway: {mygw}");

// use the current time based on the wall-clock time as seed
let mut config = Config::new(hardware_addr);
Expand Down
8 changes: 4 additions & 4 deletions src/executor/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async fn dhcpv4_run() {
None => {}
Some(dhcpv4::Event::Configured(config)) => {
info!("DHCP config acquired!");
info!("IP address: {}", config.address);
info!("IP address: {}", config.address);
nic.iface.update_ip_addrs(|addrs| {
if let Some(dest) = addrs.iter_mut().next() {
*dest = IpCidr::Ipv4(config.address);
Expand All @@ -139,20 +139,20 @@ async fn dhcpv4_run() {
}
});
if let Some(router) = config.router {
info!("Default gateway: {router}");
info!("Gateway: {router}");
nic.iface
.routes_mut()
.add_default_ipv4_route(router)
.unwrap();
} else {
info!("Default gateway: None");
info!("Gateway: None");
nic.iface.routes_mut().remove_default_ipv4_route();
}

#[cfg(feature = "dns")]
let mut dns_servers: Vec<IpAddress> = Vec::new();
for (i, s) in config.dns_servers.iter().enumerate() {
info!("DNS server {i}: {s}");
info!("DNS server {i}: {s}");
#[cfg(feature = "dns")]
dns_servers.push(IpAddress::Ipv4(*s));
}
Expand Down