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 Mon, Aug 18, 2003 at 01:13:06PM -0600, Gary Thomas wrote:
> > Here's the answer:
> >
> > With the new stack you have to:
> >
> > 1) Set the address (SIOCIFADDR)
> > 2) Set the mask (SIOCSIFNETMASK)
> > ++> 3) Set the address _again_ (SIOCSIFADDR) <++
> > 4) Set the broadcast address (SIOCSIFBRDADDR)
> > 5) Set the routing (SIOCADDRT)
> >
> > With the old stack, you didn't have to do step 3 (set the IP
> > address a second time). Odd, eh?
>
> What happens if you skip step 1 (i.e. only do SIFNETMASK followed
> by SIFADDR)?
Wait a second...
My previous post was wrong. Step 1) is the new step. I used
to set the mask, then IP address, then broadcast, then route:
Old Stack New Stack
----------------------------- -------------
Ancient Old New
set address
set address set mask set mask
set mask set address set address
set broadcast set broadcast set broadcast
set route set route set route
With the old stack, the "Ancient" sequence ignored the mask
setting and used the default A/B/C mask based on the address. I
had to set the mask first (this worked with 1.3.1 and the more
recent "old" stack).
With the new stack, and the "Old" sequence: setting the mask
creates an "interface" with no address, and then setting the
address creates a second one _with_ an address. My testing
indicates that the second "set address" isn't required with the
new stack, and the first one isn't required on the old stack.
I _think_ that both stacks work with the "New" sequence.
--
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