sock->sk_buff sk_buff结构详解 /usr/src/linux-2.6.19/include/linux/skbuff.h struct sk_buff { struct sk_buff *next; struct sk_buff *prev; struct sock *sk; //被哪个sock所拥有 struct skb_timeval -tstamp; //数据包到达的时间 struct net_device *dev; //数据包经过的网络设备 struct net_device *input_dev; - //数据包到达的网络设备 union { struct tcphdr *th; //TCP传输层头 struct udphdr *uh; //UDP传输层头 struct icmphdr - *icmph; struct igmphdr - *igmph; struct iphdr *ipiph; struct ipv6hdr - *ipv6h; unsigned char *raw; //原始数据流 } h; union { struct iphdr *iph; //IP层头 struct ipv6hdr - *ipv6h; struct arphdr *arph; unsigned char *raw; } nh; union { unsigned char *raw; } mac; //MAC层即数据链路层头 struct dst_entry - *dst; //发送到的目的地址描述 struct sec_path - *sp; char cb[48]; unsigned int len, data_len, //数据长度 mac_len, //链路层头的长度 csum; //校验结构 __u32 priority; //数据包排队优先级 __u8 local_df:1, cloned:1, ip_summed:2, nohdr:1, nfctinfo:3; __u8 pkt_type:3, fclone:2, ipvs_property:1; __be16 protocol; //ethernet协议的类型 void (*destructor)(struct sk_buff *skb); #ifdef CONFIG_NETFILTER struct nf_conntrack *nfct; #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) struct sk_buff *nfct_reasm; #endif #ifdef CONFIG_BRIDGE_NETFILTER struct nf_bridge_info *nf_bridge; #endif __u32 nfmark; #endif /* CONFIG_NETFILTER */ #ifdef CONFIG_NET_SCHED __u16 tc_index; #ifdef CONFIG_NET_CLS_ACT __u16 tc_verd; #endif #endif #ifdef CONFIG_NET_DMA dma_cookie_t dma_cookie; #endif #ifdef CONFIG_NETWORK_SECMARK __u32 secmark; #endif unsigned int truesize; atomic_t users; unsigned char *head, //buffer头指针 *data, //数据头指针 *tail, //数据尾指针 *end; //结束指针 }; |
struct--sk_buff
最新推荐文章于 2024-01-02 13:11:00 发布