summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/include/nuttx/net/netconfig.h39
-rw-r--r--nuttx/net/arp/Kconfig7
-rw-r--r--nuttx/net/arp/arp_table.c4
-rw-r--r--nuttx/net/devif/devif.h2
-rw-r--r--nuttx/net/devif/devif_initialize.c2
-rw-r--r--nuttx/net/devif/devif_input.c45
-rw-r--r--nuttx/net/devif/devif_poll.c7
-rw-r--r--nuttx/net/ipv6/Kconfig10
-rw-r--r--nuttx/net/ipv6/ipv6.h4
-rw-r--r--nuttx/net/ipv6/net_neighbor.c8
-rw-r--r--nuttx/net/tcp/Kconfig27
11 files changed, 100 insertions, 55 deletions
diff --git a/nuttx/include/nuttx/net/netconfig.h b/nuttx/include/nuttx/net/netconfig.h
index fa5a88a00..ab84ec6b0 100644
--- a/nuttx/include/nuttx/net/netconfig.h
+++ b/nuttx/include/nuttx/net/netconfig.h
@@ -107,25 +107,16 @@
#define UIP_TTL 64
-/* Turn on support for IP packet reassembly.
- *
- * uIP supports reassembly of fragmented IP packets. This features
- * requires an additonal 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.
- */
-
-#define UIP_REASSEMBLY 0
-
-/* 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.
- */
-
-#define UIP_REASS_MAXAGE (20*10) /* 20 seconds */
+#ifdef CONFIG_NET_TCP_REASSEMBLY
+# ifndef CONFIG_NET_TCP_REASS_MAXAGE
+ /* 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.
+ */
+
+# define CONFIG_NET_TCP_REASS_MAXAGE (20*10) /* 20 seconds */
+# endif
+#endif
/* Network drivers often receive packets with garbage at the end
* and are longer than the size of packet in the TCP header. The
@@ -249,23 +240,25 @@
/* ARP configuration options */
+#ifndef CONFIG_NET_ARPTAB_SIZE
/* The size of the ARP table.
*
* This option should be set to a larger value if this uIP node will
* have many connections from the local network.
*/
-#ifndef CONFIG_NET_ARPTAB_SIZE
# define CONFIG_NET_ARPTAB_SIZE 8
#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).
*/
-#define UIP_ARP_MAXAGE 120
+# define CONFIG_NET_ARP_MAXAGE 120
+#endif
/* General configuration options */
diff --git a/nuttx/net/arp/Kconfig b/nuttx/net/arp/Kconfig
index 9e9a5339f..85b2c400e 100644
--- a/nuttx/net/arp/Kconfig
+++ b/nuttx/net/arp/Kconfig
@@ -20,6 +20,13 @@ config NET_ARPTAB_SIZE
---help---
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
bool "ARP address harvesting"
default n
diff --git a/nuttx/net/arp/arp_table.c b/nuttx/net/arp/arp_table.c
index d0439b56b..a0f0e30b0 100644
--- a/nuttx/net/arp/arp_table.c
+++ b/nuttx/net/arp/arp_table.c
@@ -125,7 +125,9 @@ void arp_timer(void)
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++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;
}
diff --git a/nuttx/net/devif/devif.h b/nuttx/net/devif/devif.h
index e2d153cc6..a7ddd18d1 100644
--- a/nuttx/net/devif/devif.h
+++ b/nuttx/net/devif/devif.h
@@ -157,7 +157,7 @@ extern uint16_t g_ipid;
/* 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;
#endif
diff --git a/nuttx/net/devif/devif_initialize.c b/nuttx/net/devif/devif_initialize.c
index f46f78d7c..5da9aa27f 100644
--- a/nuttx/net/devif/devif_initialize.c
+++ b/nuttx/net/devif/devif_initialize.c
@@ -85,7 +85,7 @@ const net_ipaddr_t g_allzeroaddr =
/* 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;
#endif
diff --git a/nuttx/net/devif/devif_input.c b/nuttx/net/devif/devif_input.c
index dad20671b..f97911f74 100644
--- a/nuttx/net/devif/devif_input.c
+++ b/nuttx/net/devif/devif_input.c
@@ -105,16 +105,16 @@
* Pre-processor Definitions
****************************************************************************/
-/* Macros. */
+/* Macros */
-#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 BUF ((FAR struct net_iphdr_s *)&dev->d_buf[NET_LL_HDRLEN])
+#define FBUF ((FAR struct net_iphdr_s *)&g_reassembly_buffer[0])
/* IP fragment re-assembly */
-#define IP_MF 0x20
-#define UIP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN)
-#define UIP_REASS_FLAG_LASTFRAG 0x01
+#define IP_MF 0x20
+#define TCP_REASS_BUFSIZE (CONFIG_NET_BUFSIZE - NET_LL_HDRLEN)
+#define TCP_REASS_LASTFRAG 0x01
/****************************************************************************
* Public Variables
@@ -124,13 +124,18 @@
* Private Variables
****************************************************************************/
-#if UIP_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 const uint8_t g_bitmap_bits[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01};
+#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
+
+static uint8_t g_reassembly_buffer[TCP_REASS_BUFSIZE];
+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 uint8_t g_reassembly_flags;
-#endif /* UIP_REASSEMBLY */
+
+#endif /* CONFIG_NET_TCP_REASSEMBLY */
/****************************************************************************
* 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)
{
FAR struct net_iphdr_s *pbuf = BUF;
@@ -163,7 +168,7 @@ static uint8_t devif_reassembly(void)
if (!g_reassembly_timer)
{
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;
/* Clear the bitmap. */
@@ -187,7 +192,7 @@ static uint8_t devif_reassembly(void)
* 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;
goto nullreturn;
@@ -229,7 +234,7 @@ static uint8_t devif_reassembly(void)
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;
}
@@ -238,7 +243,7 @@ static uint8_t devif_reassembly(void)
* 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
* the bitmap.
@@ -286,7 +291,7 @@ static uint8_t devif_reassembly(void)
nullreturn:
return 0;
}
-#endif /* UIP_REASSEMBLY */
+#endif /* CONFIG_NET_TCP_REASSEMBLY */
/****************************************************************************
* 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 UIP_REASSEMBLY
+#if defined(CONFIG_NET_TCP_REASSEMBLY)
dev->d_len = devif_reassembly();
if (dev->d_len == 0)
{
goto drop;
}
-#else /* UIP_REASSEMBLY */
+#else /* CONFIG_NET_TCP_REASSEMBLY */
#ifdef CONFIG_NET_STATISTICS
g_netstats.ip.drop++;
g_netstats.ip.fragerr++;
#endif
nlldbg("IP fragment dropped\n");
goto drop;
-#endif /* UIP_REASSEMBLY */
+#endif /* CONFIG_NET_TCP_REASSEMBLY */
}
#endif /* CONFIG_NET_IPv6 */
diff --git a/nuttx/net/devif/devif_poll.c b/nuttx/net/devif/devif_poll.c
index 1809fc5fa..1764f0f6a 100644
--- a/nuttx/net/devif/devif_poll.c
+++ b/nuttx/net/devif/devif_poll.c
@@ -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 */
-#if UIP_REASSEMBLY
- if (g_reassembly_timer != 0 && g_reassembly_timer < UIP_REASS_MAXAGE)
+#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
+ if (g_reassembly_timer != 0 &&
+ g_reassembly_timer < CONFIG_NET_TCP_REASS_MAXAGE)
{
g_reassembly_timer += hsec;
}
-#endif /* UIP_REASSEMBLY */
+#endif
/* Traverse all of the active packet connections and perform the poll
* action.
diff --git a/nuttx/net/ipv6/Kconfig b/nuttx/net/ipv6/Kconfig
index 369344afc..075622bb7 100644
--- a/nuttx/net/ipv6/Kconfig
+++ b/nuttx/net/ipv6/Kconfig
@@ -9,3 +9,13 @@ config NET_IPv6
depends on EXPERIMENTAL
---help---
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
diff --git a/nuttx/net/ipv6/ipv6.h b/nuttx/net/ipv6/ipv6.h
index ab2103c19..2155ed621 100644
--- a/nuttx/net/ipv6/ipv6.h
+++ b/nuttx/net/ipv6/ipv6.h
@@ -57,8 +57,8 @@
struct net_neighbor_addr_s
{
-#if UIP_NEIGHBOR_CONF_ADDRTYPE
- UIP_NEIGHBOR_CONF_ADDRTYPE addr;
+#if CONFIG_NET_IPV6_NEIGHBOR_ADDRTYPE
+ CONFIG_NET_IPV6_NEIGHBOR_ADDRTYPE addr;
#else
struct ether_addr addr;
#endif
diff --git a/nuttx/net/ipv6/net_neighbor.c b/nuttx/net/ipv6/net_neighbor.c
index 7070acc1c..f0d892aab 100644
--- a/nuttx/net/ipv6/net_neighbor.c
+++ b/nuttx/net/ipv6/net_neighbor.c
@@ -53,11 +53,11 @@
#define MAX_TIME 128
-#ifdef UIP_NEIGHBOR_CONF_ENTRIES
-# define ENTRIES UIP_NEIGHBOR_CONF_ENTRIES
-#else /* UIP_NEIGHBOR_CONF_ENTRIES */
+#ifdef CONFIG_NET_IPV6_NCONF_ENTRIES
+# define ENTRIES CONFIG_NET_IPV6_NCONF_ENTRIES
+#else /* CONFIG_NET_IPV6_NCONF_ENTRIES */
# define ENTRIES 8
-#endif /* UIP_NEIGHBOR_CONF_ENTRIES */
+#endif /* CONFIG_NET_IPV6_NCONF_ENTRIES */
/****************************************************************************
* Private Types
diff --git a/nuttx/net/tcp/Kconfig b/nuttx/net/tcp/Kconfig
index da996ce25..c148a44b0 100644
--- a/nuttx/net/tcp/Kconfig
+++ b/nuttx/net/tcp/Kconfig
@@ -21,6 +21,33 @@ config NET_TCPURGDATA
compiled in. Urgent data (out-of-band data) is a rarely used TCP feature
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
int "Number of TCP/IP connections"
default 8