@@ -11,8 +11,8 @@ real-time systems. Its design goals are simplicity and robustness. Its design an
11
11
include complicated compile-time computations, such as macro or type tricks, even
12
12
at cost of performance degradation.
13
13
14
- _ smoltcp_ does not need heap allocation * at all * , is [ extensively documented] [ docs ] ,
15
- and compiles on stable Rust 1.77 and later.
14
+ _ smoltcp_ does not need heap allocation _ at all _ , is [ extensively documented] [ docs ] ,
15
+ and compiles on stable Rust 1.80 and later.
16
16
17
17
_ smoltcp_ achieves [ ~ Gbps of throughput] ( #examplesbenchmarkrs ) when tested against
18
18
the Linux TCP stack in loopback mode.
@@ -28,115 +28,115 @@ To set expectations right, both implemented and omitted features are listed.
28
28
29
29
There are 3 supported mediums.
30
30
31
- * Ethernet
32
- * Regular Ethernet II frames are supported.
33
- * Unicast, broadcast and multicast packets are supported.
34
- * ARP packets (including gratuitous requests and replies) are supported.
35
- * ARP requests are sent at a rate not exceeding one per second.
36
- * Cached ARP entries expire after one minute.
37
- * 802.3 frames and 802.1Q are ** not** supported.
38
- * Jumbo frames are ** not** supported.
39
- * IP
40
- * Unicast, broadcast and multicast packets are supported.
41
- * IEEE 802.15.4
42
- * Only support for data frames.
31
+ - Ethernet
32
+ - Regular Ethernet II frames are supported.
33
+ - Unicast, broadcast and multicast packets are supported.
34
+ - ARP packets (including gratuitous requests and replies) are supported.
35
+ - ARP requests are sent at a rate not exceeding one per second.
36
+ - Cached ARP entries expire after one minute.
37
+ - 802.3 frames and 802.1Q are ** not** supported.
38
+ - Jumbo frames are ** not** supported.
39
+ - IP
40
+ - Unicast, broadcast and multicast packets are supported.
41
+ - IEEE 802.15.4
42
+ - Only support for data frames.
43
43
44
44
### IP layer
45
45
46
46
#### IPv4
47
47
48
- * IPv4 header checksum is generated and validated.
49
- * IPv4 time-to-live value is configurable per socket, set to 64 by default.
50
- * IPv4 default gateway is supported.
51
- * Routing outgoing IPv4 packets is supported, through a default gateway or a CIDR route table.
52
- * IPv4 fragmentation and reassembly is supported.
53
- * IPv4 options are ** not** supported and are silently ignored.
48
+ - IPv4 header checksum is generated and validated.
49
+ - IPv4 time-to-live value is configurable per socket, set to 64 by default.
50
+ - IPv4 default gateway is supported.
51
+ - Routing outgoing IPv4 packets is supported, through a default gateway or a CIDR route table.
52
+ - IPv4 fragmentation and reassembly is supported.
53
+ - IPv4 options are ** not** supported and are silently ignored.
54
54
55
55
#### IPv6
56
56
57
- * IPv6 hop-limit value is configurable per socket, set to 64 by default.
58
- * Routing outgoing IPv6 packets is supported, through a default gateway or a CIDR route table.
59
- * IPv6 hop-by-hop header is supported.
60
- * ICMPv6 parameter problem message is generated in response to an unrecognized IPv6 next header.
61
- * ICMPv6 parameter problem message is ** not** generated in response to an unknown IPv6
62
- hop-by-hop option.
57
+ - IPv6 hop-limit value is configurable per socket, set to 64 by default.
58
+ - Routing outgoing IPv6 packets is supported, through a default gateway or a CIDR route table.
59
+ - IPv6 hop-by-hop header is supported.
60
+ - ICMPv6 parameter problem message is generated in response to an unrecognized IPv6 next header.
61
+ - ICMPv6 parameter problem message is ** not** generated in response to an unknown IPv6
62
+ hop-by-hop option.
63
63
64
64
#### 6LoWPAN
65
65
66
- * Implementation of [ RFC6282] ( https://tools.ietf.org/rfc/rfc6282.txt ) .
67
- * Fragmentation is supported, as defined in [ RFC4944] ( https://tools.ietf.org/rfc/rfc4944.txt ) .
68
- * UDP header compression/decompression is supported.
69
- * Extension header compression/decompression is supported.
70
- * Uncompressed IPv6 Extension Headers are ** not** supported.
66
+ - Implementation of [ RFC6282] ( https://tools.ietf.org/rfc/rfc6282.txt ) .
67
+ - Fragmentation is supported, as defined in [ RFC4944] ( https://tools.ietf.org/rfc/rfc4944.txt ) .
68
+ - UDP header compression/decompression is supported.
69
+ - Extension header compression/decompression is supported.
70
+ - Uncompressed IPv6 Extension Headers are ** not** supported.
71
71
72
72
### IP multicast
73
73
74
74
#### IGMP
75
75
76
76
The IGMPv1 and IGMPv2 protocols are supported, and IPv4 multicast is available.
77
77
78
- * Membership reports are sent in response to membership queries at
79
- equal intervals equal to the maximum response time divided by the
80
- number of groups to be reported.
78
+ - Membership reports are sent in response to membership queries at
79
+ equal intervals equal to the maximum response time divided by the
80
+ number of groups to be reported.
81
81
82
82
### ICMP layer
83
83
84
84
#### ICMPv4
85
85
86
86
The ICMPv4 protocol is supported, and ICMP sockets are available.
87
87
88
- * ICMPv4 header checksum is supported.
89
- * ICMPv4 echo replies are generated in response to echo requests.
90
- * ICMP sockets can listen to ICMPv4 Port Unreachable messages, or any ICMPv4 messages with
91
- a given IPv4 identifier field.
92
- * ICMPv4 protocol unreachable messages are ** not** passed to higher layers when received.
93
- * ICMPv4 parameter problem messages are ** not** generated.
88
+ - ICMPv4 header checksum is supported.
89
+ - ICMPv4 echo replies are generated in response to echo requests.
90
+ - ICMP sockets can listen to ICMPv4 Port Unreachable messages, or any ICMPv4 messages with
91
+ a given IPv4 identifier field.
92
+ - ICMPv4 protocol unreachable messages are ** not** passed to higher layers when received.
93
+ - ICMPv4 parameter problem messages are ** not** generated.
94
94
95
95
#### ICMPv6
96
96
97
97
The ICMPv6 protocol is supported, and ICMP sockets are available.
98
98
99
- * ICMPv6 header checksum is supported.
100
- * ICMPv6 echo replies are generated in response to echo requests.
101
- * ICMPv6 protocol unreachable messages are ** not** passed to higher layers when received.
99
+ - ICMPv6 header checksum is supported.
100
+ - ICMPv6 echo replies are generated in response to echo requests.
101
+ - ICMPv6 protocol unreachable messages are ** not** passed to higher layers when received.
102
102
103
103
#### NDISC
104
104
105
- * Neighbor Advertisement messages are generated in response to Neighbor Solicitations.
106
- * Router Advertisement messages are ** not** generated or read.
107
- * Router Solicitation messages are ** not** generated or read.
108
- * Redirected Header messages are ** not** generated or read.
105
+ - Neighbor Advertisement messages are generated in response to Neighbor Solicitations.
106
+ - Router Advertisement messages are ** not** generated or read.
107
+ - Router Solicitation messages are ** not** generated or read.
108
+ - Redirected Header messages are ** not** generated or read.
109
109
110
110
### UDP layer
111
111
112
112
The UDP protocol is supported over IPv4 and IPv6, and UDP sockets are available.
113
113
114
- * Header checksum is always generated and validated.
115
- * In response to a packet arriving at a port without a listening socket,
116
- an ICMP destination unreachable message is generated.
114
+ - Header checksum is always generated and validated.
115
+ - In response to a packet arriving at a port without a listening socket,
116
+ an ICMP destination unreachable message is generated.
117
117
118
118
### TCP layer
119
119
120
120
The TCP protocol is supported over IPv4 and IPv6, and server and client TCP sockets are available.
121
121
122
- * Header checksum is generated and validated.
123
- * Maximum segment size is negotiated.
124
- * Window scaling is negotiated.
125
- * Multiple packets are transmitted without waiting for an acknowledgement.
126
- * Reassembly of out-of-order segments is supported, with no more than 4 or 32 gaps in sequence space.
127
- * Keep-alive packets may be sent at a configurable interval.
128
- * Retransmission timeout starts at at an estimate of RTT, and doubles every time.
129
- * Time-wait timeout has a fixed interval of 10 s.
130
- * User timeout has a configurable interval.
131
- * Delayed acknowledgements are supported, with configurable delay.
132
- * Nagle's algorithm is implemented.
133
- * Selective acknowledgements are ** not** implemented.
134
- * Silly window syndrome avoidance is ** not** implemented.
135
- * Congestion control is ** not** implemented.
136
- * Timestamping is ** not** supported.
137
- * Urgent pointer is ** ignored** .
138
- * Probing Zero Windows is ** not** implemented.
139
- * Packetization Layer Path MTU Discovery [ PLPMTU] ( https://tools.ietf.org/rfc/rfc4821.txt ) is ** not** implemented.
122
+ - Header checksum is generated and validated.
123
+ - Maximum segment size is negotiated.
124
+ - Window scaling is negotiated.
125
+ - Multiple packets are transmitted without waiting for an acknowledgement.
126
+ - Reassembly of out-of-order segments is supported, with no more than 4 or 32 gaps in sequence space.
127
+ - Keep-alive packets may be sent at a configurable interval.
128
+ - Retransmission timeout starts at at an estimate of RTT, and doubles every time.
129
+ - Time-wait timeout has a fixed interval of 10 s.
130
+ - User timeout has a configurable interval.
131
+ - Delayed acknowledgements are supported, with configurable delay.
132
+ - Nagle's algorithm is implemented.
133
+ - Selective acknowledgements are ** not** implemented.
134
+ - Silly window syndrome avoidance is ** not** implemented.
135
+ - Congestion control is ** not** implemented.
136
+ - Timestamping is ** not** supported.
137
+ - Urgent pointer is ** ignored** .
138
+ - Probing Zero Windows is ** not** implemented.
139
+ - Packetization Layer Path MTU Discovery [ PLPMTU] ( https://tools.ietf.org/rfc/rfc4821.txt ) is ** not** implemented.
140
140
141
141
## Installation
142
142
@@ -227,11 +227,11 @@ and counts of buffers.
227
227
They can be set in two ways:
228
228
229
229
- Via Cargo features: enable a feature like ` <name>-<value> ` . ` name ` must be in lowercase and
230
- use dashes instead of underscores. For example. ` iface-max-addr-count-3 ` . Only a selection of values
231
- is available, check ` Cargo.toml ` for the list.
230
+ use dashes instead of underscores. For example. ` iface-max-addr-count-3 ` . Only a selection of values
231
+ is available, check ` Cargo.toml ` for the list.
232
232
- Via environment variables at build time: set the variable named ` SMOLTCP_<value> ` . For example
233
- ` SMOLTCP_IFACE_MAX_ADDR_COUNT=3 cargo build ` . You can also set them in the ` [env] ` section of ` .cargo/config.toml ` .
234
- Any value can be set, unlike with Cargo features.
233
+ ` SMOLTCP_IFACE_MAX_ADDR_COUNT=3 cargo build ` . You can also set them in the ` [env] ` section of ` .cargo/config.toml ` .
234
+ Any value can be set, unlike with Cargo features.
235
235
236
236
Environment variables take precedence over Cargo features. If two Cargo features are enabled for the same setting
237
237
with different values, compilation fails.
@@ -369,21 +369,21 @@ sudo brctl delbr br0
369
369
In order to demonstrate the response of _ smoltcp_ to adverse network conditions, all examples
370
370
implement fault injection, available through command-line options:
371
371
372
- * The ` --drop-chance ` option randomly drops packets, with given probability in percents.
373
- * The ` --corrupt-chance ` option randomly mutates one octet in a packet, with given
374
- probability in percents.
375
- * The ` --size-limit ` option drops packets larger than specified size.
376
- * The ` --tx-rate-limit ` and ` --rx-rate-limit ` options set the amount of tokens for
377
- a token bucket rate limiter, in packets per bucket.
378
- * The ` --shaping-interval ` option sets the refill interval of a token bucket rate limiter,
379
- in milliseconds.
372
+ - The ` --drop-chance ` option randomly drops packets, with given probability in percents.
373
+ - The ` --corrupt-chance ` option randomly mutates one octet in a packet, with given
374
+ probability in percents.
375
+ - The ` --size-limit ` option drops packets larger than specified size.
376
+ - The ` --tx-rate-limit ` and ` --rx-rate-limit ` options set the amount of tokens for
377
+ a token bucket rate limiter, in packets per bucket.
378
+ - The ` --shaping-interval ` option sets the refill interval of a token bucket rate limiter,
379
+ in milliseconds.
380
380
381
381
A good starting value for ` --drop-chance ` and ` --corrupt-chance ` is 15%. A good starting
382
382
value for ` --?x-rate-limit ` is 4 and ` --shaping-interval ` is 50 ms.
383
383
384
384
Note that packets dropped by the fault injector still get traced;
385
- the ` rx: randomly dropping a packet ` message indicates that the packet * above * it got dropped,
386
- and the ` tx: randomly dropping a packet ` message indicates that the packet * below * it was.
385
+ the ` rx: randomly dropping a packet ` message indicates that the packet _ above _ it got dropped,
386
+ and the ` tx: randomly dropping a packet ` message indicates that the packet _ below _ it was.
387
387
388
388
### Packet dumps
389
389
@@ -445,11 +445,11 @@ Read its [source code](/examples/ping.rs), then run it as:
445
445
cargo run --example ping -- --tap tap0 ADDRESS
446
446
```
447
447
448
- It sends a series of 4 ICMP ECHO \_ REQUEST packets to the given address at one second intervals and
449
- prints out a status line on each valid ECHO \_ RESPONSE received.
448
+ It sends a series of 4 ICMP ECHO_REQUEST packets to the given address at one second intervals and
449
+ prints out a status line on each valid ECHO_RESPONSE received.
450
450
451
- The first ECHO \_ REQUEST packet is expected to be lost since arp \_ cache is empty after startup;
452
- the ECHO \_ REQUEST packet is dropped and an ARP request is sent instead.
451
+ The first ECHO_REQUEST packet is expected to be lost since arp_cache is empty after startup;
452
+ the ECHO_REQUEST packet is dropped and an ARP request is sent instead.
453
453
454
454
Currently, netmasks are not implemented, and so the only address this example can reach
455
455
is the other endpoint of the tap interface, ` 192.168.69.100 ` . It cannot reach itself because
@@ -469,18 +469,18 @@ cargo run --example server -- --tap tap0
469
469
470
470
It responds to:
471
471
472
- * pings (` ping 192.168.69.1 ` );
473
- * UDP packets on port 6969 (` socat stdio udp4-connect:192.168.69.1:6969 <<<"abcdefg" ` ),
474
- where it will respond with reversed chunks of the input indefinitely;
475
- * TCP connections on port 6969 (` socat stdio tcp4-connect:192.168.69.1:6969 ` ),
476
- where it will respond "hello" to any incoming connection and immediately close it;
477
- * TCP connections on port 6970 (` socat stdio tcp4-connect:192.168.69.1:6970 <<<"abcdefg" ` ),
478
- where it will respond with reversed chunks of the input indefinitely.
479
- * TCP connections on port 6971 (` socat stdio tcp4-connect:192.168.69.1:6971 </dev/urandom ` ),
480
- which will sink data. Also, keep-alive packets (every 1 s) and a user timeout (at 2 s)
481
- are enabled on this port; try to trigger them using fault injection.
482
- * TCP connections on port 6972 (` socat stdio tcp4-connect:192.168.69.1:6972 >/dev/null ` ),
483
- which will source data.
472
+ - pings (` ping 192.168.69.1 ` );
473
+ - UDP packets on port 6969 (` socat stdio udp4-connect:192.168.69.1:6969 <<<"abcdefg" ` ),
474
+ where it will respond with reversed chunks of the input indefinitely;
475
+ - TCP connections on port 6969 (` socat stdio tcp4-connect:192.168.69.1:6969 ` ),
476
+ where it will respond "hello" to any incoming connection and immediately close it;
477
+ - TCP connections on port 6970 (` socat stdio tcp4-connect:192.168.69.1:6970 <<<"abcdefg" ` ),
478
+ where it will respond with reversed chunks of the input indefinitely.
479
+ - TCP connections on port 6971 (` socat stdio tcp4-connect:192.168.69.1:6971 </dev/urandom ` ),
480
+ which will sink data. Also, keep-alive packets (every 1 s) and a user timeout (at 2 s)
481
+ are enabled on this port; try to trigger them using fault injection.
482
+ - TCP connections on port 6972 (` socat stdio tcp4-connect:192.168.69.1:6972 >/dev/null ` ),
483
+ which will source data.
484
484
485
485
Except for the socket on port 6971. the buffers are only 64 bytes long, for convenience
486
486
of testing resource exhaustion conditions.
@@ -553,7 +553,7 @@ is possible; otherwise, nothing at all will be displayed and no options are acce
553
553
554
554
[ wireshark ] : https://wireshark.org
555
555
556
- ### examples/loopback \_ benchmark .rs
556
+ ### examples/loopback_benchmark .rs
557
557
558
558
_ examples/loopback_benchmark.rs_ is another simple throughput benchmark.
559
559
0 commit comments