From: Frederick Bruckman Date: Fri, 3 Oct 2003 19:26:15 +0000 (-0500) Subject: Initialize the value of "v6_flag" in all cases in sys_info(), so that "ntpdc -c sysinfo" X-Git-Tag: NTP_4_2_0~6^2~3^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3fbcf2290e42df5fe6d0973b1bd09d4a0089faf8;p=thirdparty%2Fntp.git Initialize the value of "v6_flag" in all cases in sys_info(), so that "ntpdc -c sysinfo" won't display the random, uninitialized value of peer6 for the system peer in the no syspeer case on IPv6-capable hosts. Problem noted and solution provided by Matthias Drochner, with a minor optimization by myself. bk: 3f7dcd57GzKxGB2LrFIZ6hnp8uKPnQ --- diff --git a/ntpd/ntp_request.c b/ntpd/ntp_request.c index a137cce064..9d9d140778 100644 --- a/ntpd/ntp_request.c +++ b/ntpd/ntp_request.c @@ -1041,8 +1041,6 @@ sys_info( is = (struct info_sys *)prepare_pkt(srcadr, inter, inpkt, v6sizeof(struct info_sys)); - is->peer = 0; - is->peer_mode = 0; if (sys_peer != 0) { if (sys_peer->srcadr.ss_family == AF_INET) { is->peer = GET_INADDR(sys_peer->srcadr); @@ -1053,6 +1051,12 @@ sys_info( is->v6_flag = 1; } is->peer_mode = sys_peer->hmode; + } else { + is->peer = 0; + if (client_v6_capable) { + is->v6_flag = 0; + } + is->peer_mode = 0; } is->leap = sys_leap;