From 33d6dcec5b0513345f3e587691c2d308c368814a Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 13 Apr 2011 17:52:00 +0000 Subject: [PATCH] Fixed bug #33048 (Bad range for IP source port numbers) by using ports in the IANA private/dynamic range (49152 through 65535). --- CHANGELOG | 4 ++++ src/core/tcp.c | 6 ++++-- src/core/udp.c | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a81a7c8c..1ad90506 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -237,6 +237,10 @@ HISTORY ++ Bugfixes: + 2011-04-13: Simon Goldschmidt + * tcp.c, udp.c: Fixed bug #33048 (Bad range for IP source port numbers) by + using ports in the IANA private/dynamic range (49152 through 65535). + 2011-03-29: Simon Goldschmidt, patch by Emil Lhungdahl: * etharp.h/.c: Fixed broken VLAN support. diff --git a/src/core/tcp.c b/src/core/tcp.c index f15a225a..0de2efb2 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -611,8 +611,10 @@ tcp_new_port(void) int i; struct tcp_pcb *pcb; #ifndef TCP_LOCAL_PORT_RANGE_START -#define TCP_LOCAL_PORT_RANGE_START 4096 -#define TCP_LOCAL_PORT_RANGE_END 0x7fff +/* From http://www.iana.org/assignments/port-numbers: + "The Dynamic and/or Private Ports are those from 49152 through 65535" */ +#define TCP_LOCAL_PORT_RANGE_START 0xc000 +#define TCP_LOCAL_PORT_RANGE_END 0xffff #endif static u16_t port = TCP_LOCAL_PORT_RANGE_START; diff --git a/src/core/udp.c b/src/core/udp.c index 528c8653..4596ba2b 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -746,8 +746,10 @@ udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) /* no port specified? */ if (port == 0) { #ifndef UDP_LOCAL_PORT_RANGE_START -#define UDP_LOCAL_PORT_RANGE_START 4096 -#define UDP_LOCAL_PORT_RANGE_END 0x7fff +/* From http://www.iana.org/assignments/port-numbers: + "The Dynamic and/or Private Ports are those from 49152 through 65535" */ +#define UDP_LOCAL_PORT_RANGE_START 0xc000 +#define UDP_LOCAL_PORT_RANGE_END 0xffff #endif port = UDP_LOCAL_PORT_RANGE_START; ipcb = udp_pcbs;