随笔分类 - socket
摘要:今天在新入职的公司处理waf 的问题时,突然看到了一个tcp状态close-wait 想一想 close-wait 是怎样产生的???? 被动收到FIN 关闭请求,协议栈主动发出ACK, 等待 本端主动发出 FIN,但是本端一直没有执行CLOSE。也就是在被动关闭连接情况下,在已经接收到FIN,但是
阅读全文
摘要:今天 顺便看了一下 ifconfig ip ethtool 工具的strace 结果 ; 发现其实就是 创建一个 socket-fd 然后 指定接口名, 然后设置 /获取 相关属性 也就是通过 ioctl netlink 接口 获取设置信息 看下网络设备结构: 目前ioctl 源码在:fs/ioct
阅读全文
摘要:tcp_v4_connect /* This will initiate an outgoing connection. tcp_v4_connect函数初始化一个对外的连接请求,创建一个SYN包并发送出去, 把套接字的状态从CLOSE切换到SYN_SENT,初始化TCP部分选项数据包序列号、 窗口
阅读全文
摘要:shutdown 系统调用关闭连接的读数据通道 写数据通道 或者 读写数据通道; 关闭读通道:丢弃socket fd 读数据以及调用shutdown 后到达的数据; 关闭写通道:不同协议处理不同;tcp协议,将所有的数据发送完成,发送完后发送FIN; 但是为了删除套接字和释放文件描述符,我们必须使用
阅读全文
摘要:accept 用于从指定套接字的连接队列中取出第一个连接,并返回一个新的套接字用于与客户端进行通信,示例代码如下 #include <sys/types.h> /* See NOTES */#include <sys/socket.h>int accept(int sockfd, struct so
阅读全文
摘要:#include <sys/types.h> /* See NOTES */#include <sys/socket.h>int listen(int sockfd, int backlog); · 参数 int sockfd :成功创建的 TCP 套接字。·int backlog :定义 TCP
阅读全文
摘要:connect 系统调用 分析 #include <sys/types.h> /* See NOTES */#include <sys/socket.h>int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
阅读全文
摘要:主要查看linux kernel 源码:Socket.c 以及af_inet.c文件 1.1 bind分析 #include <sys/types.h> /* See NOTES */#include <sys/socket.h>int bind(int sockfd, const struct s
阅读全文
摘要:socket 结构 /** * struct socket - general BSD socket * @state: socket state (%SS_CONNECTED, etc) * @type: socket type (%SOCK_STREAM, etc) * @flags: sock
阅读全文
摘要:netlink 库函数: http://www.infradead.org/~tgr/libnl/doc/core.html#core_netlink_fundamentals #define NETLINK_TEST (31) static int s_send_ack_to_test(struc
阅读全文
摘要:netlink linux kernel
阅读全文
摘要:netlink linux kernel
阅读全文
摘要:netlink linux kernel
阅读全文
摘要:分析网络数据包怎样从中断(链路层)中拷贝到上层 netif_rx_internal
阅读全文