Subject: bin/6897: xntpd interfaces alias bug
To: None <>
From: Wolfgang Rupprecht <>
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
>Originator:     Wolfgang Rupprecht
W S Rupprecht Computer Consulting, Fremont CA
>Release:        NetBSD-current 1/23/99

System: NetBSD 1.3I NetBSD 1.3I (WSRCC) #0: Sat Jan 23 15:06:23 PST 1999 i386

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

	ifconfig de0
	ifconfig de0 alias

	ps -axl | grep xntpd
		note that its dead.


	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