简体   繁体   中英

reading sk_buff and getting iphdr in kernel module

I am trying to read sk_buff->network_header but when I try to read my computer get froze and never gets unfreez. Why is that happening. This is my code in poll of napi api

        In probe function
        netif_napi_add(netdev, &adapter->napi, e1000e_poll, 64);            
        

        static int e1000e_poll(struct napi_struct *napi, int budget)
        {
        struct sk_buff *skb=napi->skb;
        // (struct iphdr *)skb_network_header(&napi->skb); 
         struct iphdr *ip_header = (struct iphdr *)skb->network_header;
            struct udphdr *udp_header;
            struct tcphdr *tcp_header;
            struct list_head *p;

            //unsigned int src_ip = (unsigned int)ip_header->saddr;
        }

I simply dont want to assign just about anything to something similar. I had check types when assigning plus prinkk not the solution since it does not have formats that covers all types

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM