Commit Graph

1048 Commits

Author SHA1 Message Date
luojia65 c111bee3b6 Code format using `cargo fmt` 2021-10-27 16:35:05 +08:00
luojia65 a714def8d0 Add lint `#[must_use]` for ring buffer functions.
This lint is in stable Rust now: https://github.com/rust-lang/rust/issues/43302.
These changes are noted according to code comment from @whitequark.
Some test cases and functions are altered due to changes of #[must_use].
2021-10-27 16:26:57 +08:00
bors[bot] 5185a105c3 Merge #560
560: IEEE802154: getters for security fields r=Dirbaio a=thibautvdv

This adds getters for the security fields of the IEEE802154 frame. Also added a test for it.

`src/wire/ieee802154.rs` also contained a function for calculating the CRC. However, this is not needed and thus I also remove it in this PR.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
2021-10-26 16:45:55 +00:00
Thibaut Vandervelden e9ec0aefa8 ieee802154: add getters for security features 2021-10-26 16:58:45 +02:00
Thibaut Vandervelden 6a08f958b2 ieee802154: remove unused CRC 2021-10-26 16:16:24 +02:00
bors[bot] 221eaf90f1 Merge #469
469: Add IEEE 802.15.4/6LoWPAN support r=Dirbaio a=thibautvdv

This adds the IEEE 802.15.4 frame representation.
Still a work in progress and interested to know what you think about this.

I really would like to add 6LowPAN as well, however I'm not sure where to put this in smoltcp, since 6LowPAN is kind of weird.

Co-authored-by: Thibaut Vandervelden <thvdveld@vub.be>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-10-20 23:46:48 +00:00
Dario Nieuwenhuis 9990249336 Fix build when setting medium-ieee802154 but not proto-sixlowpan. 2021-10-21 01:42:18 +02:00
Dario Nieuwenhuis 0d664c14b4 Add medium-ieee802154 to CI.
Not adding to `defmt` because it doesn't build yet.
2021-10-21 01:38:19 +02:00
Dario Nieuwenhuis 8922895a8b Fix some comments. 2021-10-21 01:31:15 +02:00
Thibaut Vandervelden 19d9cd46ca ieee802154: log when we drop a frame 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden be14fbb2a6 ieee802154: update documentation 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden ce9145dd62 ieee802154: Correct filtering of PAN id 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden 91d73273d8 ieee802154: ignore frames with types other than Data 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden ecc45dbeef Remove IpRepr::Sixlowpan 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden 4b9d39706c Set flags to zero, because buffer could be reused. 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden bff2330309 Remove some more todos 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden 061fcf880f Defmt for RawHardwareAddress 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden 6e63433ab3 Set HardwareAddress behind feature flag
When there is no medium in the feature flags, then there is no
HardwareAddress.
2021-10-21 01:25:13 +02:00
Thibaut Vandervelden 80ba5a2e2d Send ICMP unreachable when no UDP socket is found 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden b068a856e5 Use `net_debug` and drop instead of `todo!` 2021-10-21 01:25:13 +02:00
Thibaut Vandervelden 1154390307 Use one PAN ID for source and destination
Also check for the correct destination PAN id when receiving a frame (as
discussed). Linux does this as well.
However, hardware implementations also can drop those packets.
2021-10-21 01:25:13 +02:00
Dario Nieuwenhuis 3b8a0781e5 example/6lowpan: expand readme, do not use monitor interface.
Using a raw socket on `monitor0` causes weird results: packets we receive
include FCS, packets we send are parsed as if they didn't have FCS, except
by wireshark which always expects a FCS??

Turns out the sane way is to use raw sockets on normal `wpanX` interfaces,
in which case all packets we send/receive are without FCS.
2021-10-21 01:25:13 +02:00
Dario Nieuwenhuis 36a0e9b2f3 phy: Use right protocol on RawSocket based on the medium. 2021-10-21 01:25:13 +02:00
Dario Nieuwenhuis 7c35a061a4 ieee80154: process packets without the FCS.
We assume the FCS is checked by lower layers or by hardware.

- Makes it consistent with Ethernet mediums, where we don't handle the FCS either.
- Linux ieee802154 raw sockets send/receive packets without the FCS.
2021-10-21 01:25:13 +02:00
Dario Nieuwenhuis c9712939fb 6lowpan: do not fill neighbor cache from random packets
Equivalent of 6210612be047ee706ac729015cdbc2581e6ae9a3 for 6lowpan
2021-10-21 01:25:13 +02:00
Dario Nieuwenhuis a0b9fb6ebc ipv6: fix Solicited Node address calculation 2021-10-21 01:25:13 +02:00
Dario Nieuwenhuis 3269ce6124 wire: remove HardwareAddress::BROADCAST 2021-10-21 01:25:13 +02:00
Dario Nieuwenhuis b4764e4973 Add RawHardwareAddress, use it in wire ndisc.
This avoids wire needing to know what medium we're on.
2021-10-21 01:25:13 +02:00
Thibaut Vandervelden fb2d0029d8 Add support for 802.15.4 and 6LoWPAN 2021-10-21 01:25:12 +02:00
Dario Nieuwenhuis d66944c4ac Fix wrong matrix bot path 2021-10-20 15:35:32 +02:00
Dario Nieuwenhuis 831ac323cc Merge pull request #554 from smoltcp-rs/matrix-bot
Add matrix bot
2021-10-20 15:33:22 +02:00
Dario Nieuwenhuis daef41bb1c Add matrix bot 2021-10-20 15:25:04 +02:00
bors[bot] a1a48b5f36 Merge #553
553: Fixed typo r=Dirbaio a=mkb2091



Co-authored-by: mkb2091 <mkb2191@protonmail.com>
2021-10-20 00:14:15 +00:00
mkb2091 b3f93117d2 Fixed typo 2021-10-19 22:45:26 +01:00
bors[bot] 3e9ccf53e1 Merge #552
552: tcp: Reply with RST to ACKs with invalid ackno in SYN_SENT. r=Dirbaio a=Dirbaio

Should fix aramperes/onetun#17.

`@aramperes` could you check if this fixes the issue? Thank you!

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-10-19 02:05:22 +00:00
Dario Nieuwenhuis 3baa13372c tcp: Reply with RST to ACKs with invalid ackno in SYN_SENT.
Should fix aramperes/onetun#17
2021-10-19 03:38:44 +02:00
bors[bot] 7a89d23cf3 Merge #551
551: readme: add instructions on how to setup a bridged tap. r=Dirbaio a=Dirbaio



Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-10-19 01:07:36 +00:00
Dario Nieuwenhuis 55c22b9865 readme: add instructions on how to setup a bridged tap. 2021-10-19 03:06:37 +02:00
bors[bot] 03492be337 Merge #549
549: wire: add From<Address> for ::std::net::IpAddr r=Dirbaio a=Dirbaio

Originally from #296 

Co-authored-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-10-19 00:49:10 +00:00
Marc-André Lureau aa10b5250a wire: add From<Address> for ::std::net::IpAddr
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-10-19 02:27:49 +02:00
bors[bot] d0928cf068 Merge #548
548: DHCP fixes r=Dirbaio a=Dirbaio

Several fixes, including one that fixes DHCP not working with some routers.

See individual commit messages for details.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-10-18 23:25:22 +00:00
Dario Nieuwenhuis 48debf7db8 dhcp: add "ignore NAKs" option.
This workarounds a known broken Vodafone Fiber router which replies
with both NAK and ACK:

![screenshot-2021-10-19_01-18-41](https://user-images.githubusercontent.com/1247578/137819133-a8f9ab28-8bc5-4cca-9c91-2eac15d88070.png)
2021-10-19 01:17:28 +02:00
Dario Nieuwenhuis bcf6211fbe socket/dhcp: add nak tests 2021-10-15 01:02:31 +02:00
Dario Nieuwenhuis a43a6772c9 socket/dhcp: add retransmission/timeout tests 2021-10-15 00:43:21 +02:00
Dario Nieuwenhuis 6768d89165 socket/dhcp: add renew test 2021-10-14 23:33:25 +02:00
Dario Nieuwenhuis 94541ae827 socket/dhcp: add basic test 2021-10-14 23:19:30 +02:00
Dario Nieuwenhuis 3b7100c501 socket/dhcp: log incoming reprs as well as outgoing. 2021-10-14 19:41:10 +02:00
Dario Nieuwenhuis af4db615f5 socket/dhcp: Use random transaction_id instead of sequential.
This is a minor security improvement against blind packet spoofing, since
it adds more entropy to the packets.
2021-10-14 14:10:08 +02:00
Dario Nieuwenhuis d34f4f783b socket/dhcp: do not set BROADCAST flag.
Reasons:
1. We were already accidentally not setting the BROADCAST flag due to it being the wrong bit (see previous commit).
2. Major OSes don't set it.
3. rfc1542 section 3.1.1 states it's discouraged, and the issue it's supposed to workaround doesn't apply to smoltcp.

    Unfortunately, some client implementations are
    unable to receive such unicast IP datagrams until they know their own
    IP address
    (..)
    This addition to the protocol is a workaround for old host
    implementations.  Such implementations SHOULD be modified so
    that they may receive unicast BOOTREPLY messages, thus making
    use of this workaround unnecessary.  In general, the use of
    this mechanism is discouraged.
2021-10-14 14:03:50 +02:00
Dario Nieuwenhuis 6d37633353 wire/dhcp: use bitflags for the FLAGS field. 2021-10-14 14:02:27 +02:00