tcpdump mailing list archives

Get my own IP


From: Luis Martin Garcia <luis.mgarc () gmail com>
Date: Fri, 23 Mar 2007 23:35:52 +0100

Hello,

Im sorry if this is not the correct place to ask but I've been googleing
for 3 hours and I can't find a solution.


The thing is that I'm writing an application for Linux that creates it's
own TCP/IP packets and sends them using a raw socket. To create the
packet, I need to know which IP address is associated with the interface
that the socket will be using to send data.

I though libpcap could be really helpful as it's very portable but I
can't figure out the way to get the IP address of an interface. I am
using pcap_lookupnet() but with that I just get the address of the
network, not the specific IP address that the interface has been asigned.

Is there any way, using libpcap or not, to get the IP of a network
interface in a portable and easy way?


Could you please help me?



Thanks a lot, and I apologize if this is not the correct place to ask
for this kind of stuff.


Salud.


Luis.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: