diff options
| author | luwenpeng <[email protected]> | 2021-04-15 10:55:13 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2021-04-15 10:55:37 +0800 |
| commit | b7d40d57af547fada85e5541999cd78fa658a7fc (patch) | |
| tree | a5bb5012eef913e773ce22a300618f40e8bee1be | |
| parent | 21026588dfbb17846f6e6b6abcb14c0a8c2c9bd4 (diff) | |
修正根据CMSG恢复TCP链接时没有正确填写TCP时间戳启用选项的问题。bugfix-timestamp
* 原实现仅从CMSG中读取了TCP时间戳选项,在恢复TCP链接时没有向内核传入,现修正。
| -rw-r--r-- | core.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -270,6 +270,10 @@ static int __tcp_restore_fd_create(struct net *netspace, const struct tcp_restor #define TCPOPT_SACK_PERMITTED 4 #endif +#ifndef TCPOPT_TIMESTAMP +#define TCPOPT_TIMESTAMP 8 +#endif + tcp_repair_opts[nr_tcp_repair_opts].opt_code = TCPOPT_MAXSEG; tcp_repair_opts[nr_tcp_repair_opts].opt_val = min(endpoint->mss, peer->mss); nr_tcp_repair_opts++; @@ -288,6 +292,13 @@ static int __tcp_restore_fd_create(struct net *netspace, const struct tcp_restor nr_tcp_repair_opts++; } + if (endpoint->timestamp_perm && peer->timestamp_perm) + { + tcp_repair_opts[nr_tcp_repair_opts].opt_code = TCPOPT_TIMESTAMP; + tcp_repair_opts[nr_tcp_repair_opts].opt_val = 0; + nr_tcp_repair_opts++; + } + /* Bind address and connect to peer endpoint */ result = kernel_bind(__sock, (struct sockaddr *)&endpoint->addr, sizeof(endpoint->addr)); if (unlikely(result < 0)) |
