Welcome! Log In Create A New Profile

Advanced

virtual NetDevice

Posted by Raj 
Raj
virtual NetDevice
October 17, 2007 09:06AM
Hi All,

I there any way to create a virtual netdevice and get all the
TX packets from IP layer to "hard_start_xmit" of virtual device
and send it on "eth0".

TIA
Raj
Re: virtual NetDevice
October 17, 2007 03:01PM
You can register a struct netdev via (un)register_netdevice (see include/linux/netdevice.h). This way you'll get all skbs (including non IP ones) sent to this interface and you can send them on. But be careful with shared skbs!

What do you want to do? (I'm just curious)

---
programing a layer 3+4 network protocol for mesh networks
see [michaelblizek.twilightparadox.com]
raj
Re: virtual NetDevice
October 18, 2007 01:27AM
Planning to integrate ipsec code with kernel. But I have created a virtual device, registred[register_netdevice ] and its configured with same IP & MAC as eth0. but when i try to
send out TX packets kernel never calls "hard_start_xmit" of my virtual device but it sends out packets on real ethernet driver.

I want all the packets diverted to my "hard_start_xmit" and will process packets and send it on to eth0.

Thanks & Regards,
Raj
Re: virtual NetDevice
October 18, 2007 01:52PM
Your routing table probably has an entry with the target "dev eth0".

---
programing a layer 3+4 network protocol for mesh networks
see [michaelblizek.twilightparadox.com]
Re: virtual NetDevice
October 22, 2007 01:59PM
There might also be some more problems:

1) All packets you intercept already have a mac header, which has to be taken away before encapsulating the packet. Then you have to add your own header, then the mac header of the underlying device.

2) Before sending any packet, the ip layer generates an arp packet to resolve the mac address of the target IP. If you don't send a reply, you won't get any data packet. But you can add a static pseudo arp entry, which points to any random address (you don't need it anyway at this point, do you?).

3) When you want to send a packet to the next hop, you need the mac address of the next hop. So you have to send arp packets. And you need to know the next hop. Because you have already pointed the default route to your virtual device, you're in serious trouble now.

Unless you know a clever way to do that, this is going to be a huge mess. It is probably better if you change the net/ipv4/ip* code. What does your code do that other IPsec implementation don't?

---
programing a layer 3+4 network protocol for mesh networks
see [michaelblizek.twilightparadox.com]
Re: virtual NetDevice
September 08, 2017 02:34AM
we have the game play klondike solitaire best selection of ultra addictive free online dice and board games. From card classics like play klondike solitaire to board games that guarantee hours of enjoyment, our dice and board games can all be played online with no downloads needed
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 3 plus 17?
Message: