Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Oct 2002 12:20:03 -0700 (PDT)
From:      "Michael R. Wayne" <wayne@staff.msen.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/43938: ntpd binds to local aliases
Message-ID:  <200210111920.g9BJK3CY001150@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/43938; it has been noted by GNATS.

From: "Michael R. Wayne" <wayne@staff.msen.com>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210111920.g9BJK3CY001150>