Darren J Moffat writes:
> DJM-1 usr/src/cmd/cmd-inet/sbin/netstrategy/netstrategy.c:170
> 
> I don't follow why interface is declared static, what am I missing ?
> It looks to me like we only return use interface (and return it) if 
> found_one is true and in that case we have also done a strncpy into 
> interface.

It's being returned to the caller.  If it were a stack variable, the
stack storage would be deallocated on return.  Returning a stack array
to the caller is a classic C coding error.  :-/

(Note the use of alloca -- the array of structures is also on the
stack.)

> DJM-2 usr/src/cmd/cmd-inet/sbin/netstrategy/netstrategy.c:204,242
> 
> I think these strncpy can be replaced with the safer strlcpy.

No.  These are actually correct.  lifr_name is a fixed-length array,
and the fact that strncpy zeros out to the end of the array is a
desirable feature.

> DJM-3 usr/src/cmd/cmd-inet/sbin/netstrategy/netstrategy.c:199
> 
> Existing logic, but why do we skip logical interfaces ?  Zones without 
> exclusive IP stack often have logical interfaces.  I don't expect this 
> to be changed for this bug fix just curious.

That's a good question.  The current logic is that we can't use a
logical interface as a primary, but I don't see a good reason that's
true.

(I would suggest not changing this, but rather filing a bug on it.
One that'll get ignored, as OpenSolaris aims to do away with
netstrategy altogether.)

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to