Commit Graph

849 Commits

Author SHA1 Message Date
Astro ebf449340b test_icmp_reply_size: fix for ipv4-only case
Closes: #292
Approved by: whitequark
2019-05-01 10:11:50 +08:00
Andreas Molzer 4172ce1301 Implement accessors for the Tracer
This makes the `Tracer` wrapper for a phy device close to a drop-in
replacement for the encapsulated device.

Closes: #289
Approved by: whitequark
2019-04-26 20:30:20 +08:00
Andreas Molzer 8c3bdf907b Allow access to phy-device in ethernet
Adds accessor functions to the device implementing the phy::Device trait
within an ethernet interface. The intent is to allow access to read-only
methods such as gathering of device statistics or other diagnostics
while the interface is running. The interface does not hold any internal
invariants on the device, so that a mutable accessor can be added as
well.

Closes: #289
Approved by: whitequark
2019-04-26 20:30:20 +08:00
Andreas Molzer b27cbad6f4 Fix omission of udp checksum
Allow the control flow to continue when udp parsing encounters an
invalid checksum within an ipv4 packet, instead of returning with an
error. Additionally adds a test to ensure the correct behaviour.

Closes: #280

Closes: #290
Approved by: whitequark
2019-04-26 20:14:01 +08:00
Andreas Molzer c9fbd56977 Remove an unused mut qualifier on a variable
Fixes a denied lint uncovered on a recent nightly compiler version,
apparently through improved analysis. The code in question is only
compiled with the proto-ipv6 feature and older compiler versions did not
detect the unused qualifier, sometime around 2019-04-23.

Closes: #291
Approved by: whitequark
2019-04-26 20:01:48 +08:00
Adam Greig 59f5cbbe64 Fix IPv4 broadcast handling
A regression meant broadcast IPv4 packets were ignored. Restore
handling those packets and also reply to broadcast ICMPv4 echo requests.

Closes #287.

Closes: #288
Approved by: whitequark
2019-04-15 01:57:17 +08:00
Andreas Molzer d9e0c8246c Add ip version specific addr/endpoint converters
Converting from `::std::net::*` types to the ip related library structs
previously required both ip-version features to be enabled. This
introduced dedicated converters from the ip-version specific standard
address and endpoint representations (`IpV4Addr`, `IpV6Addr`,
`SocketAddrV4`, and `SocketAddrV6`) that are enabled without requiring
the other ip-version feature to be selected.

Closes: #286
Approved by: whitequark
2019-04-13 14:31:55 +08:00
Kornel 55d1e9c997 Update Cargo.toml
Add a second category that's specifically for TCP
2019-03-30 19:45:29 +00:00
Chris Branch 8ef6637b0b Implement Any-IP feature
Any-IP is the capability to accept packets locally even when the
destination address is not configured on any interface. This lets
a service bind to an entire subnet of addresses and is particularly
useful in anycast deployments.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4465b469008bc03b98a1b8df4e9ae501b6c69d4b
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ab79ad14a2d51e95f0ac3cef7cd116a57089ba82

This feature is not available for IPv6 as it would be a nop: the current
IPv6 handler doesn't filter packets by the interface's IP address(es).

Closes: #276
Approved by: whitequark
2019-03-19 05:47:29 +08:00
Kai Lüke 49e985a66e Implement peek functions for UDP sockets
This needed a peek function for the packet buffer.

Closes: #278
Approved by: whitequark
2019-02-28 00:58:33 +08:00
Kai Lüke 2ac9c77d18 Document that Packetization Layer Path MTU Discovery in TCP is not supported
PLPMTU should be used if ICMP messages are dropped by the network.

Closes: #277
Approved by: whitequark
2019-02-27 00:29:01 +08:00
Derk Bell 4bb0e5f21a fix indentation
Closes: #274
Approved by: dlrobertson
2019-02-01 23:13:35 +08:00
Derk Bell a1d3b94f7b make fill method public #273
Closes: #274
Approved by: dlrobertson
2019-02-01 23:13:35 +08:00
Alex Crawford 2477355516 Allow more integer types when creating Instants
This allows any type that can be converted into an `i64` to be used when
creating an Instant. Because this is no longer a concrete type, this
change may break existing code like the following:

    error: attempt to multiply with overflow
       --> src/time.rs:282:37
        |
    282 |         epoc = Instant::from_millis(2085955200 * 1000).into();
        |                                     ^^^^^^^^^^^^^^^^^
        |
        = note: #[deny(const_err)] on by default

Closes: #272
Approved by: whitequark
2019-01-28 06:37:39 +08:00
jhwgh1968 e867832214 Minimal Implementation of TCP Selective Acknowledgement
Closes: #266
Approved by: whitequark
2019-01-01 13:51:02 +08:00
Luka Atanasovski 04c9518dd2 Implement raw sockets via BPF on macOS. 2018-12-28 11:46:43 +00:00
whitequark bbc526fcd6 Fix rust-1.28 feature name (should be rust_1.28). 2018-10-29 07:05:49 +00:00
whitequark 7f5fc4e841 Bump version. 2018-10-29 07:02:57 +00:00
Kai Lüke 15c6c24a87 Increase number of assembler gaps to 32 for std/alloc targets
Only allowing four missing packets is hurting
performance for large receive windows.

The new value was picked by observing good
performance with 500 kB socket buffers.

Closes: #264
Approved by: whitequark
2018-10-05 18:36:35 +08:00
Kai Lüke 2047aaea28 Only change the assembler state on success
The current hole was always shrinked even if the
packet assembler rejected adding a packet due to
not being able to insert a new hole.

Shrink only after a new hole was added.
Shrinking before or after does not make a difference
because offset + size < hole_size and thus
contigs[index] is not empty, passing the
debug_assert in add_contig_at.

https://github.com/m-labs/smoltcp/issues/261

Closes: #265
Approved by: whitequark
2018-09-22 22:00:14 +08:00
jhwgh1968 05d5183ccc Fix fault injection on TCP streams
Closes: #263
Approved by: whitequark
2018-09-16 04:19:57 +08:00
jhwgh1968 ed3862f63b Add iter_data() to Assembler
Closes: #262
Approved by: whitequark
2018-09-01 08:29:59 +08:00
whitequark b06bb735c7 Bring feature list in README up to date. 2018-08-28 00:13:35 +00:00
jhwgh1968 88016e675f Fully implement TCP Window Scaling
Closes: #253
Approved by: whitequark
2018-08-20 06:57:44 +08:00
whitequark 2b7a25b1e2 Add an ARTIQ-specific cargo feature "rust-1.28".
This cargo feature only exists because (a) ARTIQ uses a fork of Rust,
(b) Rust has some ridiculous renaming going on in the alloc crate,
(c) smoltcp exists because of ARTIQ.

Such features will not be ordinarily provided by smoltcp.
2018-08-10 14:53:28 +00:00
Astro a8f2725784 Implement IGMPv1/v2 processing.
Closes: #178
Approved by: whitequark
2018-08-01 10:26:51 +08:00
whitequark 06c7e6eb54 examples: remove the remaining panics on poll error. 2018-07-31 13:58:00 +00:00
Astro c2c08b4c35 Add IpAddress.to_prefix_len()
Closes: #255
Approved by: whitequark
2018-07-31 19:26:47 +08:00
Astro 633d89b78e Add a few DHCP options
Closes: #255
Approved by: whitequark
2018-07-31 19:26:47 +08:00
M@ Dunlap f3d34b09a2 fixed DHCP constants
Closes: #257
Approved by: whitequark
2018-07-30 22:32:15 +08:00
whitequark 5bcb358eb5 Rename `new` method on Packet types to `new_checked`.
Fixes #195.

Closes: #254
Approved by: dlrobertson
2018-07-11 12:59:05 +08:00
Dan Robertson 8a214f3850 Add MLDv2 Repr support
Closes: #252
Approved by: whitequark
2018-07-11 10:47:52 +08:00
whitequark 125a102b71 Update to track changes in liballoc. 2018-07-11 01:57:56 +00:00
Kai Lüke 970502e9fb Proper calculation of TCP header length
The presence of TCP options will only increase
the header length to muliples of 4. The added
padding consists of zeros.

This also fixes an emit panic when the Window
Scale and MSS options result in a length of 27
which then gets floored to 24 when applied to
the header.

Closes: #251
Approved by: whitequark
2018-06-28 19:30:43 +08:00
Dan Robertson 56463f19bd Fix code syle nits
- phy: Fix unused mut ref
 - wire: Fix comment collapse unneeded impl block

Closes: #250
Approved by: whitequark
2018-06-27 21:17:50 +08:00
jhwgh1968 1745df2110 Implement TCP Window Scaling, Phase 1 (Issue #106)
Closes: #232
Approved by: whitequark
2018-06-25 03:08:44 +08:00
Sidharth Shanker c7e35d143c Add GC & threshold to the ARP cache.
Closes: #234
Approved by: whitequark
2018-06-25 02:55:53 +08:00
Dan Robertson 82f822930c Move more iface tests to test ipv6
Closes: #249
Approved by: whitequark
2018-06-24 15:24:37 +08:00
Dan Robertson 0563fdf921 Add MLDv2 packet parsing support to wire
Add the basics for parsing MLDv2 packets with the Icmpv6Packet structure
in the wire module.

Closes: #235
Approved by: whitequark
2018-06-23 10:53:10 +08:00
whitequark 00e9d64911 Travis: add Clippy to allowed failures. 2018-06-23 02:52:26 +00:00
Michal Podhradsky 3e124ef482 Log and print error for all examples 2018-06-22 19:30:03 +00:00
Dan Robertson 276acfb7ef Fix packet buffer enqueue logic error
The size of the contiguous window should be prioritized over the size of
the contiguous window if padding were added.

For example, given the following packet buffer:

  1   2     3
|---|----|------|

If 2 is used and 1 and 3 are empty, enqueing a buffer of size 4 should
be placed in contiguous window 3 and the size of 1 should not cause
any issues in enqueue.

Closes: #247
Approved by: whitequark
2018-06-21 21:04:50 +08:00
jD91mZM2 3d141489a2 Fix impossible lifetime bounds
Using Routes<'static> used to make these functions impossible because it created a reference that needed to be valid for the static lifetime

Closes: #243
Approved by: dlrobertson
2018-06-19 21:14:20 +08:00
Dan Robertson eb078ecf63 Add clippy to CI
Closes: #240
Approved by: dlrobertson
2018-06-19 11:04:39 +08:00
Kai Lüke b23df24a2a Only trigger fast retransmit for data to send
This fixes entering a loop when both endpoints
are stuck in retransmission.

https://github.com/m-labs/smoltcp/issues/224

Closes: #233
Approved by: whitequark
2018-06-18 22:19:42 +08:00
Kai Lüke 272baab3ef Reset retrasmission delay after fast retrasmit
Closes: #233
Approved by: whitequark
2018-06-18 22:19:42 +08:00
Dan Robertson 126f144295 Update docs and fix warnings
Closes: #238
Approved by: dlrobertson
2018-06-18 10:49:16 +08:00
Valentin Lorentz 728ae3fbb5 Add support for arbitrarily many routes instead of only gateways.
Closes: #219
Approved by: whitequark
2018-06-10 05:31:08 +08:00
Ole Martin Ruud 022cad8b11 Fix implementation of fast retransmit (TcpSocket)
Improve detection of duplicate ACKs by checking that the segment does
not contain data.

Move implementation from the 'reject unacceptable acknowledgements'
to later in the process function, because a duplicate ACK is not an
'unacceptable' acknowledgement but rather a condition to update state.

Implement more tests to verify the operation of the fast retransmit
implementation.

Related issue: #224

Closes: #225
Approved by: whitequark
2018-06-10 02:53:35 +08:00
Dan Robertson e88f58739b Improve the Iterator for IPv6 options
- Add a helper function for returning an error in the implementation of
   next
 - Add an assert in Ipv6OptionsIterator::new that ensures that an
   iterator is not created with a length field larger than that of the
   data buffer we're iterating over.

Closes: #230
Approved by: dlrobertson
2018-06-07 05:08:11 +08:00