mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
drivers/net/tun.c: Packet buffer size should include the configured GUARD_SIZE. And, given how the buffers are allocated, the allocation size must be an even number of 16-bit values to preserve alignment.
This commit is contained in:
+8
-2
@@ -102,6 +102,12 @@
|
|||||||
# define CONFIG_TUN_NINTERFACES 1
|
# define CONFIG_TUN_NINTERFACES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Make sure that packet buffers include in configured guard size and are an
|
||||||
|
* even multiple of 16-bits in length.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NET_TUN_PKTSIZE ((CONFIG_NET_TUN_PKTSIZE + CONFIG_NET_GUARDSIZE + 1) & ~1)
|
||||||
|
|
||||||
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per
|
/* TX poll delay = 1 seconds. CLK_TCK is the number of clock ticks per
|
||||||
* second
|
* second
|
||||||
*/
|
*/
|
||||||
@@ -149,8 +155,8 @@ struct tun_device_s
|
|||||||
* is assured only by the preceding wide data types.
|
* is assured only by the preceding wide data types.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint8_t read_buf[CONFIG_NET_TUN_PKTSIZE];
|
uint8_t read_buf[NET_TUN_PKTSIZE];
|
||||||
uint8_t write_buf[CONFIG_NET_TUN_PKTSIZE];
|
uint8_t write_buf[NET_TUN_PKTSIZE];
|
||||||
|
|
||||||
/* This holds the information visible to the NuttX network */
|
/* This holds the information visible to the NuttX network */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user