Skip to content

Commit 74bd6d2

Browse files
committed
slaac: add initial SLAAC implementation
1 parent 4627a5c commit 74bd6d2

File tree

7 files changed

+519
-0
lines changed

7 files changed

+519
-0
lines changed

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ iface-max-route-count-256 = []
184184
iface-max-route-count-512 = []
185185
iface-max-route-count-1024 = []
186186

187+
iface-max-prefix-count-1 = [] # Default
188+
iface-max-prefix-count-2 = []
189+
iface-max-prefix-count-3 = []
190+
iface-max-prefix-count-4 = []
191+
iface-max-prefix-count-5 = []
192+
iface-max-prefix-count-6 = []
193+
iface-max-prefix-count-7 = []
194+
iface-max-prefix-count-8 = []
195+
187196
fragmentation-buffer-size-256 = []
188197
fragmentation-buffer-size-512 = []
189198
fragmentation-buffer-size-1024 = []

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ Amount of "IP address -> hardware address" entries the neighbor cache (also know
256256

257257
Max amount of routes that can be added to one interface. Includes the default route. Includes both IPv4 and IPv6. Default: 2.
258258

259+
### `IFACE_MAX_PREFIX_COUNT`
260+
261+
Max amount of IPv6 prefixes that can be added to one interface via SLAAC.
262+
Should be lower or equal to `IFACE_MAX_ADDR_COUNT`.
263+
259264
### `FRAGMENTATION_BUFFER_SIZE`
260265

261266
Size of the buffer used for fragmenting outgoing packets larger than the MTU. Packets larger than this setting will be dropped instead of fragmented. Default: 1500.

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ static CONFIGS: &[(&str, usize)] = &[
1111
("IFACE_MAX_SIXLOWPAN_ADDRESS_CONTEXT_COUNT", 4),
1212
("IFACE_NEIGHBOR_CACHE_COUNT", 8),
1313
("IFACE_MAX_ROUTE_COUNT", 2),
14+
("IFACE_MAX_PREFIX_COUNT", 1),
1415
("FRAGMENTATION_BUFFER_SIZE", 1500),
1516
("ASSEMBLER_MAX_SEGMENT_COUNT", 4),
1617
("REASSEMBLY_BUFFER_SIZE", 1500),

gen_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def feature(name, default, min, max, pow2=None):
3232
feature("iface_max_sixlowpan_address_context_count", default=4, min=1, max=1024, pow2=8)
3333
feature("iface_neighbor_cache_count", default=8, min=1, max=1024, pow2=8)
3434
feature("iface_max_route_count", default=2, min=1, max=1024, pow2=8)
35+
feature("iface_max_prefix_count", default=1, min=1, max=8)
3536
feature("fragmentation_buffer_size", default=1500, min=256, max=65536, pow2=True)
3637
feature("assembler_max_segment_count", default=4, min=1, max=32, pow2=4)
3738
feature("reassembly_buffer_size", default=1500, min=256, max=65536, pow2=True)

src/iface/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ mod neighbor;
1111
mod route;
1212
#[cfg(feature = "proto-rpl")]
1313
mod rpl;
14+
#[cfg(all(
15+
feature = "proto-ipv6",
16+
any(feature = "medium-ethernet", feature = "medium-ieee802154")
17+
))]
18+
mod slaac;
1419
mod socket_meta;
1520
mod socket_set;
1621

@@ -23,4 +28,9 @@ pub use self::interface::{
2328
};
2429

2530
pub use self::route::{Route, RouteTableFull, Routes};
31+
#[cfg(all(
32+
feature = "proto-ipv6",
33+
any(feature = "medium-ethernet", feature = "medium-ieee802154")
34+
))]
35+
pub use self::slaac::Slaac;
2636
pub use self::socket_set::{SocketHandle, SocketSet, SocketStorage};

0 commit comments

Comments
 (0)