Question

I am new to kernel module development. I am trying to development a pseudo network driver operates in loopback mode without any actual device. My goal is to use the following setup:

iperf -s -u.........iperf -c 192.168.1.1 -p 5001 -u

======..............===========

|...if0....|.............|........if1.........|

======..............===========

 |              |
/|\            \|/
 |              |
  ---------------

I have registered two interface from the driver. Then I modified the UDP packet received from if1 so that it appeared as it was received at if0. But it never reaches to the iperf server application listening on all udp if's udp port. But whenever I sniffed the packet via wireshark on if0, it seems that the packet is being received at if0. But for some reason it is not going through the network stack.

any clues? Both the ip checksum & udp checksum have recalculated and verified (using wireshark). I am using netif_rx to indicate packet to the other interface handle (if0 handle).

I have only used 5 function ptr callbacks {open, close, xmit_start, get_stats & config} for network operations. Also checksum is set to UNNECESSARY. IF flag has been set to indicate NO_ARP.

EDIT: IP ADDR OUTPUT

eth1: mtu 1500 qdisc

pfifo_fast state UP qlen 1000 link/ether 00:e0:ff:00:00:e0 brd

ff:ff:ff:ff:ff:ff inet 192.168.1.1/24 brd 192.168.1.255 scope globa eth1 valid_lft

forever preferred_lft forever 4:

eth2: mtu 1500 qdisc pfifo_fast

state UP qlen 1000 link/ether 00:e0:ff:40:00:e0 brd ff:ff:ff:ff:ff:ff

inet 192.168.2.1/24 brd 192.168.2.255 scope global eth2 valid_lft

forever preferred_lft forever

Was it helpful?

Solution

Ok I have figured it out.

I feel stupid not to think about it. The packet was dropped due to the routing issue.

The received packet at the receiving IF must have the same network as the IF.

So, if the IF has 192.168.1.1/24, the routing system only accepts packet originated from 192.168.1.X/24.

I didn't noticed it until I tried with the single IF loopback. Can anyone explain why it has happened?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top