You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+70-1Lines changed: 70 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,8 @@ You probably want to disable default features and configure them one by one:
147
147
smoltcp = { version = "0.8.0", default-features = false, features = ["log"] }
148
148
```
149
149
150
+
## Feature flags
151
+
150
152
### Feature `std`
151
153
152
154
The `std` feature enables use of objects and slices owned by the networking stack through a
@@ -195,7 +197,7 @@ Enable `smoltcp::phy::RawSocket` and `smoltcp::phy::TunTapInterface`, respective
195
197
196
198
These features are enabled by default.
197
199
198
-
### Features `socket-raw`, `socket-udp`, `socket-tcp`, `socket-icmp`, `socket-dhcpv4`
200
+
### Features `socket-raw`, `socket-udp`, `socket-tcp`, `socket-icmp`, `socket-dhcpv4`, `socket-dns`
199
201
200
202
Enable the corresponding socket type.
201
203
@@ -208,6 +210,73 @@ Enable [IPv4] and [IPv6] respectively.
208
210
[IPv4]: https://tools.ietf.org/rfc/rfc791.txt
209
211
[IPv6]: https://tools.ietf.org/rfc/rfc8200.txt
210
212
213
+
## Configuration
214
+
215
+
_smoltcp_ has some configuration settings that are set at compile time, affecting sizes
216
+
and counts of buffers.
217
+
218
+
They can be set in two ways:
219
+
220
+
- Via Cargo features: enable a feature like `<name>-<value>`. `name` must be in lowercase and
221
+
use dashes instead of underscores. For example. `iface-max-addr-count-3`. Only a selection of values
222
+
is available, check `Cargo.toml` for the list.
223
+
- Via environment variables at build time: set the variable named `SMOLTCP_<value>`. For example
224
+
`SMOLTCP_IFACE_MAX_ADDR_COUNT=3 cargo build`. You can also set them in the `[env]` section of `.cargo/config.toml`.
225
+
Any value can be set, unlike with Cargo features.
226
+
227
+
Environment variables take precedence over Cargo features. If two Cargo features are enabled for the same setting
228
+
with different values, compilation fails.
229
+
230
+
### IFACE_MAX_ADDR_COUNT
231
+
232
+
Max amount of IP addresses that can be assigned to one interface (counting both IPv4 and IPv6 addresses). Default: 2.
233
+
234
+
### IFACE_MAX_MULTICAST_GROUP_COUNT
235
+
236
+
Max amount of multicast groups that can be joined by one interface. Default: 4.
237
+
238
+
### IFACE_MAX_SIXLOWPAN_ADDRESS_CONTEXT_COUNT
239
+
240
+
Max amount of 6LoWPAN address contexts that can be assigned to one interface. Default: 4.
241
+
242
+
### IFACE_NEIGHBOR_CACHE_COUNT
243
+
244
+
Amount of "IP address -> hardware address" entries the neighbor cache (also known as the "ARP cache" or the "ARP table") holds. Default: 4.
245
+
246
+
### IFACE_MAX_ROUTE_COUNT
247
+
248
+
Max amount of routes that can be added to one interface. Includes the default route. Includes both IPv4 and IPv6. Default: 2.
249
+
250
+
### FRAGMENTATION_BUFFER_SIZE
251
+
252
+
Size of the buffer used for fragmenting outgoing packets larger than the MTU. Packets larger than this setting will be dropped instead of fragmented. Default: 1500.
253
+
254
+
### ASSEMBLER_MAX_SEGMENT_COUNT
255
+
256
+
Maximum number of non-contiguous segments the assembler can hold. Used for both packet reassembly and TCP stream reassembly. Default: 4.
257
+
258
+
### REASSEMBLY_BUFFER_SIZE
259
+
260
+
Size of the buffer used for reassembling (de-fragmenting) incoming packets. If the reassembled packet is larger than this setting, it will be dropped instead of reassembled. Default: 1500.
261
+
262
+
### REASSEMBLY_BUFFER_COUNT
263
+
264
+
Number of reassembly buffers, i.e how many different incoming packets can be reassembled at the same time. Default: 1.
265
+
266
+
### DNS_MAX_RESULT_COUNT
267
+
268
+
Maximum amount of address results for a given DNS query that will be kept. For example, if this is set to 2 and the queried name has 4 `A` records, only the first 2 will be returned. Default: 1.
269
+
270
+
### DNS_MAX_SERVER_COUNT
271
+
272
+
Maximum amount of DNS servers that can be configured in one DNS socket. Default: 1.
273
+
274
+
### DNS_MAX_NAME_SIZE
275
+
276
+
Maximum length of DNS names that can be queried. Default: 255.
277
+
278
+
279
+
211
280
## Hosted usage examples
212
281
213
282
_smoltcp_, being a freestanding networking stack, needs to be able to transmit and receive
0 commit comments