1486 Commits

Author SHA1 Message Date
bors[bot]
1f9b9f0c9a
Merge #792
792: fix(791): wrong payload length of first IPv4 frag r=thvdveld a=thvdveld

The payload length of the first IPv4 fragment packet contained the length of the unfragmented packet. This was because the `repr` was a clone and not a mutable ref to `ip_repr`. This is now fixed.

We also didn't check that the full IP packet fits in the fragmentation buffer, which should contain the unfragmented emitted packet.

Fixes #791.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-06-05 09:14:54 +00:00
Thibaut Vandervelden
5c6475aaa5 fix(791): wrong payload length of first IPv4 frag
The payload length of the first IPv4 fragment packet contained the
length of the unfragmented packet. This was because the `repr` was
a clone and not a mutable ref to `ip_repr`. This is now fixed.

We also didn't check that the full IP packet fits in the fragmentation
buffer, which should contain the unfragmented emitted packet.

Fixes #791.

Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-06-05 11:04:48 +02:00
Dario Nieuwenhuis
88aa133658
Merge pull request #788 from mkj/abort-wake
tcp: Perform a reset() after an abort()
2023-05-25 16:24:12 +02:00
Matt Johnston
7e12265f00 tcp: Wake tx waker after abort()
It is useful to wake once the RST packet has been emitted, so
async callers can wait before dropping the socket.
2023-05-25 22:07:29 +08:00
bors[bot]
6687745cbb
Merge #787
787: IPv4: Don't discard from unspecified src addresses r=Dirbaio a=bjoernQ

IPv4 packets from `0.0.0.0` get discarded early. This makes it impossible to create a DHCP server.

Not sure if this is the right location or even the right approach for this fix.

Maybe there is also a way to make this work without modifying the code?


Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
2023-05-25 14:03:14 +00:00
bjoernQ
74fd2aeeb6 IPv4: Don't discard from unspecified src addresses 2023-05-25 14:46:33 +02:00
bors[bot]
e4e39ac8d8
Merge #781
781: IPv6 Extension Headers rewrite r=thvdveld a=thvdveld

I rewrote the IPv6 Extension Headers. All those headers have the `Next Header` and `Header Length` fields in common. These are now accessible using `Ipv6ExtHeader`. I removed the IPv6HopByHopOption, because this header only contains options, which can be accessed using the `Ipv6OptionsIterator`.

I also added tests for 6LoWPAN extension headers, routing header and hop-by-hop header), replacing #765 and #770 .

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 12:37:32 +00:00
Thibaut Vandervelden
23d0754125 Add tests for 6LoWPAN extension headers.
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 14:36:52 +02:00
Thibaut Vandervelden
4ea83546df Rewrite IPv6 extension headers 2023-05-25 14:36:52 +02:00
bors[bot]
16d10d018a
Merge #789
789: fix: make codecov informational r=thvdveld a=thvdveld

Adding the lines makes codecov informational. This should stop making the coverage report fail CI (hopefully).

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 11:18:45 +00:00
Thibaut Vandervelden
838c13893c
fix: make codecov informational
Hopefully this does not fail CI.

Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 13:11:10 +02:00
bors[bot]
54eeb4c2fb
Merge #777
777: Implement RPL Rank logic r=thvdveld a=thvdveld

Should be merged after #773 .

This implements the RPL Rank logic, which is defined here:
https://datatracker.ietf.org/doc/html/rfc6550#section-3.5
https://datatracker.ietf.org/doc/html/rfc6550#section-3.6
https://datatracker.ietf.org/doc/html/rfc6550#section-3.7

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 11:08:38 +00:00
Thibaut Vandervelden
391e762991 Add proto-rpl to CI tests
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 13:07:29 +02:00
Thibaut Vandervelden
6513c941de Add RPL Rank logic
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 13:07:29 +02:00
bors[bot]
480051c3b6
Merge #772 #773
772: Implement the sequence counter from RFC6550 7.2 r=thvdveld a=thvdveld



773: Implementation of the Trickle algorithm defined in RFC6206 r=thvdveld a=thvdveld

Should be merged after #772

I implemented the Enhanced trickle timer, since it creates the RPL network faster while still being efficient. The enhanced trickle has other default values and initializes the minimum interval differently.

Link to the [RFC 6206](https://datatracker.ietf.org/doc/html/rfc6206).
Link to the [enhanced trikcle timer](https://d1wqtxts1xzle7.cloudfront.net/71402623/E-Trickle_Enhanced_Trickle_Algorithm_for20211005-2078-1ckh34a.pdf?1633439582=&response-content-disposition=inline%3B+filename%3DE_Trickle_Enhanced_Trickle_Algorithm_for.pdf&Expires=1681472005&Signature=cC7l-Pyr5r64XBNCDeSJ2ha6oqWUtO6A-KlDOyC0UVaHxDV3h3FuVHRtcNp3O9BUfRK8jeuWCYGBkCZgQT4Zgb6XwgVB-3z4TF9o3qBRMteRyYO5vjVkpPBeN7mz4Tl746SsSCHDm2NMtr7UVtLYamriU3D0rryoqLqJXmnkNoJpn~~wJe2H5PmPgIwixTwSvDkfFLSVoESaYS9ZWHZwbW-7G7OxIw8oSYhx9xMBnzkpdmT7sJNmvDzTUhoOjYrHTRM23cLVS9~oOSpT7hKtKD4h5CSmrNK4st07KnT9~tUqEcvGO3aXdd4quRZeKUcCkCbTLvhOEYg9~QqgD8xwhA__&Key-Pair-Id=APKAJLOHF5GGSLRBV4ZA).

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 10:58:50 +00:00
bors[bot]
dda156614b
Merge #784
784: fix: check length field of NDISC redirected head r=thvdveld a=thvdveld

If the length field indicates a lenght bigger than the actual data that it is carying, then the packet is just wrong. Emitting such a packet is also not allowed. We now also parse the IPv6 header in an NDISC redirected packet and check that the length is correct.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-25 10:53:28 +00:00
Thibaut Vandervelden
29abfa35e9
fix: check length field of NDISC redirected head
If the length field indicates a lenght bigger than the actual data that
it is carying, then the packet is just wrong. Emitting such a packet is
also not allowed. We now also parse the IPv6 header in an NDISC
redirected packet and check that the length is correct.

Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-05-10 14:35:32 +02:00
bors[bot]
8b0c521e20
Merge #767
767: RPL Hop-by-Hop option r=Dirbaio a=thvdveld

Add the RPL Hop-by-Hop option to IPv6 `src/wire/ipv6option.rs`.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-23 21:50:28 +00:00
Dario Nieuwenhuis
35b6fecdff disable codecov diff annotations 2023-04-17 22:34:12 +02:00
bors[bot]
9f69242b20
Merge #776
776: Add file descriptor support for tuntap devices r=Dirbaio a=blechschmidt

Android exposes a file descriptor to a TUN interface through the [VpnService](https://developer.android.com/reference/android/net/VpnService) interface. This commit adds support for operating on such a file descriptor directly.

Co-authored-by: B. Blechschmidt <git@blechschmidt.io>
2023-04-17 20:29:23 +00:00
B. Blechschmidt
d1d1d2368f Add file descriptor support for tuntap devices 2023-04-17 22:17:43 +02:00
Dario Nieuwenhuis
8aecdeb18e
Merge pull request #775 from thvdveld/coverage-badge
Add codecov.io badge on the README
2023-04-17 15:26:10 +02:00
Thibaut Vandervelden
5f34813f09
Add codecov.io badge on the README
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-17 15:24:03 +02:00
Thibaut Vandervelden
8681d66fbe Implement the Trickle algorithm defined in RFC6206
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-17 15:14:48 +02:00
Thibaut Vandervelden
be7bd72d5b Implement the sequence counter from RFC6550 7.2
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-17 15:14:30 +02:00
Thibaut Vandervelden
a45a39e2a6 Add RPL Hop-by-Hop option to IPv6Option
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-17 15:03:02 +02:00
Dario Nieuwenhuis
56d329bb03
Merge pull request #774 from thvdveld/ci-code-coverage
Add code coverage using llvm-cov and codecov.io
2023-04-17 14:25:40 +02:00
Thibaut Vandervelden
42dd475d30 Add code coverage using llvm-cov and codecov.io
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-17 13:28:00 +02:00
bors[bot]
1d3e7f927d
Merge #771
771: Use bash script in CI r=thvdveld a=thvdveld

Use a bash script in CI. The advantage of this is that we can run this script locally as well, and thus check if a PR would pass the checks or not locally.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-16 09:35:51 +00:00
Thibaut Vandervelden
68a67fa2d5 use shell script for CI tasks 2023-04-16 11:34:43 +02:00
bors[bot]
5aca9f28a0
Merge #766
766: Add wire representation for the RPL protocol. r=thvdveld a=thvdveld

I'm splitting #627 into smaller PRs.

This PR adds the wire representation of the RPL protocol.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-07 12:48:08 +00:00
Thibaut Vandervelden
af1d94aa4c Add wire representation for the RPL protocol.
Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-07 14:45:53 +02:00
bors[bot]
2ccf297eb9
Merge #764
764: Fix incorrect test packet r=thvdveld a=thvdveld

The packet had 0x12 for the length, which is not the same as the variable name suggests.

bors r+

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-07 08:10:09 +00:00
Thibaut Vandervelden
99adcf7506
Fix incorrect test packet
The packet had 0x12 for the length, which is not the same as the
variable name suggests.

Signed-off-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-04-07 10:07:34 +02:00
bors[bot]
8fca439232
Merge #745
745: Modify `hardware_addr` and `neighbor_cache` to be not `Option` r=Dirbaio a=thvdveld

Since `neighbor_cache` is now using `heapless::LinearMap` it doesn't need to be an `Option` any more. 

It's also possible to just make the `hardware_address` not `Option`.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-04-04 17:02:16 +00:00
Dario Nieuwenhuis
572b22b4f2 Clippy fix. 2023-04-04 18:55:24 +02:00
Thibaut Vandervelden
099f5f7c2a Don't use Option for neighbor cache anymore 2023-04-04 18:54:33 +02:00
bors[bot]
4aaab35b36
Merge #748
748: tcp: do not count window updates as duplicate acks. r=Dirbaio a=Dirbaio

rfc 2581:

> The TCP sender SHOULD use the "fast retransmit" algorithm to detect
> and repair loss, based on incoming duplicate ACKs.  The fast
> retransmit algorithm uses the arrival of 3 duplicate ACKs (4
> ***identical*** ACKs without the arrival of any other intervening packets)
> as an indication that a segment has been lost.  After receiving 3
> duplicate ACKs, TCP performs a retransmission of what appears to be
> the missing segment, without waiting for the retransmission timer to
> expire.

This means they have to have the same seq, ack and win, and therefore they must not be window updates.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-04-04 16:19:31 +00:00
bors[bot]
dcac7ad6c6
Merge #744
744: Add support for rebinding to DHCP implementation r=Dirbaio a=JarredAllen

The current DHCP implementation does not include the REBINDING state as detailed in the spec. I propose modifying the REBINDING state to send request packets until the REBINDING time begins, and then broadcast request packets once the REBINDING time begins.

I added assertions for broadcast request packets to the existing unit tests, which pass. I also validated on my setup that it sent a broadcast request at the T2 time my DHCP server sends. I think this should be sufficient validation, but I can provide more if requested.

There were a couple edge cases of the DHCP protocol pertaining to this change for which I couldn't find a specification in the standards. I documented the decisions I made in those cases, but I'm not attached to what I did (my setup hits none of them) so I can change it to something else if you prefer.

Co-authored-by: Jarred Allen <jarred@moveparallel.com>
2023-04-04 16:15:25 +00:00
bors[bot]
02544549fd
Merge #763
763: Add opcode and flag enums to dns export r=Dirbaio a=wmcleish

Added opcode and flag enums to dns export. As it currently stands, user is not able to access the enums which are parameters to DnsPacket's "set_opcode" and "set_flags" functions. This change will allow the user to import and use those enums to set the packet contents. If there is a more elegant way to include them in DnsPacket instead of being their own imports, please suggest what changes can be made. Refer to [issue 762](https://github.com/smoltcp-rs/smoltcp/issues/762)

Edit: Sorry for commit spam, rustfmt not working locally for some reason.

Co-authored-by: Will McLeish <71392578+wmcleish@users.noreply.github.com>
2023-04-04 10:58:35 +00:00
Will McLeish
3f4210c219
Update from comments
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-04-03 19:13:01 -07:00
Will McLeish
91823243ae formatting 2023-04-03 23:18:01 +00:00
Will McLeish
e9ce9e59f5 formatting 2023-04-03 23:09:35 +00:00
Will McLeish
f7e499323d formatting 2023-04-03 23:03:17 +00:00
Will McLeish
27c6f611bb added opcode and flag enums to dns export 2023-04-03 22:24:36 +00:00
bors[bot]
bd2086527b
Merge #759
759: Put IEEE802154 in separate iface module r=thvdveld a=thvdveld

And thus splitting IEEE802154 from 6LoWPAN.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-03-30 08:48:50 +00:00
bors[bot]
65c318e5b9
Merge #760
760: Bump minor version of heapless r=Dirbaio a=GrantM11235

Smoltcp uses `heapless::Vec::remove`, which was added in [version 0.7.15](https://github.com/japaric/heapless/blob/HEAD/CHANGELOG.md#v0715---2022-07-05)

There is also a newer version, [0.7.16](https://github.com/japaric/heapless/blob/HEAD/CHANGELOG.md#v0716---2022-08-09), but I don't know if smoltcp requires it

Co-authored-by: Grant Miller <GrantM11235@gmail.com>
2023-03-29 22:57:04 +00:00
Grant Miller
d2fd7ffe0d Bump minor version of heapless 2023-03-29 16:18:08 -05:00
Thibaut Vandervelden
f95fbca743 Put IEEE802154 in separate iface module 2023-03-29 16:14:26 +02:00
bors[bot]
1549a5e9c4
Merge #758
758: Better impls defmt for some structs r=Dirbaio a=thvdveld

Sometimes, the defmt implementation was not readable when debugging. I changed it such that the defmt implementation matches the Display implementation (which was more readable).

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2023-03-29 13:49:49 +00:00