From 20871acb55769a9ceccaeabca3edfefb46216bb0 Mon Sep 17 00:00:00 2001 From: xiehang Date: Fri, 10 Jan 2020 19:19:11 +0800 Subject: [PATCH] lwip: Drop packets larger than MTU --- components/lwip/Kconfig | 2 +- components/lwip/core/ipv4/ip4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 442593bfd7..fb97a7e41b 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -85,7 +85,7 @@ config LWIP_DHCP_MAX_NTP_SERVERS config LWIP_IP_FRAG bool "Enable fragment outgoing IP packets" - default n + default y help Enabling this option allows fragmenting outgoing IP packets if their size exceeds MTU. diff --git a/components/lwip/core/ipv4/ip4.c b/components/lwip/core/ipv4/ip4.c index af8bf55aef..b64498099b 100644 --- a/components/lwip/core/ipv4/ip4.c +++ b/components/lwip/core/ipv4/ip4.c @@ -980,6 +980,8 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d if (netif->mtu && (p->tot_len > netif->mtu)) { return ip4_frag(p, netif, dest); } +#else + LWIP_ERROR("ip4_output_if: Packets larger than MTU, discarded!!!",!(netif->mtu && p->tot_len > netif->mtu),return ERR_IF;); #endif /* IP_FRAG */ LWIP_DEBUGF(IP_DEBUG, ("ip4_output_if: call netif->output()\n"));