This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can't get socket's IP address w/ new stack?


On Fri, Aug 15, 2003 at 03:05:08PM -0500, Grant Edwards wrote:

> I use the following routines to get the current IP address and
> netmask.  Both worked fine under the old network stack, but
> with the new stack, getting the IP address retuns nothing
> (stuct is all 0's).

>   if (ioctl(s, SIOCGIFADDR, &ifr))

OK.  The stack thinks there are two external interfaces.  The
first one has an IP address of 0.0.0.0 and the second one has
the IP address of 10.0.0.7 (that's the one who's IP address I'm
trying to get).

I've been tracing execution of the ioctl() code from in.c, and
AFAICT, the _only_ way you can get it to return info on an
interface other than 0.0.0.0 (the first one on the list), is to
specify the IP address of the interface for which you want info.

IOW, you have to pass in the interface's IP address in the
request for the interface's IP address.

Can somebody explain to me how SIOCGIFADDR is supposed to work
in the new stack?

I've been googling all afternoon for example code using
SIOCGIFADDR, but all the examples I can find are identical to
what I did with the old stack -- and that doesn't work with the
new stack.

-- 
Grant Edwards
grante@visi.com

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]