This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Can't get socket's IP address w/ new stack?
On Fri, Aug 15, 2003 at 03:45:50PM -0600, Gary Thomas wrote:
> > 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).
>
> You mean an 'eth0' and an 'eth1'?
No. There's only one Ethernet interface: eth0. The stack
maintains a list of what it calls "external interfaces". In my
case there are two:
0.0.0.0 (eth0)
10.0.0.7 (eth0)
When you call SIOCGIFADDR, it returns the first one, unless you
specify an IP address. If I specify 10.0.0.7 in the request,
then it returns 10.0.0.7. Otherwise, it just returns the first
IP address it finds associated with that interface: 0.0.0.0.
> If so, why doesn't your code ask for the information for 'eth1'?
There isn't one. :)
> What happens if you call _show_all_interfaces() (defined in
> net/common/current/src/ifaddrs.c)?
Thanks -- I'll give it a try.
> If this shows useful information, perhaps you could fetch what
> you need the same way.
>
> (I know it's not a direct answer, but it might help)
--
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