Added a config option to randomize initial local TCP/UDP ports (so that different port ranges are used after a reboot; bug #33818; this one added tcp_init/udp_init functions again);

fixed a possible endless loop in tcp_new_port() if the number of active PCBs exceeds the number of available ports;
This commit is contained in:
Simon Goldschmidt
2011-09-11 12:44:01 +02:00
parent 5be300736e
commit 112158b056
6 changed files with 124 additions and 38 deletions

View File

@@ -606,6 +606,15 @@
#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 0
#endif
/**
* LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS==1: randomize the local port for the first
* local TCP/UDP pcb (default==0). This can prevent creating predictable port
* numbers after booting a device.
*/
#ifndef LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 0
#endif
/*
----------------------------------
---------- ICMP options ----------

View File

@@ -52,7 +52,7 @@ extern "C" {
/* Functions for interfacing with TCP: */
/* Lower layer interface to TCP: */
#define tcp_init() /* Compatibility define, no init needed. */
void tcp_init (void); /* Initialize this module. */
void tcp_tmr (void); /* Must be called every
TCP_TMR_INTERVAL
ms. (Typically 250 ms). */

View File

@@ -178,7 +178,7 @@ err_t udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
/* The following functions are the lower layer interface to UDP. */
void udp_input (struct pbuf *p, struct netif *inp);
#define udp_init() /* Compatibility define, not init needed. */
void udp_init (void);
#if LWIP_IPV6
struct udp_pcb * udp_new_ip6(void);