Subject: bin/6897: xntpd interfaces alias bug
To: None <gnats-bugs@gnats.netbsd.org>
From: Wolfgang Rupprecht <wolfgang@wsrcc.com>
List: netbsd-bugs
Date: 01/28/1999 00:27:26
>Number:         6897
>Category:       bin
>Synopsis:       xntpd exits if an interface has an alias
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 28 00:35:00 1999
>Last-Modified:
>Originator:     Wolfgang Rupprecht
>Organization:
W S Rupprecht Computer Consulting, Fremont CA
>Release:        NetBSD-current 1/23/99
>Environment:

System: NetBSD capsicum.wsrcc.com 1.3I NetBSD 1.3I (WSRCC) #0: Sat Jan 23 15:06:23 PST 1999 root@capsicum.wsrcc.com:/v/src/netbsd/NetBSD-current/usr/src/sys/arch/i386/compile/WSRCC i386


>Description:
	if an interface has several IP addresses associated with it,
	eg. via 'ifconfig alias ...' then xntp gets confused and exits.

>How-To-Repeat:
	ifconfig de0 10.1.2.3
	ifconfig de0 alias 10.1.2.4

	xntpd
	ps -axl | grep xntpd
		note that its dead.

>Fix:

	NB: this is also PR bin/6171 bin/6551 .  I can't imidiately see
	how to follow up to PR's that I don't have a msg for.

	I've marked this as serious/medium only because things get really
	bolixed up if ntp dies and the time skews between machines.

--- /usr/src/usr.sbin/xntp/xntpd/ntp_io.c.~1~	Thu Aug 13 04:13:57 1998
+++ /usr/src/usr.sbin/xntp/xntpd/ntp_io.c	Thu Jan 28 00:00:01 1999
@@ -371,10 +371,16 @@
        * look for an already existing source interface address.  If
        * the machine has multiple point to point interfaces, then
        * the local address may appear more than once.
+       *
+       * A second problem exists if we have two addresses on the same
+       * network (via "ifconfig alias ...").  Don't make two xntp interfaces
+       * for the two aliases on the one physical interface. -wsr
        */
       for (j=0; j < i; j++)
-	if (inter_list[j].sin.sin_addr.s_addr ==
-	    inter_list[i].sin.sin_addr.s_addr)
+	  if (inter_list[j].sin.sin_addr.s_addr &
+	      inter_list[j].mask.sin_addr.s_addr ==
+	      inter_list[i].sin.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];

Diff finished at Thu Jan 28 00:04:13
>Audit-Trail:
>Unformatted: