Commit Graph

84 Commits

Author SHA1 Message Date
Dario Nieuwenhuis 88256dbdcf Update to Rust 2018. Fixes #271 2020-12-27 17:54:56 +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
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
whitequark 6a38ace62c Improve docs for `DeviceCapabilities.checksum`. 2020-07-15 05:06:35 +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
ficapy d01e23e396 Support different types of ioctl request argument 2019-12-15 06:25:43 +00:00
Ruben De Smet eebd8e431a Add ethernet feature-gate as default.
Disable ethernet-related features and framing based on a feature gate.

Add a no-ethernet option to Travis.

notes:
- allow(unused) is added when not using ethernet feature
- Don't run pretty-print doctest, ethernet is optional.

Closes: #308
Approved by: whitequark
2019-10-04 22:49:54 +08:00
whitequark b5d5023ac6 Bump Rust version requirement to 1.28.
Actually, this is not a new requirement at all; because we do not
check the minimum version on CI, some dependencies on 1.28 have
already sneaked in. In particular, our required version of the crate
managed only works on 1.28+.

This allows us to use:
(1.28)
  - ops::RangeBounds
  - num::NonZero

Some trait bounds were added to make sure everything builds on 1.28.
2019-06-22 09:04:45 +00:00
whitequark 0134bb7399 Bump Rust version requirement to 1.27.
This allows us to use:
(1.26)
  - impl Trait
  - autoderef in pattern matching
  - fixed slice patterns
  - inclusive ranges
(1.27)
  - dyn Trait
  - #[must_use] on functions

To prepare for edition change, dyn is added where applicable. Other
edition changes would require bumping the requirement even higher,
and so they are not applied for now.
2019-06-22 08:19:39 +00:00
jhwgh1968 1bdf155ead Implement Fuzz Injector
Closes: #284
Approved by: whitequark
2019-05-19 06:41:07 +08:00
jhwgh1968 9f2febcaea Allow mutation of data buffer in RxToken
Closes: #294
Approved by: whitequark
2019-05-05 03:48:25 +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
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 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
whitequark 125a102b71 Update to track changes in liballoc. 2018-07-11 01:57:56 +00: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
Dan Robertson 4d01ee3807 Remove v4 from udp/tcp of ChecksumCapabilities
Closes: #220
Approved by: dlrobertson
2018-05-28 09:41:07 +08:00
Michal Podhradsky 0ce9f56c26 Do not export phy::wait on non-Unix platforms 2018-04-29 01:58:53 +00:00
Dan Robertson e0b48caca3 Update phy mod to use new time types
Update everything but the socket types to use the new time types instead
of a basic u64

Closes: #141
Approved by: whitequark
2018-02-16 10:44:03 +08:00
Dan Robertson 1f9e14de71 Update iface and phy_wait to use new time types
Update the EthernetInterface poll functions to use Instant and Duration
instead of a simple u64 value.

Closes: #141
Approved by: whitequark
2018-02-16 10:44:02 +08:00
whitequark d4fa764b23 Add the packet2pcap utility. 2018-01-30 03:24:50 +00:00
寧靜 1e5acf0799 Gate Linux-specific platform dependencies behind a #[cfg]. 2018-01-27 12:38:47 +00:00
Dan Robertson eb33e7f09f Add ICMPv6
Add support for ICMPv6 message types to the wire module.
2018-01-26 23:10:41 +00:00
Dan Robertson b653a6e421 Fix documentation warnings.
- There are several warnings that are thrown when running `cargo doc`. Fix
  these warnings.
- Convert all module documentation to use /*! for consistency.
2018-01-05 19:38:23 +00:00
whitequark b2c2214725 Convert all assert!s not documented as panics into debug_assert!s.
Document the rest.
2017-12-22 20:38:54 +00:00
whitequark ff530020dd Style. NFC. 2017-11-22 07:44:03 +00:00
whitequark c2994b9757 Reimplement {RawSocket,TapInterface}::receive correctly. 2017-11-06 09:38:44 +00:00
whitequark 9e783cb570 Add CODE_STYLE.md. 2017-11-03 23:34:12 +00:00
Philipp Oppermann 6a8e21cec0 Redesign the phy::Device trait to avoid Drop impls. 2017-11-03 23:15:07 +00:00
whitequark 3fa1d60be0 Only verify checksum in pretty printers, do not bail out if invalid.
This lets us e.g. deal with checksum offload on egress packets.
2017-10-03 07:09:53 +00:00
whitequark f60e689b04 Reword checksum-related documentations.
cc @steffengy
2017-10-02 21:52:30 +00:00
Steffen Butzer 61cb64406d support hardware based checksum settings in during packet send/recv
- makes sure the checksum is zeroed when not emitted by software
  (This is required by some implementations such as STM32 to work properly)
2017-10-02 21:40:08 +00:00
Steffen Butzer f9093d15aa phy: introduce hardware based checksum settings, rename DeviceLimits
this contains a rename of occurrences of
DeviceLimits -> DeviceCapabilities.
2017-10-02 21:40:08 +00:00
whitequark ba93552ccd Fix many warnings. 2017-09-25 00:55:54 +00:00
whitequark dd0f4b706a Enforce some lints. 2017-09-25 00:46:53 +00:00
whitequark 0a8a962e94 Reorganize features using namespaces, to match module hierarchy.
I'm about to add a whole lot more features, and it's going to get
quite confusing otherwise.
2017-09-24 23:51:19 +00:00
whitequark 8e13333988 Remove all remnants of the collections feature. 2017-09-22 20:40:13 +00:00
whitequark f8edf0faea Unbreak traffic shaper in the fault injector. 2017-08-31 21:39:01 +00:00
whitequark 6da3e5f217 Fix an inaccurate comment. 2017-08-31 14:33:10 +00:00
whitequark 47770a5ec2 Fix an unused import warning. 2017-08-31 14:31:32 +00:00
whitequark 996389d653 Compute soft deadline in poll() and use nonblocking sockets.
Before this commit, anything that touched RawSocket or TapInterface
worked partly by accident and partly because of a horrible crutch
that resulted in massive latencies as well as inevitable packet loss
every time an ARP request had to be issued. Also, there was no way
to use poll() other than by continuously calling it in a busy loop.

After this commit, poll() indicates when the earliest timer expires,
and so the caller can sleep until that moment (or until packets
arrive).

Note that there is a subtle problem remaining: every time poll()
is called, every socket with a pending outbound packet whose
IP address doesn't correspond to a MAC address will send a new
ARP request, resulting in potentially a whole lot of such requests.
ARP rate limiting is a separate topic though.
2017-08-29 19:47:11 +00:00
whitequark ae7e956573 Add a missing \0 in a C string. 2017-08-24 12:18:07 +00:00
whitequark 15085bd8ba Fix a file descriptor leak in TapInterfaceDesc::interface_mtu. 2017-08-21 07:28:32 +00:00
David Coffill 55ac6737b2 Fix build on i686 by using libc::suseseconds_t instead of i64 2017-08-02 07:12:36 +00:00
whitequark be0854127a Remove unused imports. 2017-07-30 01:09:14 +00:00
whitequark 8d8a4ea583 Get rid of Result<_, ()>.
The use of this type has several drawbacks:
  * It does not allow distinguishing between different error
    conditions. In fact, we wrongly conflated some of them
    before this commit.
  * It does not allow propagation via ? and requires manual use
    of map_err, which is especially tiresome for downstream code.
  * It prevents us from expanding the set of error conditions
    even if right now we have only one.
  * It prevents us from blanket using Result<T> everywhere
    (a nitpick at most).

Instead, use Result<T, Error> everywhere, and differentiate error
conditions where applicable.
2017-07-27 13:55:47 +00:00
whitequark 7ba49607bf Update fault injector so that rate limiting works without std. 2017-07-23 15:10:57 +00:00
whitequark 250a84e513 Implement a Device that emits a stream in libpcap format. 2017-07-23 14:56:24 +00:00