TSG-13175 Decrypted Traffic Steering构造的SYN/SYN ACK支持MSS选项

This commit is contained in:
luwenpeng
2022-12-27 14:12:42 +08:00
parent fdf203b25e
commit ee9f66a196

View File

@@ -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|
* +---------+---------+---------+