Skip to content

Commit caf3f26

Browse files
Eric Dumazetdavem330
authored andcommitted
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: ca6fb06 ("tcp: attach SYNACK messages to request sockets instead of listener") Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7656d84 commit caf3f26

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

include/net/ip.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,15 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
323323

324324
static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
325325
{
326-
if (!skb->sk || ip_sk_use_pmtu(skb->sk)) {
326+
struct sock *sk = skb->sk;
327+
328+
if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {
327329
bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
330+
328331
return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
329-
} else {
330-
return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
331332
}
333+
334+
return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
332335
}
333336

334337
u32 ip_idents_reserve(u32 hash, int segs);

0 commit comments

Comments
 (0)