Re: ifconfig data



On Thu, Feb 19, 2009 at 11:43 AM, Hugo Vanwoerkom <hvw59601@xxxxxxxxx> wrote:
Hi,

Ifconfig says:

...
ppp0 Link encap:Point-to-Point Protocol
inet addr:200.57.201.43 P-t-P:200.57.219.18 Mask:255.255.255.255
...

I want that inet addr (200.57.201.43) in a program and I prefer not to run
the ifconfig command from it and grep it.

Does anyone know where else in the system that information resides?

I installed the net-tools source and looking at ifconfig.c it's not
immediately obvious.


Why don't you want to grep the output of ifconfig?

Maybe this would suit you:
http://www.geekpage.jp/en/programming/linux-network/get-ipaddr.php
(Changing eth0 to ppp0 obviously)

NB. To get that example to work I had to change the includes as follows:
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <unistd.h>

Nye


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: ifconfig data
    ... not to run the ifconfig command from it and grep it. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: ifconfig data
    ... ppp0 Link encap:Point-to-Point Protocol ... I want that inet addr in a program and I prefer not to run ... the ifconfig command from it and grep it. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • pilot-xfer unable to bind to port: net:any
    ... ifconfig shows the ppp link was set up successfully: ... adorno:/etc# ifconfig ppp0 ... ppp0 Link encap:Point-to-Point Protocol ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • Re: Problems with latest update and network
    ... ps ax | grep dh ... > I now cannot connect to the network. ... To unsubscribe, ...
    (freebsd-questions)
  • Re: Sporratic ping times over pppoe
    ... ppp0 Link encap:Point-to-Point Protocol ... Prev by Date: ...
    (comp.os.linux.networking)