Retrieving dynamically allocate cipe device|
"R. Steve McKown" <rsmckown,AT,yahoo,DOT,com>|
Sat, 30 Nov 2002 01:29:04 +0100|
ciped-cb can get a device name allocated to it from the kernel. Here's
a little code snippet from ciped.c:
ioctl_alloc(f, DEVNAME "0", &d),
For my application of cipe tunnels, I like this approach. However, the
management layer that sits "above" ciped needs to be able to determine
the device assigned to add interface-specific routes, etc.
Anyone have a good suggestion on how to retrieve the device assigned?
I'd prefer to do it from a C program, rather than grokking text output
in a shell script, and would like for it to be efficient enough to call
any time I need the device name, rather than caching it locally. Local
cache may be a bad idea if one connection can quit using a given name
and another can begin using it, unbeknownst to the holder of the cached
So far, the only thing I've been able to come up with is to use ioctl()
to walk the allocated cipe devices looking for the ip pair (the tunnel
endpoints) that match information originally used to initiate the
Because I started ciped-cb, is there perhaps a way to query it, or work
from that daemon's pid to get to the assigned device name?