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 Mon, Aug 18, 2003 at 09:20:57AM -0600, Gary Thomas wrote:

> > > 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
> 
> Interesting.  I'd start by comparing how your code brings up the
> interface vs. how DHCP does it.  Have you tried BOOTP (instead of
> DHCP)?  It does things a little differently still and might provide
> other clues.

The DHCP code builds a fake BOOTP response and calls the
init_net() routine in bootp_support.c [an older version of
bootp_support() is where I copied my init code from].


> > Moving to the new network stack sure has proven to be more of a
> > pain than I anticipated...
> 
> Sorry, it wasn't meant to be painful :-(  I guess added flexibility
> adds complexity (and maybe pain).

It's more likely that I wasn't doing things quite right to
start with and my mistakes were more compatible with the old
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]