diff --git a/platform/src/acceptor_kni_v3.cpp b/platform/src/acceptor_kni_v3.cpp index 05628d9..03f19ad 100644 --- a/platform/src/acceptor_kni_v3.cpp +++ b/platform/src/acceptor_kni_v3.cpp @@ -278,13 +278,19 @@ static void tcp_restore_info_parse_from_pkt(struct pkt_info *pktinfo, struct tcp } } -struct tcp_option_window_scale{ +struct tcp_option_mss { + uint8_t kind; + uint8_t length; + uint16_t mss_value; +}; + +struct tcp_option_window_scale { uint8_t kind; uint8_t length; uint8_t shift_count; }; -struct tcp_option_sack{ +struct tcp_option_sack { uint8_t kind; uint8_t length; }; @@ -316,7 +322,29 @@ static int fake_tcp_handshake(struct tfe_proxy *proxy, struct tcp_restore_info * uint32_t s_seq = server->seq - 1; /* - * Window Scale option (WSopt): Kind: 3, Length: 3 + * Maximum segment size: Kind: 2, Length: 4 + * +---------+---------+---------+ + * | Kind=2 |Length=4 |mss.value| + * +---------+---------+---------+ + * 1 1 2 + */ + if (client->mss && server->mss) + { + struct tcp_option_mss *option_c = (struct tcp_option_mss *)(tcp_option_buffer_c + tcp_option_length_c); + option_c->kind = 2; + option_c->length = 4; + option_c->mss_value = htons(client->mss); + tcp_option_length_c += sizeof(struct tcp_option_mss); + + struct tcp_option_mss *option_s = (struct tcp_option_mss *)(tcp_option_buffer_s + tcp_option_length_s); + option_s->kind = 2; + option_s->length = 4; + option_s->mss_value = htons(server->mss); + tcp_option_length_s += sizeof(struct tcp_option_mss); + } + + /* + * Window Scale option: Kind: 3, Length: 3 * +---------+---------+---------+ * | Kind=3 |Length=3 |shift.cnt| * +---------+---------+---------+