Commit 41431637 authored by Jukka Rissanen's avatar Jukka Rissanen Committed by Mahesh Mahadevan
Browse files

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: default avatarJukka Rissanen <jukka.rissanen@nordicsemi.no>
parent 9561a0ac
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -635,17 +635,16 @@ enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt)
			if (ret < 0) {
				LOG_DBG("Cannot fragment IPv4 pkt (%d)", ret);

				if (ret == -ENOMEM || ret == -ENOBUFS || ret == -EPERM) {
					/* Try to send the packet if we could not allocate enough
					 * network packets or if the don't fragment flag is set
				if (ret == -EPERM) {
					/* Try to send the packet if the don't fragment flag is set
					 * and hope the original large packet can be sent OK.
					 */
					goto ignore_frag_error;
				} else {
				}

				/* Other error, drop the packet */
				return NET_DROP;
			}
			}

			/* We need to unref here because we simulate the packet being sent. */
			net_pkt_unref(pkt);