Skip to content

Commit 9f140b8

Browse files
committed
net: ipv4: fragmentation: Drop the packet if fragmentation fails
If we could not fragment the IPv4 packet, then drop it and do not try to send it. Let the upper layer re-send the packet if needed. It is causing more trouble if we try to send the packet and not honor the MTU setting. Fixes #81021 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent c3466b1 commit 9f140b8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

subsys/net/ip/ipv4_fragment.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,16 +635,15 @@ enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt)
635635
if (ret < 0) {
636636
LOG_DBG("Cannot fragment IPv4 pkt (%d)", ret);
637637

638-
if (ret == -ENOMEM || ret == -ENOBUFS || ret == -EPERM) {
639-
/* Try to send the packet if we could not allocate enough
640-
* network packets or if the don't fragment flag is set
638+
if (ret == -EPERM) {
639+
/* Try to send the packet if the don't fragment flag is set
641640
* and hope the original large packet can be sent OK.
642641
*/
643642
goto ignore_frag_error;
644-
} else {
645-
/* Other error, drop the packet */
646-
return NET_DROP;
647643
}
644+
645+
/* Other error, drop the packet */
646+
return NET_DROP;
648647
}
649648

650649
/* We need to unref here because we simulate the packet being sent. */

0 commit comments

Comments
 (0)