All of lore.kernel.org
 help / color / mirror / Atom feed
* getting the device of the ppp connection
@ 2009-11-13 13:54 Mark Ryden
  2009-11-13 14:01 ` Charlie Brady
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Mark Ryden @ 2009-11-13 13:54 UTC (permalink / raw)
  To: linux-ppp

Hello,
  Is there a way from user space to know which device is the one which
the ppp connection uses ?

What I mean is this: I have eth0 - eth3 on a machine, and a ppp
connection. I want to know by a
short program which device is the one which the ppp connection is
using (I know that usually this can
be deduced by running "ps" for the corresponding ppp daemon, and
inspecting the parameters; for example, with pppoe, I have "-I eth1"
parameter (-I stands for interface). But I want a more general
way which can be used in cases when we cannot get this info).

I tried to get info by an ioctl on ("dev/ppp") thus:

  ...
  ...
  int fd = open("/dev/ppp", O_RDWR);
  int ifunit;
  int res;
  if (fd>0) {
      res = ioctl(fd,PPPIOCATTACH,&ifunit);
		
      if (res=0)
	printf("ifunit=%d\n",ifunit);
  }

and got ifunit=0 when using eth0 ; but I ****also**** got  ifunit=1
when using eth1.
So - is there a way to get the interface from the unit number ? or any other
way to get this info ?

Rgs,
Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-14  5:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13 13:54 getting the device of the ppp connection Mark Ryden
2009-11-13 14:01 ` Charlie Brady
2009-11-13 15:00 ` walter harms
2009-11-13 16:34 ` James Carlson
2009-11-13 16:42 ` Charlie Brady
2009-11-13 16:54 ` James Carlson
2009-11-14  5:47 ` Paul Mackerras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.