Chinaunix首页 | 论坛 | 博客
  • 博客访问: 110370
  • 博文数量: 24
  • 博客积分: 1335
  • 博客等级: 中尉
  • 技术积分: 415
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-25 10:07
文章分类
文章存档

2011年(22)

2010年(2)

分类: 系统运维

2011-06-17 00:07:09

sock->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;       //结束指针
};
阅读(2302) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~