new interfaces code (bug fix + questions)
Andrej Borsenkow
Andrej.Borsenkow at mow.siemens.ru
Wed Sep 1 09:36:31 GMT 1999
[[ I copy it to Harlan Stenn as well ]]
>
> 1) I try to auto-detect whether the size is returned at the start of
> the buffer so we don't need an ifdef. Let me know if you think what
> I've done is valid.
>
Harlan, what do you think of it? The code tries to autodect
SIZE_RETURNED_IN_BUFFER that is hardcoded in ntpd and relevant part looks like
/* we can ignore the possible sizeof(int) here as the resulting
number of interface structures won't change */
n = strioctl.ic_len / sizeof(struct ifreq);
/* we will assume that the kernel returns the length as an int
at the start of the buffer if the offered size is a
multiple of the structure size plus an int */
if (n*sizeof(struct ifreq) + sizeof(int) == strioctl.ic_len) {
ifr = (struct ifreq *)(buff + sizeof(int));
} else {
ifr = (struct ifreq *)buff;
It looks fine for me ... but I do not have access to any system that is using
(or needs) STREAMS TLI.
May be, if it works, you could use it for ntpd as well?
>
> The new code is at ftp://samba.org/pub/tridge/misc/interfaces.c
>
> > How do you intend to choose the method? I think, that IFCONF must be
> > selected if at all possible.
>
> In autoconf I'll try HAVE_IFACE_AIX first, then HAVE_IFACE_IFCONF then
> HAVE_IFACE_IFREQ. We need to try AIX first as IFCONF works on AIX but
> only gives some of the interfaces.
>
Again, hard to tell. Immediate con is the case of compiling on a system without
network :-) Is probably rare. The worst case is a system, that supports both,
but returns less intefaces with IFCONF (sockets) than with IFREQ (STREAMS TLI).
/andrej
More information about the samba-technical
mailing list