<< | Thread Index | >> ]    [ << | Date Index | >> ]

Subject: Retrieving dynamically allocate cipe device
From: "R. Steve McKown" <rsmckown,AT,yahoo,DOT,com>
Date: Sat, 30 Nov 2002 01:29:04 +0100

Hi all,

ciped-cb can get a device name allocated to it from the kernel.  Here's 
a little code snippet from ciped.c:

d.num=-1;
...
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 
name.

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 
connection.

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?

Thanks,
Steve





<< | Thread Index | >> ]    [ << | Date Index | >> ]