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
This commit is contained in:
Dong Heng
2018-09-06 10:45:35 +08:00

View File

@ -516,6 +516,19 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
struct netif *netif;
const ip_addr_t *dst_ip_route = dst_ip;
/**
* UDP max payload = MTU(1500 now) - IP head(20) - UDP head(8) = 1472
*
* We test that LWIP send 1473 bytes data, linux can cacth these but windows can't.
*
* If enable IP_FRAG option, these data should be fragmented at IP layer..
*/
#if ESP_LWIP && !IP_FRAG
if (p && p->tot_len > 1472) {
return ERR_VAL;
}
#endif
if ((pcb == NULL) || (dst_ip == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)) {
return ERR_VAL;
}