please show the source code to check duplicate ACK in linux kernel
时间: 2024-01-21 10:19:40 浏览: 35
Here is the code snippet to check for duplicate ACK in the Linux kernel:
```
static inline bool tcp_ack_is_dubious(const struct tcp_sock *tp,
const struct sk_buff *skb,
u32 prior_snd_una)
{
struct tcphdr *th = tcp_hdr(skb);
bool dubious;
if (prior_snd_una == tp->snd_una)
return false;
dubious = tp->sacked_out &&
prior_snd_una < tp->high_seq &&
before(th->ack_seq, tp->high_seq);
if (!dubious)
dubious = before(th->ack_seq, tp->snd_una);
if (!dubious && tp->retrans_out)
dubious = before(th->ack_seq, tp->lost_out);
if (!dubious && tp->frto && tp->is_cwnd_limited &&
tp->high_seq != tp->snd_nxt) {
if (after(th->ack_seq, tp->snd_una) &&
before(th->ack_seq, tp->high_seq))
dubious = true;
}
return dubious;
}
```
This function is defined in `net/ipv4/tcp_input.c` file of the Linux kernel source code. It takes three arguments - a pointer to the `struct tcp_sock` object, a pointer to the received `sk_buff` object, and the prior send una value.
The function checks whether the received ACK is dubious or not by comparing it with the prior send una value. It returns `true` if the ACK is dubious, otherwise `false`.
To use this function, you need to have the relevant headers and data structures included in your code.
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![none](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)