net: Support dual stack IP

This commit is contained in:
Ruben De Smet
2023-06-07 12:04:15 +02:00
parent ca47af6978
commit 352f0b6c38
19 changed files with 94 additions and 45 deletions

View File

@ -42,13 +42,13 @@ async fn main_task(spawner: Spawner) {
// Choose between dhcp or static ip
let config = if opts.static_ip {
Config::StaticV4(embassy_net::StaticConfigV4 {
Config::ipv4_static(embassy_net::StaticConfigV4 {
address: Ipv4Cidr::new(Ipv4Address::new(192, 168, 69, 2), 24),
dns_servers: Vec::new(),
gateway: Some(Ipv4Address::new(192, 168, 69, 1)),
})
} else {
Config::Dhcp(Default::default())
Config::dhcpv4(Default::default())
};
// Generate random seed

View File

@ -40,14 +40,14 @@ async fn main_task(spawner: Spawner) {
// Choose between dhcp or static ip
let config = if opts.static_ip {
Config::StaticV4(embassy_net::StaticConfigV4 {
Config::ipv4_static(embassy_net::StaticConfigV4 {
address: Ipv4Cidr::new(Ipv4Address::new(192, 168, 69, 1), 24),
dns_servers: Vec::from_slice(&[Ipv4Address::new(8, 8, 4, 4).into(), Ipv4Address::new(8, 8, 8, 8).into()])
.unwrap(),
gateway: Some(Ipv4Address::new(192, 168, 69, 100)),
})
} else {
Config::Dhcp(Default::default())
Config::dhcpv4(Default::default())
};
// Generate random seed

View File

@ -38,13 +38,13 @@ async fn main_task(spawner: Spawner) {
// Choose between dhcp or static ip
let config = if opts.static_ip {
Config::StaticV4(embassy_net::StaticConfigV4 {
Config::ipv4_static(embassy_net::StaticConfigV4 {
address: Ipv4Cidr::new(Ipv4Address::new(192, 168, 69, 2), 24),
dns_servers: Vec::new(),
gateway: Some(Ipv4Address::new(192, 168, 69, 1)),
})
} else {
Config::Dhcp(Default::default())
Config::dhcpv4(Default::default())
};
// Generate random seed

View File

@ -53,13 +53,13 @@ async fn main_task(spawner: Spawner) {
// Choose between dhcp or static ip
let config = if opts.static_ip {
Config::StaticV4(embassy_net::StaticConfigV4 {
Config::ipv4_static(embassy_net::StaticConfigV4 {
address: Ipv4Cidr::new(Ipv4Address::new(192, 168, 69, 2), 24),
dns_servers: Vec::new(),
gateway: Some(Ipv4Address::new(192, 168, 69, 1)),
})
} else {
Config::Dhcp(Default::default())
Config::dhcpv4(Default::default())
};
// Generate random seed