1 |
On Tue, 11 Dec 2012 19:33:15 +0800, Bill Kenworthy wrote about |
2 |
"[gentoo-user] ifconfig and ppp0 address": |
3 |
|
4 |
>For years I have been using ifconfig and some simple shell magic to |
5 |
>extract the ip address from the adsl ppp session when it changes. The |
6 |
>latest update has changed the output format of ifconfig breaking things |
7 |
>so if ifconfig cant be relied on, what's normally used to extract an |
8 |
>interfaces IP address? I can easily rewrite the shell magic, but its |
9 |
>worth asking if there is some command better suited. |
10 |
|
11 |
I wrote a command in C++ that interrogates the TCP/IP stack directly to |
12 |
obtain the IP address of any given interface. I wrote it some years |
13 |
ago, so it's only IPv4 at the moment; it will take a day or two to add |
14 |
IPv6 support. |
15 |
|
16 |
I can send you the source code if you want. Likewise to any other |
17 |
interested reader -- or I can post it here as a mail attachment, since |
18 |
it is quite tiny. |
19 |
-- |
20 |
Regards, |
21 |
|
22 |
Dave [RLU #314465] |
23 |
====================================================================== |
24 |
dwnoon@××××××××.com (David W Noon) |
25 |
====================================================================== |