[(really) OT] find IP address of a pppd

Dirk Koopman djk at tobit.co.uk
Wed Oct 15 15:17:05 BST 2008


Before someone goes off on one, this is not an FAQ which involves 
reading about if-up/if-down, you may assume that I have done that and 
understood it.

I have a program (running only on linux 2.6 kernels) which controls one 
*or* more instances of pppd. Any or all of those pppds could start or 
stop at any time.

Given the process number of the pppd in question, I want to find out (or 
be notified [this may be a dbus question]) the ip address assigned to 
the pppd that has just been started.

If there is more than one pppd being started (which may happen 
simultaneously - although that, at least, can be controlled), it is very 
important to me that I get the IP address that pertains to the pppd that 
is controlling it.

I want to be able to do this from within the program controlling the 
pppds, preferably without calling any helper programs (eg ifconfig or 
lsof) or doing any if-up/if-down magic from within pppd. I am presuming 
that this involves poking around inside /proc and/or /sys.

What I can't seem to find is some pathway from the process id to either 
the correct device name and then another to the ip(v4) address.





More information about the london.pm mailing list