随笔分类 -  linux tcp/ip

1 2 3 4 5 ··· 10 下一页
摘要:tcp_fast_path_on(tp); if (sk->sk_shutdown & SEND_SHUTDOWN) tcp_shutdown(sk, SEND_SHUTDOWN); if (sk->sk_socket)<-- 删除这部分代码 goto consume; <-- 删除这部分代码 br 阅读全文
posted @ 2025-12-15 21:45 codestacklinuxer 阅读(0) 评论(0) 推荐(0)
摘要:判断tcp seq 是否在正常范围内的时候; 只要报文在 [RCV.WUP, RCV.NXT + RCV.WND] 这个区间内,就认为“sequence 合法” RCV.WUP:最后一次 window update 使用的接收点 旧内核代码; static inline bool tcp_seque 阅读全文
posted @ 2025-12-15 11:45 codestacklinuxer 阅读(0) 评论(0) 推荐(0)
摘要:https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/net/ipv4?id=b13592d20b210976a0946adf027b7bd9d7734326 旧代码的问题:__kfree_skb() 直 阅读全文
posted @ 2025-12-12 14:48 codestacklinuxer 阅读(0) 评论(0) 推荐(0)
摘要:看下skb入进入receive-queue static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); bool fragstolen; int eaten; 阅读全文
posted @ 2025-12-11 11:44 codestacklinuxer 阅读(0) 评论(0) 推荐(0)
摘要:进货: 收到一大袋邮件(head 链表)。 查看第一封: 查一下地址,发现是去“北京”的。把它作为“提示(Hint)”。 快速分拣: 拿起第二封,看一眼发现也是去“北京”的(利用 Hint),直接扔进“北京堆(sublist)”。 遇到变化: 拿起第三封,发现是去“上海”的。 先把“北京堆”里的所有 阅读全文
posted @ 2025-12-11 10:54 codestacklinuxer 阅读(0) 评论(0) 推荐(0)
摘要:static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) { __icmp_send(skb_in, type, code, info, IPCB(skb_in)); } static 阅读全文
posted @ 2025-12-10 19:41 codestacklinuxer 阅读(9) 评论(0) 推荐(0)
摘要:RACK (draft-ietf-tcpm-rack-01): it is a newer algorithm * (2017-) that checks timing instead of counting DUPACKs. * Essentially a packet is considered 阅读全文
posted @ 2025-08-22 00:07 codestacklinuxer 阅读(37) 评论(0) 推荐(0)
摘要:macvlan 每个虚拟接口是一个拥有独立 MAC 的虚拟设备; 报文根据目的 MAC 做转发; 适用于一些需要独立 MAC 地址的场景,如部分云平台、老旧网络设备下隔离容器网络。 ipvlan 所有接口共享一个 MAC 地址(就是物理接口的); 报文转发根据 目的 IP 地址 做判定; 更适合三层 阅读全文
posted @ 2025-05-18 13:04 codestacklinuxer 阅读(116) 评论(0) 推荐(0)
摘要:在 Macvlan 出现之前,一块以太网卡添加多个 IP 地址,却不能添加多个 MAC 地址,即使使用了创建 ethx:y 这样的方式,这些“网卡”的 MAC 地址和 ethx 都是一样的,本质上,它们还是一块网卡,这将限制很多二层的操作。 Macvlan 允许你在主机的一个网络接口上配置多个虚拟的 阅读全文
posted @ 2025-05-17 23:38 codestacklinuxer 阅读(221) 评论(0) 推荐(0)
摘要:目前 C1容器内的ping -> c1 容器内的网卡eth0 -> 宿主机内的vethacea5a5-> 宿主机内的Linux Bridge -> 宿主机内Bridge 上的vethb7b238f-> C2 容器内的网卡eth0 docker exec xxxx ping 192.168.222.2 阅读全文
posted @ 2025-05-14 19:48 codestacklinuxer 阅读(34) 评论(0) 推荐(0)
摘要:今天处理问题时,发现docker 容器内访问外网不通,tcpdump 抓包发现,只抓到veth 接口上的包,但是报文需要再宿主机物理网卡上转发到外网,此时这部分报文没看到, 目前容器使用桥接模式(Bridge Network) 容器 eth0 (veth0) ↓ veth_xmit() [veth. 阅读全文
posted @ 2025-05-08 00:00 codestacklinuxer 阅读(34) 评论(0) 推荐(0)
摘要:https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/net/ipv4/tcp_input.c?id=124c4c32e9f3b4d89f5be3342897adc8db5c27b8 阅读全文
posted @ 2025-02-11 22:05 codestacklinuxer 阅读(20) 评论(0) 推荐(0)
摘要:以前的印象中,shutdown rd后,就不能从fd里面读到数据,今天测试时和预计的不一样! 可以看到shutdown后 rd后,还是可以read 数据。分析tcp_rcvmsg可以看到确实能读到数据 // 定义一个接收TCP消息的函数 static int tcp_recvmsg_locked(s 阅读全文
posted @ 2024-12-26 20:17 codestacklinuxer 阅读(41) 评论(0) 推荐(0)
摘要:1、收到ecn后调用tcp_fastretrans_alert >tcp_try_to_open >tcp_enter_cwr /* Enter CWR state. Disable cwnd undo since congestion is proven with ECN */ void tcp_ 阅读全文
posted @ 2024-12-21 00:58 codestacklinuxer 阅读(21) 评论(0) 推荐(0)
摘要:tcp_notsent_lowat控制发送缓存队列中的未发送数据量。低于此值可发送 也就是对外是epoll_out 内核函数tcp_poll,通过函数sk_stream_is_writeable的结果判定,可通知用户层发送数据的时机。当发送缓存队列的数据流小于notsent_lowat值的时候,由P 阅读全文
posted @ 2024-12-21 00:24 codestacklinuxer 阅读(54) 评论(0) 推荐(0)
摘要:收到ACK时,tcp_slow_start_after_idle ==1;报文都已经被ack,也就是inflight==0 则 检查是否应该tcp_cwnd_restart static int tcp_ack_update_window(struct sock *sk, const struct 阅读全文
posted @ 2024-12-19 14:51 codestacklinuxer 阅读(23) 评论(0) 推荐(0)
摘要:// Test of slow start when not application-limited, so that // the cwnd continues to grow. // In this variant, the receiver sends one ACK per 4 packet 阅读全文
posted @ 2024-12-18 02:02 codestacklinuxer 阅读(27) 评论(0) 推荐(0)
摘要:还是同样的脚本: // Test shifting of newly-SACKed ranges onto the previous already-SACKed skb. // This variant tests non-FACK SACK with SACKs coming in the or 阅读全文
posted @ 2024-12-18 01:32 codestacklinuxer 阅读(50) 评论(0) 推荐(0)
摘要:// Test shifting of newly-SACKed ranges onto the previous already-SACKed skb.// This variant tests non-FACK SACK with SACKs coming in the order// 2 6 阅读全文
posted @ 2024-12-17 19:57 codestacklinuxer 阅读(29) 评论(0) 推荐(0)
摘要:PRR算法(Proportional Rate Reduction)决定在丢包恢复(Loss Recovery)期间,对应于每个ACK报文,可发送的报文数量。目的是:1)快速平稳的从Loss中恢复;2)恢复之后拥塞窗口收敛与ssthresh。主要是为了解决Linux内核之前采用的恢复算法Rate-h 阅读全文
posted @ 2024-12-16 18:59 codestacklinuxer 阅读(150) 评论(0) 推荐(0)

1 2 3 4 5 ··· 10 下一页