Writing virtual network Driver for Ethernet devices
Hi Everyone,
I implemented a virtual driver (similar to traffic shaper in linux) which works like this. All packets coming from protocol stack will first receive to this New virtual driver and thereafter it goes to real driver code. It was working fine with 2.6.18 Kernels in linux. I modified the code and run for 2.6.32,but I observed the strange things. If I ping from source to destination, the ping is not working. I have seen the packets through traffic analyzer, and found that the packets are going properly to destination, but the reply is not coming back to the source. Similarly with the same configuration If I ping from destination to source, the ping is not working.
After proper configuration ( making eth0 slave to virtual interface)
ifconfig and routing entries like this:
Virtual Link encap:Ethernet HWaddr 00:25:b3:5d:5e:a9
inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::225:b3ff:fe5d:5ea9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:3852 (3.8 KB)
eth0 Link encap:Ethernet HWaddr 00:25:b3:5d:5e:a9
inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::225:b3ff:fe5d:5ea9/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:707474 errors:0 dropped:0 overruns:0 frame:0
TX packets:375814 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:578708921 (578.7 MB) TX bytes:53155510 (53.1 MB)
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3568 errors:0 dropped:0 overruns:0 frame:0
TX packets:3568 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:328104 (328.1 KB) TX bytes:328104 (328.1 KB)
And route -n
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 Virtual
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 Virtual
I have given the same IP address of the salve and kept only Virtual
routing table entries.
Help in this regards is highly appreciated.
|