Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit caf3f267 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

inet: ip_skb_dst_mtu() should use sk_fullsock()



SYN_RECV & TIMEWAIT sockets are not full blown,
do not even try to call ip_sk_use_pmtu() on them.

Fixes: ca6fb065 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7656d842
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -323,12 +323,15 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,

static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
{
	if (!skb->sk || ip_sk_use_pmtu(skb->sk)) {
	struct sock *sk = skb->sk;

	if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {
		bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;

		return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
	} else {
		return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
	}

	return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
}

u32 ip_idents_reserve(u32 hash, int segs);