]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Initialize the value of "v6_flag" in all cases in sys_info(), so that "ntpdc -c sysinfo"
authorFrederick Bruckman <bruckman@ntp.org>
Fri, 3 Oct 2003 19:26:15 +0000 (14:26 -0500)
committerFrederick Bruckman <bruckman@ntp.org>
Fri, 3 Oct 2003 19:26:15 +0000 (14:26 -0500)
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

ntpd/ntp_request.c

index a137cce064fbd83aa6d6dffad831328780e30a27..9d9d1407786e651e334ca1ea741d76e9db52745b 100644 (file)
@@ -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;