443 Commits

Author SHA1 Message Date
Egor Karavaev
752ae033db ICMP sockets don't end ICMP packets processing. 2017-11-13 14:16:03 +00:00
Kai Lüke
86ac32539f Preserve retransmission timer for Dup-ACKs
Duplicate ACKs should not replace the retransmission timer,
but if not in retransmission, still set the keep-alive timer
as normal ACKs do.
2017-11-13 06:26:26 +00:00
whitequark
9b98dfa3d0 Fix ICMP socket documentation. NFC. 2017-11-13 04:54:49 +00:00
whitequark
401d004e28 Update README. 2017-11-10 02:02:17 +00:00
whitequark
ffcd3ab80d Style. NFCI. 2017-11-09 02:07:24 +00:00
whitequark
19790720a3 Remove impl Ord/PartialOrd for Cidr.
It's not obvious that CIDRs are ordered in any particular meaningful
way.
2017-11-09 01:50:34 +00:00
Dan Robertson
ef4af850e0 Add ICMP sockets
- Add support for ICMP sockets
 - Add tests for ICMP sockets
 - Rename proto-<type> features to socket-<type>
 - Update documentation
2017-11-09 00:08:24 +00:00
Philipp Oppermann
4ae84ab36a Store plain DeviceT instead of Managed<_> in EthernetInterface 2017-11-08 09:34:35 +00:00
whitequark
f58cc4bcbb Rename proto-* features back to socket-*.
A proto-* feature does not make sense for ICMP, where the protocol
is always enabled, but sockets, not.
2017-11-06 09:51:03 +00:00
whitequark
f239e36bf3 Reimplement {RawSocket,TapInterface}::receive correctly. 2017-11-06 09:38:44 +00:00
whitequark
fd7109b2e4 Rename a few tests. NFC. 2017-11-04 02:42:51 +00:00
whitequark
32ee91da07 Add CODE_STYLE.md. 2017-11-03 23:34:12 +00:00
Philipp Oppermann
198fe239f1 Redesign the phy::Device trait to avoid Drop impls. 2017-11-03 23:15:07 +00:00
Dan Robertson
d1d80ca121 Do not send ICMPv4 responses to broadcasts
- Do not send ICMPv4 responses for packets with a broadcast destination
   address.
   - Do not send DstUnreachable with ProtoUnreachable on receipt of a
     packet with an unknown protocol with a non-unicast destination
     address.
   - Do not send DstUnreachable with PortUnreachable on receipt of a
     UDP packet when no sockets are listening on the destination port
     and the destination address is a non-unicast address.
 - Send the correct amount of the original datagram when sending Destination
   Unreachable error responses.
   - Do not assume that a ip datagram has a payload when sending a proto
     unreachable ICMPv4 error response.
 - Add tests to iface tests.
   - Ensure ICMP error responses are correctly formed when the
     datagram has no payload.
   - Ensure ICMP error responses are correctly handled for UDP packets
     when no socket is listening on the destination port.
   - Ensure the correct amount of the original payload is returned in
     Destination Unreachable responses.
2017-11-01 06:34:10 +00:00
whitequark
0091191cce Rework TcpSocket::{send,recv} to remove need for precomputing size.
Now, these functions give you the largest contiguous slice they can
grab, and you return however much you took from it.
2017-10-31 19:24:54 +00:00
whitequark
1e18c03d34 Fix Cidr::contains_addr for zero length prefixes. 2017-10-30 08:25:32 +00:00
whitequark
1e105253f9 Do not parse an empty string as an IpAddress.
This is more likely to result in downstream confusion than not.
Let downstream code decide exactly what it wants to do with
an empty string; be conservative here.
2017-10-30 07:20:55 +00:00
Dan Robertson
7a2271dfd6 Tests: Add basic interface tests
- Add tests for the following
   - ICMP error responses are not sent in response to broadcast requests
   - ARP requests are responded to and inserted into the cache
   - ARP requests for someone else are not responded to, but the sender
     is still inserted in the cache
2017-10-28 19:33:01 +00:00
whitequark
f64a99a4e6 Use a much more sensible method naming for SocketRef. 2017-10-25 02:16:23 +00:00
whitequark
42e2c04dee Expose wrapping and unwrapping of SocketRefs. 2017-10-25 01:28:59 +00:00
whitequark
475486cc6f Update README. 2017-10-25 00:30:57 +00:00
whitequark
7e4971df32 Rename Cargo features: socket-* → proto-*. 2017-10-25 00:20:40 +00:00
whitequark
2602a151e4 Fix a naming mishap. NFCI. 2017-10-24 23:55:58 +00:00
whitequark
581e7b3f6f Simplify. NFC. 2017-10-24 23:12:55 +00:00
whitequark
284db0099f Small adjustments to TTL code; style, docs, and tests. NFCI. 2017-10-24 23:12:55 +00:00
Dan Robertson
fea462837d Implement set_ttl for Tcp and Udp sockets
- Add the ttl member to the IpRepr
 - Add the ttl member along with setters and getters to the tcp and udp
   socket types
 - Add unit tests for the new set_ttl parameter
 - Update usage of IpRepr to include the ttl value
2017-10-24 23:02:18 +00:00
whitequark
7c6cd6b9a3 Dump malformed ingress packets at DEBUG log level. 2017-10-24 20:37:52 +00:00
whitequark
8ee2f7bff5 Style fixes. 2017-10-24 18:08:22 +00:00
whitequark
bbb54fe2a2 Fix a (future) syntax error in the net_log macro. 2017-10-15 10:10:08 +00:00
Egor Karavaev
096ce02ac4 Implement a SocketRef smart pointer to detect state changes. 2017-10-05 03:44:20 +00:00
whitequark
100b57aa66 Replace "socket debug identifiers" with just socket handles.
This is basically a rename that now calls an apple an apple,
except user code can no longer change it. It's not obvious if
user code getting the socket handle from the socket is very useful,
but it's not harmful either, so why not.
2017-10-05 03:02:41 +00:00
whitequark
067fb2ddc9 Fix a typo. 2017-10-04 01:54:39 +00:00
whitequark
b0fc1d9542 Explain the return value of poll(). 2017-10-03 20:41:45 +00:00
whitequark
d88ef3c8d3 Drop the pretense that anyone cares about non-IP over Ethernet.
To be precise, I'm talking about IPX, AppleTalk and DECnet here,
not things like PPPoE, ATAoE, FCoE, or PTP, which make sense
to implement on top of EthernetInterface but do not work on
the same level on top of it as IP.
2017-10-03 15:17:29 +00:00
Egor Karavaev
331dc10780 Add support for IPv4 default gateway. 2017-10-03 15:17:29 +00:00
Egor Karavaev
fbfe9859db Implement wire::{IpCidr/Ipv4Cidr}. 2017-10-03 14:27:17 +00:00
whitequark
d16e0bd212 Formatting. NFC. 2017-10-03 14:27:01 +00:00
whitequark
02658d0e2f Make sure IpAddress prohibits exhaustive matches.
I forgot to ensure this.
2017-10-03 13:22:09 +00:00
whitequark
bd52f9b83c 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
c8ae7bdc21 Fix insufficient length validation in IPv4 packets.
Found via cargo-fuzz.
2017-10-02 23:03:41 +00:00
whitequark
58c12b8f51 Reword checksum-related documentations.
cc @steffengy
2017-10-02 21:52:30 +00:00
whitequark
70248c5109 Formatting. NFC. 2017-10-02 21:51:43 +00:00
Steffen Butzer
d5147efb82 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
9b1b0b4bde 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
a7cdcd49f4 Update CI config to not use poorly interacting feature sets. 2017-09-25 00:59:21 +00:00
whitequark
16e6e70d2f Fix many warnings. 2017-09-25 00:55:54 +00:00
whitequark
cedf66a733 Enforce some lints. 2017-09-25 00:46:53 +00:00
whitequark
a983c629b9 Allow disabling any of: raw, TCP or UDP sockets. 2017-09-25 00:20:22 +00:00
whitequark
440b6f5556 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
2d31ef9665 Add some docs. 2017-09-24 23:29:42 +00:00