Commit Graph

543 Commits

Author SHA1 Message Date
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 20d1dd8a4a Update examples to use time types
Closes: #141
Approved by: whitequark
2018-02-16 10:44:02 +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
Dan Robertson 8b0ab0dc94 time: Improve time types
- Correct from_system_time implementation
 - Add missing functions and implementations to Instant type
 - Add missing frnction to Duration type

Closes: #141
Approved by: whitequark
2018-02-16 10:44:02 +08:00
Andrew Cann cf53106208 Add Clone impl to EthernetFrame
Closes: #163
Approved by: whitequark
2018-02-16 07:47:24 +08:00
Andrew Cann ec4c48af6c Add `PrettyPrinter::print` convenience method
Closes: #165
Approved by: whitequark
2018-02-16 00:09:52 +08:00
Dan Robertson 1097ba3110 Documentation updates
- Update documentation about current support in the wire module
 - Ensure the possible panic is documented for Ipv6Option::data_mut
 - Add a Repr structure for Ethernet II headers
2018-02-14 18:00:19 +00:00
Andrew Cann 6ee9516697 impl `AsRef<[u8]>` for packet types
Closes: #158
Approved by: whitequark
2018-02-08 17:05:46 +08:00
Dan Robertson 9abf54d56e Add tests for ipv6 in wire::ip
- Make a macro to generate the current tests.
 - Generate the tests for all versions that are enabled.

Closes: #155
Approved by: whitequark
2018-02-08 14:45:19 +08:00
Andrew Cann 1b308a439e Relax type constraints on payload_mut methods
Closes: #153
Approved by: whitequark
2018-02-06 16:17:15 +08:00
Dan Robertson e09e20df95 Add basic ICMPv6 reply
Add basic ICMPv6 handling

 - ICMPv6
   - Handle ICMPv6 echo requests
   - Send ICMPv6 error messages
     - When know listening UDP socket is found in process_udp
     - When the next header is not known
   - Update icmpv6 test to be more useful
 - ICMPv4
   - Handle one more case where we are sending too much data
2018-02-05 16:24:25 +00:00
寧靜 49afb3a45a Add from_netmask()/netmask()/broadcast()/network() methods on IPv4Cidr 2018-02-05 15:13:52 +00:00
Dan Robertson c3d5790c8e Improve TimeExceeded and ParamProblem support
- Improve TimeExceeded support
   - Add support for message codes
   - Add the TimeExceeded enum type
 - Improve ParamProblem support
   - Add support for message codes
   - Add the ParamProblem enem type

Closes: #152
Approved by: whitequark
2018-02-05 22:55:04 +08:00
Andrew Cann 01f3b53e70 Add Clone impl to Packet types 2018-02-05 14:34:36 +00:00
Andrew Cann a9fc8c225b Add conversions to/from std wire types 2018-02-05 13:23:25 +00:00
寧靜 96fd18ff8f Add missing #[cfg(feature = "phy-tap_interface")]. 2018-02-04 08:31:03 +00:00
寧靜 57f9bc213d Impl `Hash` trait on EthernetAddress. 2018-02-03 01:17:15 +00:00
whitequark 5fec38bad3 Remove internally inconsistent test that was left in 1d2ec8c. 2018-02-01 01:04:13 +00:00
whitequark 3bf64a32fb Remove length check that is redundant after 181083f1. 2018-02-01 00:27:49 +00:00
Herman J. Radtke III 4e88b1f82f Implement IPv6 Extension Headers Pad1 and PadN. 2018-01-30 19:45:25 +00:00
whitequark 8b6d8d7fce Reject certain malformed IPv4 packets.
Reported independently, but testcase found via cargo-fuzz.
2018-01-30 03:24:50 +00:00
whitequark d4fa764b23 Add the packet2pcap utility. 2018-01-30 03:24:50 +00:00
Philipp Oppermann 6b3f103c05 Return specific sockets from `new` functions instead of `Socket`.
* Add Into<Socket> implementations for sockets
* Make SocketSet::add generic over Into<Socket>
2018-01-28 14:36:23 +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
whitequark a9903aee61 Allow fuzzer failures on Travis.
cargo-fuzz is broken on Travis, but the mode is still useful for
those running ./.test_like_travis.rb.
2018-01-26 20:20:37 +00:00
whitequark 7269ed4981 Fix af26eafd. 2018-01-26 19:56:23 +00:00
whitequark de3b9735f2 Install cargo-fuzz on Travis before fuzzing. 2018-01-26 19:44:02 +00:00
whitequark 235cd2581d Run fuzzing on Travis. 2018-01-26 19:30:47 +00:00
Egor Karavaev 864b4b7996 Treat unspecified IPv4/IPv6 addresses as IpAddress::Unspecified in IpRepr::lower.
Closes #127.
2018-01-26 19:26:01 +00:00
Dan Robertson 7778626788 Fix ICMPv4 check_len to not panic on truncated packets. 2018-01-26 18:59:11 +00:00
whitequark 79e065e052 Add some ICMPv4 and ICMPv6 packets to fuzz corpus. 2018-01-26 18:43:39 +00:00
whitequark a65daade16 Fix some overly long comments. NFC. 2018-01-26 17:48:59 +00:00
Dan Robertson b017a16e98 Increase required size for ICMPv4 packets
- Increase the size required in Icmpv4Packet::check_len to 8 bytes
 - Add a test
2018-01-26 16:59:37 +00:00
luozijun b5646f1e98 Add `Hash` trait on `IpAddress/IpCidr` 2018-01-26 16:35:53 +00:00
whitequark 0ddd4c9001 Route broadcast packets directly.
Closes #120.
2018-01-15 11:56:14 +00:00
Dan Robertson 4a78b02fcf Add process_ipv6 to EthernetInterface
- Add `process_ipv6` to `EthernetInterface`
 - Add basic test for `process_ipv6`
 - Add `deny(unused)` if either proto-ipv4 or proto-ipv6 is enabled
 - Add `cfg`s where needed to avoid compile time errors due to the above
2018-01-15 11:54:26 +00:00
Herman J. Radtke III d612a93163 Fix mistakes in README
- Fix binary path in tcpdump example
- Fix IP address in ping example
2018-01-13 18:42:17 +00:00
Dan Robertson 7edb7ee93d Implement the time module. 2018-01-13 14:51:21 +00:00
Herman J. Radtke III 2419147b45 Handle parsing and display of IPv4 mapped IPv6 addresses.
* The IPv6 address parser now handles IPv4 mapped IPv6 addresses which
  take on the form ::ffff:x.x.x.x.
* Implement Display for IPv4 mapped IPv6 addresses
* Implement From<IPv4Address> for IPv6Address

Fixes #86
2018-01-13 08:49:24 +00:00
Dan Robertson 6fd5ed8aaf Support IPv6 raw sockets
- Add support for IPv6 raw sockets.
 - Update tests.
2018-01-13 03:07:10 +00:00
Alex Crawford 066d42c0e0 Clean up dispatch_socket!() syntax
This modified syntax is meant to more closely resemble standard Rust.
2018-01-08 07:44:15 +00:00
whitequark 3e96551004 Bump `managed` dependency to 0.5. 2018-01-05 22:44:25 +00:00
whitequark f494200c8c Disregard TCP FIN flag if it arrives in a segment not at window start.
Fixes #111.
2018-01-05 21:06:20 +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
Dan Robertson 22b048c225 Ensure ICMPv4 error replies comply with size requirements
- Add MIN_MTU constants to the IP version modules.
 - Ensure that ICMPv4 error replies comply with the size requirements
   specified in RFC 1812 § 4.3.2.3.
2018-01-05 19:21:45 +00:00
寧靜 98679f9a1b Update examples/tcpdump.rs. 2017-12-28 04:48:23 +00:00
whitequark 7c0bae7d36 Simplify. NFC. 2017-12-27 00:09:50 +00:00
Dan Robertson 0d7a6255f6 Add bench tests
- Add basic infrastructure for bench tests
 - Add bench tests for
   - TcpRepr::emit
   - UdpRepr::emit
   - Ipv4Repr::emit
   - Ipv6Repr::emit
2017-12-24 22:40:00 +00:00
Dan Robertson 439e0a2cc1 Add the proto-ipv4 feature. 2017-12-24 13:28:59 +00:00