Question about the destination IP address in network datagram (skb)
Source: Internet
Author: User
For more information about the destination IP address in network datagram (skb)-Linux general technology-Linux programming and kernel, see the following. I wrote a driver that runs in a kvm virtual machine. This driver can be disguised as a NIC to send messages to the outside world. Two linux virtual machines can communicate with each other through this driver, there is no problem between two virtual machines (ping and ssh commands are acceptable). These two virtual machines form a virtual LAN, the two simulate data transmission over the network by copying data in the memory.
Now I have A problem: A (192.168.111.1) ping B (192.168.111.2). Before sending A message, I use ip_hdr (skb)-> daddr (saddr) to obtain the purpose (source) of the packet) the IP address is correct. After data is regrouped into skb in B, the destination (source) IP address in the packet is obtained in the same way before netif_rx_ni, it is found that the IP address is incorrect, but the target IP address in the packets intercepted by tools such as wireshark is correct and depressing!
The method for extracting the destination IP address in A and B is the same. Is the location where I extracted the IP address in B incorrect? But netif_rx_ni is already A kernel function, the real hardware Nic receives the data and returns it to netif_rx for processing after skb. I don't know which expert can help me solve this problem.
Another problem is: if A ping 192.168.111.3 (the IP address does not exist), the destination IP address I have obtained is not 192.168.111.3, but other data. I don't know what is going on?
Eager for help
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.