204 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
803fa8734a wire: use core::net::Ipv6Addr as the ipv6 address type. 2024-10-06 22:12:49 +02:00
Dario Nieuwenhuis
e6b9a9ca2a wire: use core::net::Ipv4Addr as the ipv4 address type. 2024-10-06 22:12:49 +02:00
Dario Nieuwenhuis
11b6385c77 Fix new clippy lints due to MSRV update. 2024-10-06 21:33:13 +02:00
Dario Nieuwenhuis
34b1fa505b iface: do not require device and timestamp for multicast join/leave.
Instead of eagerly sending the join/leave packet when the user calls join/leave,
we update internal state and send the packet when the interface is polled.

Advantages:
- If the device is exhausted, the packet gets sent later instead of just failing and returning an error to the user.
- Makes the API consistent with everything else in smoltcp: operations only update internal state, poll is what sends/receives packets.
- Enables wrappers to offer simpler APIs with less generics. See https://github.com/embassy-rs/embassy/pull/3329 for an example, which is my original motivation.
2024-09-12 15:53:33 +02:00
Catherine
7b125ef601
Merge pull request #952 from lrh2000/test-benchmark
Fix benchmark and update results
2024-07-13 05:01:00 +00:00
Ruihan Li
f7d39d72a1 Fix benchmark and update results 2024-07-13 02:46:52 +08:00
Ruihan Li
bfbff600ae Add the loopback_benchmark 2024-07-13 02:44:59 +08:00
Lucas C. Villa Real
6c06cd9f8b Update PR #602: implement join_multicast_group() for IPv6
This patch rebases @jgallagher's to the tip of the main branch,
adding support for IPv6 multicast groups. As in the original PR,
it is only possible to join groups by sending an initial MLDv2
Report packet. It is not yet possible to resend the change report,
leave groups, respond to queries, etc.
2024-04-02 19:35:05 -03:00
James Logan
1ff5bc41ee remove unused import 2024-02-09 20:39:32 -05:00
James Logan
b78ab0eb20 clear addresses instead of setting unspecified 2024-02-09 20:34:58 -05:00
James Logan
28b99014d9 update dhcp example to work in the case where we do not already have an ip address from some other source 2024-02-09 17:47:52 -05:00
Thibaut Vandervelden
d26a313d9d fix(ipv6): don't panic if no suitable src_addr
Prevent panic when no suitable source address is found. If no suitable
address is found, the loopback address is used instead. The function can
still panic when the destination address is unspecified.

More tests are added:
- Tests when the interface has no addresses. The loopback address is
  used as source address.
- Tests when the interface only has a link-local address. The link-local
  address is used as source address, unless the destination address is
  the loopback address. In this case, the loopback address is used as
  source address.
2024-01-11 14:24:46 +01:00
Thibaut Vandervelden
951b59ba1c change(socket/icmp): split ICMPv4/v6 processing
Splitting the accept and process functions into separate functions for
IPv4 and IPv6 allows us to avoid the `IpRepr` enum and instead use the
`Ipv4Repr` and `Ipv6Repr` structs directly. This reduces the binary size
by 1.5 KiB.
2024-01-05 14:23:26 +01:00
Thibaut Vandervelden
7ce551db03 fix: fix typos (comments, structs, enums and docs) 2023-12-13 10:54:17 +01:00
Thibaut Vandervelden
dd9eff7cf9 ipv6: use RFC6724 for selecting IPv6 src address
RFC6724 defines how the source address should be selected when given a
destination address. Instead of selecting the first address in the list
of interface addresses, the source address is selected following the
standard.
2023-12-01 11:18:47 +01:00
Thibaut Vandervelden
533f103a95
pass the now time when creating the iface
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-06-12 16:31:38 +02:00
Thibaut Vandervelden
099f5f7c2a Don't use Option for neighbor cache anymore 2023-04-04 18:54:33 +02:00
Ruben De Smet
dc3c44410b
Remove extern crate calls 2023-03-07 11:07:45 +01:00
Dario Nieuwenhuis
5740b76574 iface: remove builder. 2023-01-19 14:43:15 +01:00
Dario Nieuwenhuis
b73c943eee iface: remove lifetimes. 2023-01-19 14:43:15 +01:00
Dario Nieuwenhuis
c015cc358e iface: use owned frag buffer, remove frag from builder. 2023-01-19 13:33:49 +01:00
Dario Nieuwenhuis
050731b519 iface: remove all uses of crate::{Error, Result}; 2023-01-14 21:57:36 +01:00
Dario Nieuwenhuis
0102a4b741 phy: make consume infallible, move timestamp to receive/transmit. 2023-01-14 21:57:36 +01:00
Dario Nieuwenhuis
af115a5769 packet assembler: simplify data structure and api. 2023-01-02 00:28:38 +01:00
Dario Nieuwenhuis
3a080d818b Clippy fixes 2023-01-02 00:20:05 +01:00
Dario Nieuwenhuis
94a52d8baf iface: use heapless LinearMap for ipv4_multicast_groups 2022-12-23 18:23:06 +01:00
Dario Nieuwenhuis
4eb49b808a iface: use heapless LinearMap for neighbor cache. 2022-12-23 18:13:03 +01:00
Dario Nieuwenhuis
9beb57a992 iface: use heapless Vec for routes.
Lookup is O(n) now. However, it previously did 32 (or 128 for ipv6!)
map lookups. Since the route table typically doesn't have that many
routes, the new code is likely faster even if it's O(n).
2022-12-23 18:13:03 +01:00
Davide Della Giustina
4ddb96b1b2
Increased max number of IPs from 4 to 5 because some test use 5 2022-12-20 14:04:24 +00:00
Davide Della Giustina
aec718a08f
Fix clippy and rustfmt errors 2022-12-20 13:21:28 +00:00
Davide Della Giustina
8cf7625cc2
ip_addrs field of an interface is now a heapless::Vec (one test still failing) 2022-12-20 12:02:10 +00:00
Dario Nieuwenhuis
13cc7f83ac Clippy fixes. 2022-11-06 21:45:21 +01:00
Dario Nieuwenhuis
4300e7cc3b GAT-based Device trait.
The current `'a` lifetime in the `Device` trait is essentially a workaround for lack of GATs.
I'm just experimenting how this would look like, it'll have to wait until GATs are stable to go in.

The main benefit is structs implementing `Device` can now borrow stuff. This wasn't possible
before because the `for<'d> T: Device<'d>` bounds would essentially imply `T: 'static`.
2022-11-06 21:18:02 +01:00
Benjamin Brittain
35cea49b8a Adds DNS query type to example 2022-09-22 10:10:05 -04:00
bors[bot]
70915655b3
Merge #634
634: IPv4 fragmentation (for outgoing) r=Dirbaio a=thvdveld

Almost ready for review, just need to clean up some things 🎉 

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2022-09-21 21:12:23 +00:00
Thibaut Vandervelden
fe26f462dd Better names for buffers (#653) 2022-09-21 23:11:35 +02:00
Thibaut Vandervelden
297d90b0ff IPv4 fragmentation (outgoing) 2022-09-21 23:11:35 +02:00
Johannes Draaijer
03e830b886 DHCPv4: use a Vec to store DNS server addresses instead of an array of options 2022-09-06 09:28:55 +02:00
Dario Nieuwenhuis
ecb4cbc545 Clippy fixes. 2022-08-06 00:00:19 +02:00
Thibaut Vandervelden
f04a44d6bc Update 6lowpan example 2022-06-16 15:44:09 +02:00
Thibaut Vandervelden
3065959c70 Reassemble incomming IPv4 packets. 2022-06-09 09:51:29 +02:00
Dario Nieuwenhuis
9e18ca127e socket_set: add get_mut, make get immutable. 2022-06-06 02:26:45 +02:00
Dario Nieuwenhuis
d703a66d1d iface: borrow the device instead of owning it. 2022-06-06 02:26:45 +02:00
Dario Nieuwenhuis
b71ffcb6cc iface: borrow the SocketSet instead of owning. 2022-06-06 01:14:53 +02:00
Thibaut Vandervelden
f3310e63f4 refactor 6LoWPAN fragmentation 2022-06-01 12:27:11 +02:00
AntoonBeres
c11e4bb6a7 added sixlowpan fragmentation benchmark 2022-05-24 10:24:53 +02:00
Thibaut Vandervelden
adf56a1701 sixlowpan: add fragmentation logic in interface 2022-05-23 15:44:20 +02:00
Dario Nieuwenhuis
43329e696e socket/dns: add own error enums for public API. 2022-05-20 23:36:36 +02:00
Dario Nieuwenhuis
72a9ee46ce socket: reorganize module structure, with one module per protocol. 2022-05-20 02:18:00 +02:00
Dario Nieuwenhuis
78f92bcea6 wire: use own Error type. 2022-05-20 01:37:34 +02:00