I have made a module which is transmitting but I don't know whether the packet which I am transmitting is a ping packet or not. Code is shown below:
icmp.type = 8;
icmp.code = 0;
icmp.un.echo.sequence = i;
ip4.protocol = 1; //for icmp protocol
ip4.frag_off = 0;
ip4.daddr = in_aton(procfs_buffer);
ip4.saddr = in_aton(ifr->ifr_addr.sa_data);
len = sizeof(data);
skb = dev_alloc_skb(1500);
skb->dev = __dev_get_by_name(&init_net,"wlan0");
skb_reserve(skb,NET_IP_ALIGN); // header of 2 bytes; increments tail and
// data pointer
skb->data = skb_put(skb,sizeof(len)); // increments all pointer or adds data
memcpy(data,skb->data,len);
skb->transport_header =skb_push(skb,sizeof(icmp));
memset(skb->transport_header,0,sizeof(struct icmphdr));
memcpy(skb->transport_header,&icmp,sizeof(struct icmphdr));
skb->network_header=skb_push(skb,sizeof(ip4));
memset(skb->network_header,0,sizeof(struct iphdr));
memcpy(skb->network_header,&ip4,sizeof(struct iphdr));
// printk("i::%d\n",i);
// skb->mac_header = skb_push(skb,6*sizeof(0xFF));
// memset(skb->mac_header,0xFF,6*sizeof(0xFF));
dev_queue_xmit(skb);
kfree(skb);
How can I know that it is a ping packet which I am creating and transmitting? Further I want to receieve the ping packet in response to my ping packet which I have transmitted. I would like to use napi but wont mind any other suggestions.
please read a topic : reception napi mode herei couldn't understand what to do from the link above