Re: How to add virtual devices at run-time?

Ben Greear (greear@cyberhighway.net)
Fri, 22 Jan 1999 21:43:33 -0700


Alan Cox wrote:
>
> > I would imagine that somewhere down the call stack from sys_ioctl()
> > I would need to add a switch for the ADD/DELETE device ioctl
> > values to tell it to go get dev_ioctl() to handle the request. Any
> > idea where that might be?
>
> For socket ioctls the sock_ioctl code is called - net/socket.c and that
> calls the protocol specific handler for the socket (eg
> inet_ioctl in net/ipv4/af_inet.c) which then calls dev_ioctl.
>
> > If I could figure out how to add a /proc entry, maybe I could
> > just control these things by echo'ing commands to that file?
>
> The wanrouter has a /proc directory it puts physical devices in, which you
> can then open and ioctl on to create logical channels. Thats a fairly clean
> example of driving /proc
>
> Alan

I took a look at the wanrouter code, very clean!

I've basically just coppied it for the VLAN proc files.

The next thing on my list is to write some code that can set up
peer-to-peer
switching among devices. In other words, each device will be able to
specify
one other device that it is to send all it's incomming packets to.

What this will give me is the ability to directly map DLCI or SVC/PVC
'devices' to
VLAN 'devices', thereby giving me basically a layer-2 switch. So, to
set this up in the kernel, I want to have the ability to specify that
device foo shall send all incomming buffers to device bar.

My original idea was to have a proc file that I could write something
like this: vlan0 <-> dlci5\n ... to a special /proc file.

Is the above idea a standard way to do something like this, or should I
just shoot
for IOCTL's? Can anyone point me to some code that actually handles
writes
to a /proc file?

Thanks,
Ben

-- 
Ben Greear (greear@cyberhighway.net)  http://www.primenet.com/~greear 
Author of ScryMUD:  mud.primenet.com 4444        (Released under GPL)
http://www.primenet.com/~greear/ScryMUD/scry.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/