new interfaces code (bug fix + questions)

Andrej Borsenkow Andrej.Borsenkow at mow.siemens.ru
Tue Aug 31 15:54:04 GMT 1999


[[ sorry, I am not on this list, but look at archive every now and then :-) ]]

Bug fixes:

1. (small) IFREQ case got the name of interface wrong - both i and ifr were
incremented every loop cycle, so i-th interface got name of 2*i-th interface :-)

2. (BIG) the IFREQ code assumes, that length of interface table is returned at
the beginning of the buffer. THIS IS NOT TRUE FOR ALL SYSTEMS. The fix is based
on ntpd implementation. I added SIZE_RETURNED_IN_BUFFER (the same as in ntpd) -
depending of it, the size of table and pointer to table is adjusted
appropriately. Unfortunately, there is no way to test for it. In ntpd the
variable gets set for

*-fujitsu-uxp*
*-ncr-sysv4*
*-univel-sysv*

only. It means, that for the majority of systems the IFREQ code was plain wrong!
With this change both IFCONF and IFREQ code run on my system (ReliantUNIX
5.44C20). Unfortunately, I cannot test the case when SIZE_RETURNED_IN_BUFFER is
set.

3. I reordered IOCTLs a bit - test for UP first and skip if not.

I attach new interfaces.c.

Question:

How do you intend to choose the method? I think, that IFCONF must be selected if
at all possible. It is the most general case that should work with native BSD
sockets stack and with BSD emulation above STREAMS. The IFREQ case is for the
pure STREAMS stack. The problem is, that some systems (ReliantUNIX being the
example) support two independent stacks - BSD and STREAMS. In this case,
compiling SAMBA with IFCONF will allow running with both stacks (selectable at
runtime) while compiling with IFREQ will leave us with STREAMS only.

In my case, running with BSD, IFCONF returns correct interfaces and IFREQ
returns no (-1) interfaces found.

I did not test AIX for obvious reasons :-)

regards

/andrej
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interfaces.c
Type: application/octet-stream
Size: 7176 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/19990831/2b4c3226/interfaces.obj


More information about the samba-technical mailing list