Skip to content

Commit 95e85c7

Browse files
authored
Revert "with this small fix, the DNS engine is RFC 5452 compliant because it …" (#1465)
1 parent 6e25b74 commit 95e85c7

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

app/include/lwip/udp.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,6 @@ void udp_input (struct pbuf *p, struct netif *inp)ICACHE_FLASH_
156156

157157
#define udp_init() /* Compatibility define, not init needed. */
158158

159-
#ifndef UDP_LOCAL_PORT_RANGE_START
160-
#define UDP_LOCAL_PORT_RANGE_START 4096
161-
#define UDP_LOCAL_PORT_RANGE_END 0x7fff
162-
#endif
163-
164159
#if UDP_DEBUG
165160
void udp_debug_print(struct udp_hdr *udphdr)ICACHE_FLASH_ATTR;
166161
#else

app/lwip/core/dns.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,8 @@ dns_init()
254254
LWIP_ASSERT("For implicit initialization to work, DNS_STATE_UNUSED needs to be 0",
255255
DNS_STATE_UNUSED == 0);
256256

257-
/* initialize DNS client, try to get RFC 5452 random source port */
258-
u16_t port = UDP_LOCAL_PORT_RANGE_START + (os_random() % (UDP_LOCAL_PORT_RANGE_END - UDP_LOCAL_PORT_RANGE_START));
259-
for(;;) {
260-
if(udp_bind(dns_pcb, IP_ADDR_ANY, port) == ERR_OK)
261-
break;
262-
LWIP_ASSERT("Unable to get a PCB for DNS", port != 0);
263-
port=0; // try again with random source
264-
}
257+
/* initialize DNS client */
258+
udp_bind(dns_pcb, IP_ADDR_ANY, 0);
265259
udp_recv(dns_pcb, dns_recv, NULL);
266260

267261
/* initialize default DNS primary server */

app/lwip/core/udp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,10 @@ udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port)
758758

759759
/* no port specified? */
760760
if (port == 0) {
761+
#ifndef UDP_LOCAL_PORT_RANGE_START
762+
#define UDP_LOCAL_PORT_RANGE_START 4096
763+
#define UDP_LOCAL_PORT_RANGE_END 0x7fff
764+
#endif
761765
port = UDP_LOCAL_PORT_RANGE_START;
762766
ipcb = udp_pcbs;
763767
while ((ipcb != NULL) && (port != UDP_LOCAL_PORT_RANGE_END)) {

0 commit comments

Comments
 (0)