mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
NET: Add a few missing configuration options to the Kconfig files
This commit is contained in:
@@ -107,25 +107,16 @@
|
|||||||
|
|
||||||
#define UIP_TTL 64
|
#define UIP_TTL 64
|
||||||
|
|
||||||
/* Turn on support for IP packet reassembly.
|
#ifdef CONFIG_NET_TCP_REASSEMBLY
|
||||||
*
|
# ifndef CONFIG_NET_TCP_REASS_MAXAGE
|
||||||
* uIP supports reassembly of fragmented IP packets. This features
|
/* The maximum time an IP fragment should wait in the reassembly
|
||||||
* requires an additonal amount of RAM to hold the reassembly buffer
|
* buffer before it is dropped. Units are deci-seconds, the range
|
||||||
* and the reassembly code size is approximately 700 bytes. The
|
* of the timer is 8-bits.
|
||||||
* reassembly buffer is of the same size as the d_buf buffer
|
*/
|
||||||
* (configured by CONFIG_NET_BUFSIZE).
|
|
||||||
*
|
|
||||||
* Note: IP packet reassembly is not heavily tested.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define UIP_REASSEMBLY 0
|
# define CONFIG_NET_TCP_REASS_MAXAGE (20*10) /* 20 seconds */
|
||||||
|
# endif
|
||||||
/* The maximum time an IP fragment should wait in the reassembly
|
#endif
|
||||||
* buffer before it is dropped. Units are deci-seconds, the range
|
|
||||||
* of the timer is 8-bits.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define UIP_REASS_MAXAGE (20*10) /* 20 seconds */
|
|
||||||
|
|
||||||
/* Network drivers often receive packets with garbage at the end
|
/* Network drivers often receive packets with garbage at the end
|
||||||
* and are longer than the size of packet in the TCP header. The
|
* and are longer than the size of packet in the TCP header. The
|
||||||
@@ -249,23 +240,25 @@
|
|||||||
|
|
||||||
/* ARP configuration options */
|
/* ARP configuration options */
|
||||||
|
|
||||||
|
#ifndef CONFIG_NET_ARPTAB_SIZE
|
||||||
/* The size of the ARP table.
|
/* The size of the ARP table.
|
||||||
*
|
*
|
||||||
* This option should be set to a larger value if this uIP node will
|
* This option should be set to a larger value if this uIP node will
|
||||||
* have many connections from the local network.
|
* have many connections from the local network.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIG_NET_ARPTAB_SIZE
|
|
||||||
# define CONFIG_NET_ARPTAB_SIZE 8
|
# define CONFIG_NET_ARPTAB_SIZE 8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The maxium age of ARP table entries measured in 10ths of seconds.
|
#ifndef CONFIG_NET_ARPTAB_SIZE
|
||||||
|
/* The maximum age of ARP table entries measured in 10ths of seconds.
|
||||||
*
|
*
|
||||||
* An UIP_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
|
* An CONFIG_NET_ARP_MAXAGE of 120 corresponds to 20 minutes (BSD
|
||||||
* default).
|
* default).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UIP_ARP_MAXAGE 120
|
# define CONFIG_NET_ARP_MAXAGE 120
|
||||||
|
#endif
|
||||||
|
|
||||||
/* General configuration options */
|
/* General configuration options */
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ config NET_ARPTAB_SIZE
|
|||||||
---help---
|
---help---
|
||||||
The size of the ARP table (in entries).
|
The size of the ARP table (in entries).
|
||||||
|
|
||||||
|
config NET_ARP_MAXAGE
|
||||||
|
int "Max ARP entry age"
|
||||||
|
default 120
|
||||||
|
---help---
|
||||||
|
The maximum age of ARP table entries measured in deciseconds. The
|
||||||
|
default value of 120 corresponds to 20 minutes (BSD default).
|
||||||
|
|
||||||
config NET_ARP_IPIN
|
config NET_ARP_IPIN
|
||||||
bool "ARP address harvesting"
|
bool "ARP address harvesting"
|
||||||
default n
|
default n
|
||||||
|
|||||||
+3
-1
@@ -125,7 +125,9 @@ void arp_timer(void)
|
|||||||
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
||||||
{
|
{
|
||||||
tabptr = &g_arptable[i];
|
tabptr = &g_arptable[i];
|
||||||
if (tabptr->at_ipaddr != 0 && g_arptime - tabptr->at_time >= UIP_ARP_MAXAGE)
|
|
||||||
|
if (tabptr->at_ipaddr != 0 &&
|
||||||
|
g_arptime - tabptr->at_time >= CONFIG_NET_ARP_MAXAGE)
|
||||||
{
|
{
|
||||||
tabptr->at_ipaddr = 0;
|
tabptr->at_ipaddr = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -157,7 +157,7 @@ extern uint16_t g_ipid;
|
|||||||
|
|
||||||
/* Reassembly timer (units: deci-seconds) */
|
/* Reassembly timer (units: deci-seconds) */
|
||||||
|
|
||||||
#if UIP_REASSEMBLY && !defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
|
||||||
extern uint8_t g_reassembly_timer;
|
extern uint8_t g_reassembly_timer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const net_ipaddr_t g_allzeroaddr =
|
|||||||
|
|
||||||
/* Reassembly timer (units: deci-seconds) */
|
/* Reassembly timer (units: deci-seconds) */
|
||||||
|
|
||||||
#if UIP_REASSEMBLY && !defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
|
||||||
uint8_t g_reassembly_timer;
|
uint8_t g_reassembly_timer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+25
-20
@@ -105,16 +105,16 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Macros. */
|
/* Macros */
|
||||||
|
|
||||||
#define BUF ((FAR struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
|
#define BUF ((FAR struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
|
||||||
#define FBUF ((FAR struct net_iphdr_s *)&g_reassembly_buffer[0])
|
#define FBUF ((FAR struct net_iphdr_s *)&g_reassembly_buffer[0])
|
||||||
|
|
||||||
/* IP fragment re-assembly */
|
/* IP fragment re-assembly */
|
||||||
|
|
||||||
#define IP_MF 0x20
|
#define IP_MF 0x20
|
||||||
#define UIP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN)
|
#define TCP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN)
|
||||||
#define UIP_REASS_FLAG_LASTFRAG 0x01
|
#define TCP_REASS_LASTFRAG 0x01
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Variables
|
* Public Variables
|
||||||
@@ -124,13 +124,18 @@
|
|||||||
* Private Variables
|
* Private Variables
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if UIP_REASSEMBLY && !defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
|
||||||
static uint8_t g_reassembly_buffer[UIP_REASS_BUFSIZE];
|
|
||||||
static uint8_t g_reassembly_bitmap[UIP_REASS_BUFSIZE / (8 * 8)];
|
static uint8_t g_reassembly_buffer[TCP_REASS_BUFSIZE];
|
||||||
static const uint8_t g_bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01};
|
static uint8_t g_reassembly_bitmap[TCP_REASS_BUFSIZE / (8 * 8)];
|
||||||
|
|
||||||
|
static const uint8_t g_bitmap_bits[8] =
|
||||||
|
{0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01};
|
||||||
|
|
||||||
static uint16_t g_reassembly_len;
|
static uint16_t g_reassembly_len;
|
||||||
static uint8_t g_reassembly_flags;
|
static uint8_t g_reassembly_flags;
|
||||||
#endif /* UIP_REASSEMBLY */
|
|
||||||
|
#endif /* CONFIG_NET_TCP_REASSEMBLY */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@@ -146,7 +151,7 @@ static uint8_t g_reassembly_flags;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if UIP_REASSEMBLY && !defined(CONFIG_NET_IPv6)
|
#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
|
||||||
static uint8_t devif_reassembly(void)
|
static uint8_t devif_reassembly(void)
|
||||||
{
|
{
|
||||||
FAR struct net_iphdr_s *pbuf = BUF;
|
FAR struct net_iphdr_s *pbuf = BUF;
|
||||||
@@ -163,7 +168,7 @@ static uint8_t devif_reassembly(void)
|
|||||||
if (!g_reassembly_timer)
|
if (!g_reassembly_timer)
|
||||||
{
|
{
|
||||||
memcpy(g_reassembly_buffer, &pbuf->vhl, IP_HDRLEN);
|
memcpy(g_reassembly_buffer, &pbuf->vhl, IP_HDRLEN);
|
||||||
g_reassembly_timer = UIP_REASS_MAXAGE;
|
g_reassembly_timer = CONFIG_NET_TCP_REASS_MAXAGE;
|
||||||
g_reassembly_flags = 0;
|
g_reassembly_flags = 0;
|
||||||
|
|
||||||
/* Clear the bitmap. */
|
/* Clear the bitmap. */
|
||||||
@@ -187,7 +192,7 @@ static uint8_t devif_reassembly(void)
|
|||||||
* reassembly buffer, we discard the entire packet.
|
* reassembly buffer, we discard the entire packet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (offset > UIP_REASS_BUFSIZE || offset + len > UIP_REASS_BUFSIZE)
|
if (offset > TCP_REASS_BUFSIZE || offset + len > TCP_REASS_BUFSIZE)
|
||||||
{
|
{
|
||||||
g_reassembly_timer = 0;
|
g_reassembly_timer = 0;
|
||||||
goto nullreturn;
|
goto nullreturn;
|
||||||
@@ -229,7 +234,7 @@ static uint8_t devif_reassembly(void)
|
|||||||
|
|
||||||
if ((pbuf->ipoffset[0] & IP_MF) == 0)
|
if ((pbuf->ipoffset[0] & IP_MF) == 0)
|
||||||
{
|
{
|
||||||
g_reassembly_flags |= UIP_REASS_FLAG_LASTFRAG;
|
g_reassembly_flags |= TCP_REASS_LASTFRAG;
|
||||||
g_reassembly_len = offset + len;
|
g_reassembly_len = offset + len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +243,7 @@ static uint8_t devif_reassembly(void)
|
|||||||
* are set.
|
* are set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (g_reassembly_flags & UIP_REASS_FLAG_LASTFRAG)
|
if (g_reassembly_flags & TCP_REASS_LASTFRAG)
|
||||||
{
|
{
|
||||||
/* Check all bytes up to and including all but the last byte in
|
/* Check all bytes up to and including all but the last byte in
|
||||||
* the bitmap.
|
* the bitmap.
|
||||||
@@ -286,7 +291,7 @@ static uint8_t devif_reassembly(void)
|
|||||||
nullreturn:
|
nullreturn:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* UIP_REASSEMBLY */
|
#endif /* CONFIG_NET_TCP_REASSEMBLY */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@@ -387,20 +392,20 @@ int devif_input(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
if ((pbuf->ipoffset[0] & 0x3f) != 0 || pbuf->ipoffset[1] != 0)
|
if ((pbuf->ipoffset[0] & 0x3f) != 0 || pbuf->ipoffset[1] != 0)
|
||||||
{
|
{
|
||||||
#if UIP_REASSEMBLY
|
#if defined(CONFIG_NET_TCP_REASSEMBLY)
|
||||||
dev->d_len = devif_reassembly();
|
dev->d_len = devif_reassembly();
|
||||||
if (dev->d_len == 0)
|
if (dev->d_len == 0)
|
||||||
{
|
{
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
#else /* UIP_REASSEMBLY */
|
#else /* CONFIG_NET_TCP_REASSEMBLY */
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
g_netstats.ip.drop++;
|
g_netstats.ip.drop++;
|
||||||
g_netstats.ip.fragerr++;
|
g_netstats.ip.fragerr++;
|
||||||
#endif
|
#endif
|
||||||
nlldbg("IP fragment dropped\n");
|
nlldbg("IP fragment dropped\n");
|
||||||
goto drop;
|
goto drop;
|
||||||
#endif /* UIP_REASSEMBLY */
|
#endif /* CONFIG_NET_TCP_REASSEMBLY */
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NET_IPv6 */
|
#endif /* CONFIG_NET_IPv6 */
|
||||||
|
|
||||||
|
|||||||
@@ -372,12 +372,13 @@ int devif_timer(FAR struct net_driver_s *dev, devif_poll_callback_t callback,
|
|||||||
|
|
||||||
/* Increment the timer used by the IP reassembly logic */
|
/* Increment the timer used by the IP reassembly logic */
|
||||||
|
|
||||||
#if UIP_REASSEMBLY
|
#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
|
||||||
if (g_reassembly_timer != 0 && g_reassembly_timer < UIP_REASS_MAXAGE)
|
if (g_reassembly_timer != 0 &&
|
||||||
|
g_reassembly_timer < CONFIG_NET_TCP_REASS_MAXAGE)
|
||||||
{
|
{
|
||||||
g_reassembly_timer += hsec;
|
g_reassembly_timer += hsec;
|
||||||
}
|
}
|
||||||
#endif /* UIP_REASSEMBLY */
|
#endif
|
||||||
|
|
||||||
/* Traverse all of the active packet connections and perform the poll
|
/* Traverse all of the active packet connections and perform the poll
|
||||||
* action.
|
* action.
|
||||||
|
|||||||
@@ -9,3 +9,13 @@ config NET_IPv6
|
|||||||
depends on EXPERIMENTAL
|
depends on EXPERIMENTAL
|
||||||
---help---
|
---help---
|
||||||
Build in support for IPv6. Not fully implemented.
|
Build in support for IPv6. Not fully implemented.
|
||||||
|
|
||||||
|
if NET_IPv6
|
||||||
|
|
||||||
|
config NET_IPV6_NCONF_ENTRIES
|
||||||
|
int "Number of neighbors"
|
||||||
|
default 8
|
||||||
|
|
||||||
|
#config NET_IPV6_NEIGHBOR_ADDRTYPE
|
||||||
|
|
||||||
|
endif # NET_IPv6
|
||||||
|
|||||||
+2
-2
@@ -57,8 +57,8 @@
|
|||||||
|
|
||||||
struct net_neighbor_addr_s
|
struct net_neighbor_addr_s
|
||||||
{
|
{
|
||||||
#if UIP_NEIGHBOR_CONF_ADDRTYPE
|
#if CONFIG_NET_IPV6_NEIGHBOR_ADDRTYPE
|
||||||
UIP_NEIGHBOR_CONF_ADDRTYPE addr;
|
CONFIG_NET_IPV6_NEIGHBOR_ADDRTYPE addr;
|
||||||
#else
|
#else
|
||||||
struct ether_addr addr;
|
struct ether_addr addr;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -53,11 +53,11 @@
|
|||||||
|
|
||||||
#define MAX_TIME 128
|
#define MAX_TIME 128
|
||||||
|
|
||||||
#ifdef UIP_NEIGHBOR_CONF_ENTRIES
|
#ifdef CONFIG_NET_IPV6_NCONF_ENTRIES
|
||||||
# define ENTRIES UIP_NEIGHBOR_CONF_ENTRIES
|
# define ENTRIES CONFIG_NET_IPV6_NCONF_ENTRIES
|
||||||
#else /* UIP_NEIGHBOR_CONF_ENTRIES */
|
#else /* CONFIG_NET_IPV6_NCONF_ENTRIES */
|
||||||
# define ENTRIES 8
|
# define ENTRIES 8
|
||||||
#endif /* UIP_NEIGHBOR_CONF_ENTRIES */
|
#endif /* CONFIG_NET_IPV6_NCONF_ENTRIES */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
|
|||||||
@@ -21,6 +21,33 @@ config NET_TCPURGDATA
|
|||||||
compiled in. Urgent data (out-of-band data) is a rarely used TCP feature
|
compiled in. Urgent data (out-of-band data) is a rarely used TCP feature
|
||||||
that is very seldom would be required.
|
that is very seldom would be required.
|
||||||
|
|
||||||
|
config NET_TCP_REASSEMBLY
|
||||||
|
bool "TCP reassembly"
|
||||||
|
default n
|
||||||
|
depends on EXPERIMENTAL
|
||||||
|
---help---
|
||||||
|
Enable support for IP packet reassembly of fragmented IP packets.
|
||||||
|
|
||||||
|
This features requires an additional amount of RAM to hold the
|
||||||
|
reassembly buffer and the reassembly code size is approximately 700
|
||||||
|
bytes. The reassembly buffer is of the same size as the d_buf buffer
|
||||||
|
(configured by CONFIG_NET_BUFSIZE).
|
||||||
|
|
||||||
|
Note: IP packet reassembly is not heavily tested (and, hence,
|
||||||
|
EXPERIMENTAL).
|
||||||
|
|
||||||
|
if NET_TCP_REASSEMBLY
|
||||||
|
|
||||||
|
config NET_TCP_REASS_MAXAGE
|
||||||
|
int "IP fragment timeout"
|
||||||
|
default 200
|
||||||
|
---help---
|
||||||
|
The maximum time an IP fragment should wait in the reassembly buffer
|
||||||
|
before it is dropped. Units are deci-seconds, the range of the timer
|
||||||
|
is 8-bits. Default: 20 seconds.
|
||||||
|
|
||||||
|
endif # NET_TCP_REASSEMBLY
|
||||||
|
|
||||||
config NET_TCP_CONNS
|
config NET_TCP_CONNS
|
||||||
int "Number of TCP/IP connections"
|
int "Number of TCP/IP connections"
|
||||||
default 8
|
default 8
|
||||||
|
|||||||
Reference in New Issue
Block a user