I am new to kernel module development. I am trying to develop a pseudo-network driver working in loopback mode without any real device. My goal is to use the following setting:
iperf -s -u.........iperf -c 192.168.1.1 -p 5001 -u
====== .............. ============
| ... if0 .... | ............. | ........ if1 ......... |
====== .............. ============
| | /|\ \|/ | | ---------------
I registered two interfaces from the driver. Then I changed the UDP packet received from if1 to appear when it was received in if0. But this never comes to the iperf server application listening on all udp if the udp port. But whenever I sniffed a packet through wirehark on if0, it seems that the packet is accepted at if0. But for some reason, it does not go through the network stack.
any clues? Both the ip checksum and the udp checksum were recalculated and verified (using wirehark). I use netif_rx to point the package to another interface descriptor (if0 descriptor).
I used only 5 ptr callbacks {open, close, xmit_start, get_stats and config} functions for network operations. Also, the checksum is set to REQUIRED. The IF flag is 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