握手3

Posted guoyu1024

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了握手3相关的知识,希望对你有一定的参考价值。

最后看一下这个函数

/* Send a crossed SYN-ACK during socket establishment.
 * WARNING: This routine must only be called when we have already sent
 * a SYN packet that crossed the incoming SYN that caused this routine
 * to get called. If this assumption fails then the initial rcv_wnd
 * and rcv_wscale values will not be correct.
 */
int tcp_send_synack(struct sock *sk)
{
    struct sk_buff *skb;

    skb = tcp_write_queue_head(sk);
    if (skb == NULL || !(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) {
        pr_debug("%s: wrong queue state
", __func__);
        return -EFAULT;
    }
    if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_ACK)) {
        if (skb_cloned(skb)) {
            struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
            if (nskb == NULL)
                return -ENOMEM;
            tcp_unlink_write_queue(skb, sk);
            __skb_header_release(nskb);
            __tcp_add_write_queue_head(sk, nskb);
            sk_wmem_free_skb(sk, skb);
            sk->sk_wmem_queued += nskb->truesize;
            sk_mem_charge(sk, nskb->truesize);
            skb = nskb;
        }

        TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ACK;
        tcp_ecn_send_synack(sk, skb);
    }
    return tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC);
}

将客户端发起连接请求的报文修改一下,发回给客户端。

以上是关于握手3的主要内容,如果未能解决你的问题,请参考以下文章

VSCode自定义代码片段3——url大全

VSCode自定义代码片段3——url大全

WebSocket 握手期间出错:意外的响应代码:500

sublime text 3 添加代码片段

sublime text 3 添加 javascript 代码片段 ( snippet )

sublime 3 使用Snippets创建代码片段