Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
157 views
in Technique[技术] by (71.8m points)

c - 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;
        }
question from:https://stackoverflow.com/questions/65903618/reading-sk-buff-and-getting-iphdr-in-kernel-module

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...