Alex Crawford
d2b557e01c
Prefer assignment operators
...
These were flagged by `cargo clippy`:
warning: manual implementation of an assign operation
2020-12-27 17:00:03 -08:00
Alex Crawford
a73c90ad08
Silence warning about matches macro
...
These were flagged by `cargo clippy`:
warning: match expression looks like `matches!` macro
The matches! macro isn't stabilized until Rust 1.42.
2020-12-27 17:00:02 -08:00
Alex Crawford
79e81bf97f
Silence warning about is_empty method
...
These were flagged by `cargo clippy`:
warning: item has a public `len` method but no corresponding
`is_empty` method
2020-12-27 16:59:39 -08:00
Alex Crawford
1a1861721b
Silence warning about non-exhaustive pattern
...
These were flagged by `cargo clippy`:
warning: this seems like a manual implementation of the
non-exhaustive pattern
The non_exhaustive attribute isn't available until we increase the
minimum Rust version to 1.40, so we should just silence these warnings
in the meantime.
2020-12-27 16:59:30 -08:00
Alex Crawford
752e81489e
Dereference match expressions to clean up patterns
...
These were flagged by `cargo clippy`:
warning: you don't need to add `&` to all patterns
This should have happened in ac830e8b, but I guess I missed it.
2020-12-27 15:20:16 -08:00
Alex Crawford
321998eb66
Prefer if-let syntax over single-pattern match
...
These were flagged by `cargo clippy`:
warning: you seem to be trying to use match for destructuring a
single pattern. Consider using `if let`
This also silences a few cases where the match couldn't be replaced with
an if because of the following error:
error: attributes are not yet allowed on `if` expressions
Once we increase the minimum Rust version to 1.43, these can be updated
as well.
2020-12-27 15:20:14 -08:00
Alex Crawford
b2c04416c2
Use is_empty instead of length comparison
...
These were flagged by `cargo clippy`:
warning: length comparison to zero
2020-12-27 15:18:51 -08:00
Dario Nieuwenhuis
708be1ccb5
Split Packet into EthernetPacket and IpPacket.
...
Functions that only deal with IP packets take/return IpPacket's. IpPacket's
are wrapped into EthernetPacket's as late as possible.
This will later allow generalizing Interface to handle both Ethernet
and pure-IP mediums.
2020-12-27 19:57:18 +01:00
Dario Nieuwenhuis
2d7b150984
Remove "None" variant from Packet, use Option<Packet> instead.
2020-12-27 19:25:25 +01:00
Dario Nieuwenhuis
2c8b780702
tcp: fix racey simultaneous close not sending FIN.
2020-12-27 19:11:52 +01:00
Dario Nieuwenhuis
71a5e41b9e
Merge pull request #396 from smoltcp-rs/rust-2018
...
Update to Rust 2018
2020-12-27 18:49:52 +01:00
Dario Nieuwenhuis
88256dbdcf
Update to Rust 2018. Fixes #271
2020-12-27 17:54:56 +01:00
Dario Nieuwenhuis
1d5a329155
Merge pull request #394 from smoltcp-rs/async
...
Async/await waker support.
2020-12-27 17:33:22 +01:00
Dario Nieuwenhuis
4e11070ff4
Async/await waker support.
2020-12-27 17:31:49 +01:00
Dario Nieuwenhuis
29cc59c89d
Merge pull request #395 from crawford/clippy
...
Various cleanup suggested by cargo clippy
2020-12-26 23:53:25 +01:00
Alex Crawford
c9f57150a8
Dereference match expressions to clean up patterns
...
These were flagged by `cargo clippy`:
warning: you don't need to add `&` to all patterns
2020-12-26 10:32:51 -08:00
Alex Crawford
0c7cdbb4ef
Remove unnecessary returns
...
These were flagged by `cargo clippy`:
warning: unneeded `return` statement
2020-12-26 10:32:51 -08:00
Alex Crawford
c58711e11b
Use newline variants of write macro
...
These were flagged by `cargo clippy`:
warning: using `println!("")`
warning: using `write!()` with a format string that ends in a single
newline
2020-12-26 10:32:42 -08:00
Alex Crawford
d217c81e5d
Remove explicit calls to as_ref/as_mut
...
These were flagged by `cargo clippy`:
warning: this call to `as_ref` does nothing
warning: this call to `as_mut` does nothing
2020-12-26 10:27:32 -08:00
Dario Nieuwenhuis
a7d3f604a3
Don't use matches! macro, for Rust 1.36 support
2020-12-26 03:12:48 +01:00
Dario Nieuwenhuis
67e03b34b6
Fix seq_to_transmit incorrectly returning true when a FIN was enqueued.
...
If there's data queued that doesn't fit into the remote window, we can't
send the FIN either, so seq_to_transmit should return false.
2020-12-26 03:04:17 +01:00
Dario Nieuwenhuis
21deb47bbb
Enable `proto-dhcpv4` feature by default. Fixes #327
2020-12-26 02:06:06 +01:00
Dario Nieuwenhuis
12f2e0f7e2
Merge pull request #372 from JOE1994/null_terminator
...
add null terminator to c-string passed to 'libc::open'
2020-12-26 00:24:27 +01:00
Dario Nieuwenhuis
ebe9e9c450
Merge pull request #393 from smoltcp-rs/linux-mtu-fix
...
Fix MTU of RawSocket and TapInterface.
2020-12-26 00:07:48 +01:00
JOE1994
e12f4abaa0
add null terminator to c-string passed to libc API
2020-12-26 00:07:14 +01:00
Dario Nieuwenhuis
273f4d60b6
Fix MTU of RawSocket and TapInterface.
...
Linux's MTU is the IP MTU, while smoltcp's is the Ethernet MTU.
Therefore we have to add the ethernet header size to it.
2020-12-25 23:57:54 +01:00
Dario Nieuwenhuis
a40a4ac5af
Remove .test_like_travis.rb
2020-12-25 23:57:35 +01:00
Daniel Egger
675374d3ed
Merge pull request #390 from smoltcp-rs/gha
...
Add Github Actions for CI
2020-12-23 09:56:04 +01:00
Adam Greig
49c0871b34
Remove Travis configuration
2020-12-22 15:31:16 +00:00
Adam Greig
8fb34901a7
Add Github Actions for CI
2020-12-22 13:11:35 +00:00
Dario Nieuwenhuis
f89d240c29
tcp: don't send data outside the remote window
2020-12-19 03:23:44 +00:00
Dario Nieuwenhuis
42dc04852b
tcp: allow sending ACKs in FinWait2 state.
2020-12-19 01:13:59 +00:00
whitequark
de5f91a28b
Take MTU into account during TcpSocket dispatch.
2020-10-25 12:35:42 +00:00
mustermeiszer
7b4997d5c7
Taking into account TCP and IP header
...
The MTU consists of TCP header, IP header and the payload.
In the former fix, this was not taken into account.
2020-10-23 15:13:18 +02:00
mustermeiszer
d2aa3edbb7
Fixes unused MTU settings at TcpSocket dispatch
...
This commit fixes a small bug, where the TcpSocket computed the maximum
size per payload in a tx_buffer without taking into account the MTU
defined by the underlying network device.
2020-10-23 14:12:20 +02:00
Sam Jones
d32c72aafd
Changed Dhcpv4Client to use device checksum capabilities
2020-10-22 10:31:36 +00:00
whitequark
7375c67a43
dhcpv4: use offered ip in requested ip option
...
Instead of configuring the ifaces ip address when a dhcp server offers
and ip, we now use the requested_ip option, based on the offered ip
(yiaddr). The user now only has to configure the iface once the dhcp
transaction has completed (Ack'd).
2020-10-22 10:04:03 +00:00
whitequark
3e22502f61
Merge branch 'master' into dhcpv4-use-requested_ip
2020-10-22 09:53:38 +00:00
Dario Nieuwenhuis
bc1f718589
igmp: centisecs are really decisecs
2020-10-22 03:48:19 +00:00
Ryan Summers
1ae400acaa
Return RST to unexpected ACK in SYN-SENT state.
...
Before this commit, the socket got stuck in an unusable state.
2020-08-17 05:44:58 +00:00
whitequark
f35057c19f
Fix test that relied on matching panic messages.
...
The panic message for copy_from_slice changed in Rust 1.47.
2020-08-17 05:19:09 +00:00
Thales Fragoso
88d01234a8
Match silent_until behavior of NeighborState and Cache
2020-08-17 04:44:58 +00:00
Thales Fragoso
561708c34f
Merge lookup and lookup_pure methods
2020-08-17 04:44:58 +00:00
Thales Fragoso
1e5de8d42c
Only limit the neighbor cache rate after sending a request packet
...
Prior to this change, the neighbor cache would get limited even when the
device failed to process our arp packet, which could put the socket in
the waiting state in the next poll.
This change only limits the cache rate if the device successfully
consumed our packet.
2020-08-17 04:44:58 +00:00
whitequark
11e97f3a06
Allow for ARP retry during egress
2020-08-11 16:35:23 +00:00
whitequark
548a019991
Update src/socket/meta.rs
2020-08-11 16:26:53 +00:00
Thales Fragoso
24e4868761
Allow for ARP retry during egress
2020-08-10 22:06:06 -03:00
whitequark
6a38ace62c
Improve docs for `DeviceCapabilities.checksum`.
2020-07-15 05:06:35 +00:00
Dario Nieuwenhuis
4cfe8dafdb
Do not send window updates in states that shouldn't do so.
...
Previously, the window update was sent anytime it changed. This is
not desirable for 2 reasons:
- It would send window updates in TimeWait or Closed states, which is incorrect.
- It would send window updates in states where we've already received the
remote side's FIN, such as CloseWait. This is not necessarily incorrect, but
is useless, since the remote side is not going to send us more data, therefore
it's not interested in our window size anymore.
2020-06-25 04:06:29 +00:00
YOUNGSUK KIM
f6a55fa3c7
replace deprecated item 'mem::uninitialized'
...
This commit replaces the use of deprecated item 'mem::uninitialized'
with 'mem::MaybeUninit'.
Thank you for reviewing :)
2020-06-22 14:46:56 +00:00