From owner-freebsd-bugs Fri Oct 11 12:20: 6 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 80CD337B401 for ; Fri, 11 Oct 2002 12:20:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D48C43E9E for ; Fri, 11 Oct 2002 12:20:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g9BJK3Co001152 for ; Fri, 11 Oct 2002 12:20:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g9BJK3CY001150; Fri, 11 Oct 2002 12:20:03 -0700 (PDT) Date: Fri, 11 Oct 2002 12:20:03 -0700 (PDT) Message-Id: <200210111920.g9BJK3CY001150@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Michael R. Wayne" Subject: Re: bin/43938: ntpd binds to local aliases Reply-To: "Michael R. Wayne" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/43938; it has been noted by GNATS. From: "Michael R. Wayne" To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/43938: ntpd binds to local aliases Date: Fri, 11 Oct 2002 15:19:44 -0400 Here is the patch. It includes a comment regarding the error serveral lines earlier. This code is only invoked at startup so the change is fairly low risk. It properly honors the values of -d (debug) and -L (undocumented virtual IP address support). Works properly on our web servers, continues to listen on 127.0.0.1 but not on any aliased IP addresses (unless you specify -L). /\/\ \/\/ *** /home/wayne/ntp_io.c.ORIG Fri Oct 11 09:47:32 2002 --- ntp_io.c Fri Oct 11 11:52:01 2002 *************** *** 472,477 **** --- 472,502 ---- # ifndef SYS_WINNT inter_list[i].flags |= INT_LOOPBACK; # endif /* not SYS_WINNT */ + /* Start Msen fix for ntpd binding to all aliased IP addresses on the loopback interface (wayne@msen.com) */ + /* Here, we know we are on the loopback interface. Unless + * we are told to listen to virtual IP addresses (-L option), + * we want to exclude any address that is not 127.0.0.1 + */ + + /* Note: The code 13 lines above this one tests the value of + * inter_list[i].sin.sin_addr.s_addr, but has never set a value for it. + * While this does not affect us under FreeBSD, it is a bug and + * we need to notify the ntpd maintainers. + */ + inter_list[i].sin = *(struct sockaddr_in *)&ifr->ifr_addr; + if (inter_list[i].sin.sin_addr.s_addr != inet_addr("127.0.0.1")) { + if (listen_to_virtual_ips) { + if (debug) + printf("Using %s - Virtual IP aliased on loopback\n", inet_ntoa((inter_list[i].sin.sin_addr))); + } else { + if (debug) + printf("Ignoring %s - Virtual IP aliased on loopback\n", inet_ntoa((inter_list[i].sin.sin_addr))); + } + } else { + if (debug) + printf("Using %s - Primary address on loopback\n", inet_ntoa((inter_list[i].sin.sin_addr))); + } + /* End Msen fix for ntpd binding to all aliased IP addresses on the loopback interface (wayne@msen.com) */ if (loopback_interface == 0) { loopback_interface = &inter_list[i]; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message