From 891a14e2624efe0160231a0350be651409b49ae0 Mon Sep 17 00:00:00 2001 From: Lu Qiuwen Date: Tue, 5 Jun 2018 13:05:14 +0800 Subject: [PATCH] tp->advmss must not be zero, otherwise the kernel maybe crash. --- forge_socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/forge_socket.c b/forge_socket.c index 3f44845..581bcd6 100644 --- a/forge_socket.c +++ b/forge_socket.c @@ -233,6 +233,9 @@ int forge_setsockopt(struct sock *sk, int level, int optname, if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < tp->advmss) tp->advmss = tp->rx_opt.user_mss; + if (tp->advmss == 0) + tp->advmss = st.mss_clamp; + /* from inet_csk_forge: */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) inet_sk(sk)->dport = st.dport;