Skip to content

Commit f982096

Browse files
committed
Merge branch 'bugfix/fix_udp_send_more_than_1472' into 'master'
Fix UDP send more than 1472 bytes See merge request sdk/ESP8266_RTOS_SDK!446
2 parents 051ff4b + 4b531a6 commit f982096

File tree

1 file changed

+13
-0
lines changed
  • components/lwip/lwip/src/core

1 file changed

+13
-0
lines changed

components/lwip/lwip/src/core/udp.c

+13
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,19 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
516516
struct netif *netif;
517517
const ip_addr_t *dst_ip_route = dst_ip;
518518

519+
/**
520+
* UDP max payload = MTU(1500 now) - IP head(20) - UDP head(8) = 1472
521+
*
522+
* We test that LWIP send 1473 bytes data, linux can cacth these but windows can't.
523+
*
524+
* If enable IP_FRAG option, these data should be fragmented at IP layer..
525+
*/
526+
#if ESP_LWIP && !IP_FRAG
527+
if (p && p->tot_len > 1472) {
528+
return ERR_VAL;
529+
}
530+
#endif
531+
519532
if ((pcb == NULL) || (dst_ip == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)) {
520533
return ERR_VAL;
521534
}

0 commit comments

Comments
 (0)