Hi All,
I came across Rubini's article on virtual network interface
http://www.linux.it/~rubini/docs/vinter/vinter.html,
quite a good article it is.
Thanks to Rubini for the article. Now I'm trying to extend the same virtual interface
to work on my ethernet driver.
I'll try to explain what I want achieve
After creating the virtual interface, I'll assign it with an IP of different
subnet
say if eth0 is 192.168.1.13 , I'll assign virtual interface insane with
192.168.6.2.
And inside the ethernet driver on reception of any packet, I'll look at the
packet type
and process them like this:
If its an ARP packet, then I'll look through the ARP header and see if its
destined for
the eth0 interface's IP address, then I'll update the skb->dev with eth0
device and
take it further to netif_rx. If its destined for insane interface's IP
address,then
I'll update the skb->dev with insane device and take it further to netif_rx.
Like this eth0 and insane will respond to the ARP requests accordingly
If its an IP packet, then I'll look through the IP header and see if its
destined for
the eth0 interface's IP address, then I'll update the skb->dev with eth0
device and
take it further to netif_rx. If its destined for insane interface's IP
address,then
I'll update the skb->dev with insane device and take it further to netif_rx.
Note: Currently I do not bother about broadcast IP addressess.
Now I'm able to transmit and receive packets w.r.t the insane device,
tried with ftp,ssh,telnet, they seem to work but I observe
lots of packet losses
for the insane interface if I initiate a ping on insane.
say insane with IP 192.168.6.2. now I ping to a PC with IP 192.168.6.5 using
the insane device
I observe packet loss, in 10 packets transmitted only 2 or three will get
the response back.
The ARP resolution is happening correctly (i changed in the code from
arp_broken_ops to
arp_hh_ops so that it takes from the eth0).
But if I ping from the other PC to the insane interface like
192.168.6.5(different PC) to
192.168.6.2 (PC with insane) ping works fine without any packet loss.
what can be the reason ?, am I missing anything w.r.t the virtual driver or
is this
something I'm trying which is conceptually wrong, please do help me.
Thanks for your time,
--Ganesh