ipaddr -> device

ipaddr -> device

Post by Mike - EMAIL IGNORE » Fri, 21 May 2004 11:04:42



On RedHat 9, programming in C++, on a machine that
has several ethernet cards, I need to determine the
device (eth0, eth1, etc.) from the ip address
(192.168.1.10, etc.).  Is there a function that
will do this?

Thanks in advance for your help.

Mike.

 
 
 

ipaddr -> device

Post by Mike - EMAIL IGNORE » Sat, 22 May 2004 10:53:13



> On Wed, 19 May 2004 22:04:42 -0400

> > On RedHat 9, programming in C++, on a machine that
> > has several ethernet cards, I need to determine the
> > device (eth0, eth1, etc.) from the ip address
> > (192.168.1.10, etc.).  Is there a function that
> > will do this?

> read /etc/network/interfaces? (if the IP addresses are static)

[...]

I do not have this file on my RH9.  My ip addresses are static.

Mike.

 
 
 

ipaddr -> device

Post by Floyd L. Davids » Sat, 22 May 2004 14:26:46




>> On Wed, 19 May 2004 22:04:42 -0400

>> > On RedHat 9, programming in C++, on a machine that
>> > has several ethernet cards, I need to determine the
>> > device (eth0, eth1, etc.) from the ip address
>> > (192.168.1.10, etc.).  Is there a function that
>> > will do this?

>> read /etc/network/interfaces? (if the IP addresses are static)
>[...]

>I do not have this file on my RH9.  My ip addresses are static.

He probably meant /proc/net/dev, but that is not really
satisfactory because while it does list interfaces, it does not
list the ip addresses.

There have been many articles posted to Usenet showing the correct
use of SIOGCIFCONF using C, which should suffice as an example of
where to start with C++.  (I've posted several myself.)

Go to http://groups.google.com/advanced_group_search and do a
search the word SIOGCIFCONF restricted to comp.os.linux.* only,
and you'll come up with several articles.

--
Floyd L. Davidson           <http://web.newsguy.com/floyd_davidson>

 
 
 

ipaddr -> device

Post by Cameron Ker » Sat, 22 May 2004 15:36:00



> On Wed, 19 May 2004 22:04:42 -0400

>> I need to determine the device (eth0, eth1, etc.) from the ip address
>> (192.168.1.10, etc.).  Is there a function that will do this?

> read /etc/network/interfaces? (if the IP addresses are static)

Certainly not, that's Debian specific, and devices can be configured in
various other ways (esp dhcp).

--
Cameron Kerr

Empowered by Perl!

 
 
 

1. touch-screen device<->device driver<-xinput extension-><-X client interaction?

Hi, There,

Could someone take a break for a minute, feel himself a
professor and
give me (and, possibly others interesting fellows) a short
lecture?

Our in-house made pc486 touch-screen controller is attached to a
parallel
port and uses IRQ7 to notify CPU about "touch".

It will be used as input device for X windows system. The
problem is I'm UNIX
illiterate so don't have clear understanding how all these
pieces (touch-screen
controller, touch-screen device driver, kernel, touch-screen
Xinput extension,
X server, X client) communicate to each other. So far I
understood that, for example,
standard Elographics touch-screen controller (connected to
/dev/ttyS1) is actually
controlled by serial port driver, and xf86Elo.so xinput
extension is interfacing between
X server and serial driver (am I right so far?). So to get this
thing working I would have to
write parallel port device driver-IRQ7 handler, create new
special device file, say /dev/touch
pointing to entry points from device driver, somehow let kernel
know there's new driver,
somehow update relevant (what?) kernel's structures so they will
actually point to driver's entry
point according to major/minor of /dev/touch, edit xf86Elo.c to
be able to use it with our
simplified controller. Is it sounds close to the truth? If not,
could somebody tell me how
those pieces work together, pleeeese?

Thanks,

Pavel Tkatchouk

2. error in X-Windows configuration

3. <><><> MOUNTING EXTENDED PARTITION <><><>

4. Linux X server problem...

5. Wanted: <><><> Unix Specialist <><><>

6. Newbie X question

7. LILO help <><><><><><>

8. Linux and NT boot manager?

9. >>---> Software Jobs! >>--->

10. Error Messages when booting: Device>di [devicename] No such Device [devicename]

11. Network device -> PCI device mapping

12. My first device driver => "No such device" :(

13. Copy direct device->device?