1
0
Fork 0

Add default gateway into IpSettings

This commit is contained in:
linuswck 2024-03-06 10:34:57 +08:00
parent 65b757ac3c
commit a579e5c5d5
1 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,7 @@ pub struct IpSettings {
addr: [u8; 4],
port: u16,
prefix_len: u8,
gateway: [u8; 4],
}
impl Default for IpSettings {
@ -36,6 +37,7 @@ impl Default for IpSettings {
addr: [192, 168, 1, 132],
port: 1337,
prefix_len: 24,
gateway: [192, 168, 1, 1]
}
}
}
@ -130,7 +132,7 @@ impl ServerHandle {
let mut routes = smoltcp::iface::Routes::new();
routes
.add_default_ipv4_route(Ipv4Address::new(192, 168, 1, 1))
.add_default_ipv4_route(Ipv4Address::new(ip_settings.gateway[0], ip_settings.gateway[1], ip_settings.gateway[2], ip_settings.gateway[3]))
.ok();
dma.enable_interrupt();