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:45:50PM -0600, Gary Thomas wrote:

> > 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.
> 
> What happens if you call _show_all_interfaces() (defined in 
> net/common/current/src/ifaddrs.c)?

  0x003dfd94 - eth0 - 
  0x003dfdb0 - eth0 - 10.0.0.7
  indx(eth0) = 1
  index(eth0) = 1/eth0

Notice how there are two interfaces named "eth0" and the second
one is the one with the IP address?  The SIOCGIFADDR always
returns the address from the first interface (which doesn't
_have_ an address, so the structure is all 0's).

There must be something wrong about the way I'm initializing
the stack things.  When I let DHCP do it, I get different
results:

  0x003dfd94 - eth0 - 10.0.0.7
  0x003dfdcc - lo0 - 127.0.0.1
  indx(eth0) = 1
  index(eth0) = 1/eth0

Moving to the new network stack sure has proven to be more of a
pain than I anticipated...

-- 
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]