Resurrect the code to check for duplicate interface addresses that was

lost in the previous change.

This fixes PRs 7065 and 7482 by Martin Husemann <martin@rumolt.teuto.de>.

Also do the interface copying iff INT_LOOPBACK as in the BSDI version of
this code.
This commit is contained in:
bad 1999-05-27 17:12:22 +00:00
parent 50b4144943
commit 4254ad64cc

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntp_io.c,v 1.9 1999/01/29 13:19:17 bouyer Exp $ */ /* $NetBSD: ntp_io.c,v 1.10 1999/05/27 17:12:22 bad Exp $ */
/* /*
* xntp_io.c - input/output routines for xntpd. The socket-opening code * xntp_io.c - input/output routines for xntpd. The socket-opening code
@ -607,11 +607,15 @@ create_sockets(port)
* for the two aliases on the one physical interface. -wsr * for the two aliases on the one physical interface. -wsr
*/ */
for (j=0; j < i; j++) for (j=0; j < i; j++)
if ((inter_list[j].sin.sin_addr.s_addr & if (((inter_list[j].sin.sin_addr.s_addr ==
inter_list[i].sin.sin_addr.s_addr) ||
((inter_list[j].sin.sin_addr.s_addr &
inter_list[j].mask.sin_addr.s_addr) == inter_list[j].mask.sin_addr.s_addr) ==
(inter_list[i].sin.sin_addr.s_addr & (inter_list[i].sin.sin_addr.s_addr &
inter_list[i].mask.sin_addr.s_addr)) inter_list[i].mask.sin_addr.s_addr))))
{ {
if (inter_list[j].flags & INT_LOOPBACK)
inter_list[j] = inter_list[i];
break; break;
} }
if (j == i) if (j == i)