Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement StoringModeWithMulticast aka RPL MOP3 #7

Merged
merged 25 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d04d08b
fix embassy compatibility
SamClercky Mar 19, 2024
2717b09
Add temporary fallback for non-existing DODAG
SamClercky Mar 20, 2024
d77b606
enabling mop3 in existing tests
SamClercky Apr 17, 2024
581e1a6
adding multicast targets + multicast DAO
SamClercky Apr 17, 2024
37aa839
add rpl multicast subscription + initial work on relations
SamClercky Apr 18, 2024
522169b
better relations with individual hop expiration
SamClercky Apr 19, 2024
ed8834c
allow scheduling for later retransmission
SamClercky Apr 21, 2024
7a585af
compiling version with multicast packet duplication and transmission
SamClercky Apr 21, 2024
ea6a76f
Multicast duplication in forwarding
SamClercky Apr 23, 2024
201a1ae
Fix solicited mode
SamClercky Apr 23, 2024
191b104
make examples compile again
SamClercky Apr 24, 2024
eae7241
half fixing checksum bug
SamClercky Apr 24, 2024
f4c4657
make smoltcp compilable without rpl-mop-3
SamClercky Apr 25, 2024
8da4e58
debugging multicast
SamClercky Apr 25, 2024
70f6355
remove some excessive logging
SamClercky Apr 27, 2024
acfcefa
add randomness to DAO scheduling
SamClercky Apr 27, 2024
4b8d5eb
fix failing DAO-ACK transmission
SamClercky Apr 28, 2024
4cb4f66
fix copy pasta
SamClercky Apr 29, 2024
8cdad5a
better disallowing multicast forwarding for special multicast addresses
SamClercky Apr 29, 2024
30f1664
make it compile without ipv4 support
SamClercky May 4, 2024
4882099
make tests green again
SamClercky May 4, 2024
9f698f2
create failing test with staged startup
SamClercky May 5, 2024
8876656
add more tests
SamClercky May 5, 2024
37c83f9
make tests green again
SamClercky May 5, 2024
db1bd6c
better no-path relation handling
SamClercky May 27, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
Cargo.lock
*.pcap
sim_logs/
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ static CONFIGS: &[(&str, usize)] = &[
("IFACE_MAX_SIXLOWPAN_ADDRESS_CONTEXT_COUNT", 4),
("IFACE_NEIGHBOR_CACHE_COUNT", 4),
("IFACE_MAX_ROUTE_COUNT", 2),
("IFACE_MAX_MULTICAST_DUPLICATION_COUNT", 16),
("FRAGMENTATION_BUFFER_SIZE", 1500),
("ASSEMBLER_MAX_SEGMENT_COUNT", 4),
("REASSEMBLY_BUFFER_SIZE", 1500),
Expand All @@ -22,6 +23,7 @@ static CONFIGS: &[(&str, usize)] = &[
("RPL_RELATIONS_BUFFER_COUNT", 16),
("RPL_PARENTS_BUFFER_COUNT", 8),
("RPL_MAX_OPTIONS", 2),
("RPL_MAX_NEXT_HOP_PER_DESTINATION", 4),
// END AUTOGENERATED CONFIG FEATURES
];

Expand Down
9 changes: 8 additions & 1 deletion examples/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::thread;
use smoltcp::iface::{Config, Interface, SocketSet};
use smoltcp::phy::{wait as phy_wait, Device, Medium};
use smoltcp::socket::tcp;
use smoltcp::storage::PacketMetadata;
use smoltcp::time::{Duration, Instant};
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr};

Expand Down Expand Up @@ -97,7 +98,13 @@ fn main() {
};
config.random_seed = rand::random();

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24))
Expand Down
9 changes: 8 additions & 1 deletion examples/client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod utils;

use log::debug;
use smoltcp::storage::PacketMetadata;
use std::os::unix::io::AsRawFd;
use std::str::{self, FromStr};

Expand Down Expand Up @@ -38,7 +39,13 @@ fn main() {
};
config.random_seed = rand::random();

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24))
Expand Down
9 changes: 8 additions & 1 deletion examples/dhcp_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
mod utils;

use log::*;
use smoltcp::storage::PacketMetadata;
use std::os::unix::io::AsRawFd;

use smoltcp::iface::{Config, Interface, SocketSet};
Expand Down Expand Up @@ -36,7 +37,13 @@ fn main() {
Medium::Ieee802154 => todo!(),
};
config.random_seed = rand::random();
let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);

// Create sockets
let mut dhcp_socket = dhcpv4::Socket::new();
Expand Down
9 changes: 8 additions & 1 deletion examples/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use smoltcp::iface::{Config, Interface, SocketSet};
use smoltcp::phy::Device;
use smoltcp::phy::{wait as phy_wait, Medium};
use smoltcp::socket::dns::{self, GetQueryResultError};
use smoltcp::storage::PacketMetadata;
use smoltcp::time::Instant;
use smoltcp::wire::{DnsQueryType, EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv6Address};
use std::os::unix::io::AsRawFd;
Expand Down Expand Up @@ -33,7 +34,13 @@ fn main() {
};
config.random_seed = rand::random();

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24))
Expand Down
9 changes: 8 additions & 1 deletion examples/httpclient.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod utils;

use log::debug;
use smoltcp::storage::PacketMetadata;
use std::os::unix::io::AsRawFd;
use std::str::{self, FromStr};
use url::Url;
Expand Down Expand Up @@ -38,7 +39,13 @@ fn main() {
};
config.random_seed = rand::random();

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24))
Expand Down
13 changes: 12 additions & 1 deletion examples/loopback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use log::{debug, error, info};
use smoltcp::iface::{Config, Interface, SocketSet};
use smoltcp::phy::{Device, Loopback, Medium};
use smoltcp::socket::tcp;
use smoltcp::storage::PacketMetadata;
use smoltcp::time::{Duration, Instant};
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr};

Expand Down Expand Up @@ -91,7 +92,17 @@ fn main() {
Medium::Ieee802154 => todo!(),
};

let mut iface = Interface::new(config, &mut device, Instant::now());
// Setup multicast queues
let mut metadata = [PacketMetadata::EMPTY; 16];
let mut multicast_packets = [0; 2048];

let mut iface = Interface::new(
config,
&mut device,
&mut metadata[..],
&mut multicast_packets[..],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(127, 0, 0, 1), 8))
Expand Down
9 changes: 8 additions & 1 deletion examples/multicast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::os::unix::io::AsRawFd;
use smoltcp::iface::{Config, Interface, SocketSet};
use smoltcp::phy::{wait as phy_wait, Device, Medium};
use smoltcp::socket::{raw, udp};
use smoltcp::storage::PacketMetadata;
use smoltcp::time::Instant;
use smoltcp::wire::{
EthernetAddress, IgmpPacket, IgmpRepr, IpAddress, IpCidr, IpProtocol, IpVersion, Ipv4Address,
Expand Down Expand Up @@ -37,7 +38,13 @@ fn main() {
};
config.random_seed = rand::random();

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24))
Expand Down
9 changes: 8 additions & 1 deletion examples/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod utils;

use byteorder::{ByteOrder, NetworkEndian};
use smoltcp::iface::{Interface, SocketSet};
use smoltcp::storage::PacketMetadata;
use std::cmp;
use std::collections::HashMap;
use std::os::unix::io::AsRawFd;
Expand Down Expand Up @@ -114,7 +115,13 @@ fn main() {
};
config.random_seed = rand::random();

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24))
Expand Down
9 changes: 8 additions & 1 deletion examples/server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod utils;

use log::debug;
use smoltcp::storage::PacketMetadata;
use std::fmt::Write;
use std::os::unix::io::AsRawFd;

Expand Down Expand Up @@ -34,7 +35,13 @@ fn main() {

config.random_seed = rand::random();

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(IpAddress::v4(192, 168, 69, 1), 24))
Expand Down
9 changes: 8 additions & 1 deletion examples/sixlowpan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
mod utils;

use log::debug;
use smoltcp::storage::PacketMetadata;
use std::os::unix::io::AsRawFd;
use std::str;

Expand Down Expand Up @@ -83,7 +84,13 @@ fn main() {
config.rpl_config = None;
}

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(
Expand Down
9 changes: 8 additions & 1 deletion examples/sixlowpan_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use std::str;
use smoltcp::iface::{Config, Interface, SocketSet};
use smoltcp::phy::{wait as phy_wait, Device, Medium, RawSocket};
use smoltcp::socket::tcp;
use smoltcp::storage::PacketMetadata;
use smoltcp::wire::{EthernetAddress, Ieee802154Address, Ieee802154Pan, IpAddress, IpCidr};

//For benchmark
Expand Down Expand Up @@ -159,7 +160,13 @@ fn main() {
config.random_seed = rand::random();
config.pan_id = Some(Ieee802154Pan(0xbeef));

let mut iface = Interface::new(config, &mut device, Instant::now());
let mut iface = Interface::new(
config,
&mut device,
vec![PacketMetadata::EMPTY; 16],
vec![0; 2048],
Instant::now(),
);
iface.update_ip_addrs(|ip_addrs| {
ip_addrs
.push(IpCidr::new(
Expand Down
11 changes: 9 additions & 2 deletions src/iface/interface/ethernet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ impl InterfaceInner {
meta: crate::phy::PacketMeta,
frame: &'frame [u8],
fragments: &'frame mut FragmentsBuffer,
multicast_queue: &mut PacketBuffer<'_, MulticastMetadata>,
) -> Option<EthernetPacket<'frame>> {
let eth_frame = check!(EthernetFrame::new_checked(frame));

Expand All @@ -31,8 +32,14 @@ impl InterfaceInner {
#[cfg(feature = "proto-ipv6")]
EthernetProtocol::Ipv6 => {
let ipv6_packet = check!(Ipv6Packet::new_checked(eth_frame.payload()));
self.process_ipv6(sockets, meta, &ipv6_packet)
.map(EthernetPacket::Ip)
self.process_ipv6(
sockets,
meta,
&ipv6_packet,
Some(&eth_frame.src_addr().into()),
multicast_queue,
)
.map(EthernetPacket::Ip)
}
// Drop all other traffic.
_ => None,
Expand Down
12 changes: 9 additions & 3 deletions src/iface/interface/ieee802154.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ impl InterfaceInner {
meta: PacketMeta,
sixlowpan_payload: &'payload [u8],
_fragments: &'output mut FragmentsBuffer,
multicast_queue: &mut PacketBuffer<'_, MulticastMetadata>,
) -> Option<Packet<'output>> {
let ieee802154_frame = check!(Ieee802154Frame::new_checked(sixlowpan_payload));

Expand All @@ -41,9 +42,14 @@ impl InterfaceInner {
self.current_frame = Some(ieee802154_repr);

match ieee802154_frame.payload() {
Some(payload) => {
self.process_sixlowpan(sockets, meta, &ieee802154_repr, payload, _fragments)
}
Some(payload) => self.process_sixlowpan(
sockets,
meta,
&ieee802154_repr,
payload,
_fragments,
multicast_queue,
),
None => None,
}
}
Expand Down
Loading