Blame SOURCES/ntpstat-compat.patch

9e87e2
diff -up ntp-4.2.6p5/ntpstat-0.5/ntpstat.compat ntp-4.2.6p5/ntpstat-0.5/ntpstat
9e87e2
--- ntp-4.2.6p5/ntpstat-0.5/ntpstat.compat	2018-03-20 16:02:33.000000000 +0100
9e87e2
+++ ntp-4.2.6p5/ntpstat-0.5/ntpstat	2019-01-11 16:52:04.003167878 +0100
9e87e2
@@ -116,6 +116,7 @@ get_ntpd_state() {
9e87e2
     disp=$(parse_rv_field "$output" "rootdisp")
9e87e2
     distance=$(echo "$delay $disp" | awk '{ printf "%.3f", $1 / 2.0 + $2 }')
9e87e2
 
9e87e2
+    : <<'EOF'
9e87e2
     syspeer_id=$("${NTPQ[@]}" -c associations 2> /dev/null |\
9e87e2
         grep 'sys\.peer' | awk '{ print $2 }') || return 4
9e87e2
     output=$("${NTPQ[@]}" -c "rv $syspeer_id" 2> /dev/null) || return 5
9e87e2
@@ -124,6 +125,19 @@ get_ntpd_state() {
9e87e2
         address=$(parse_rv_field "$output" "srcadr")
9e87e2
     fi
9e87e2
     poll=$(parse_rv_field "$output" "hpoll")
9e87e2
+EOF
9e87e2
+
9e87e2
+    # bug compatibility with original EL7 ntpstat
9e87e2
+    # - refid interpretted as IP address
9e87e2
+    # - tc interpretted as poll
9e87e2
+    # - code 1 (no drift file in NTPv4) printed as server restart in NTPv3
9e87e2
+    address=$(parse_rv_field "$output" "refid")
9e87e2
+    poll=$(parse_rv_field "$output" "tc")
9e87e2
+    local code=$(parse_rv_field "$output" "status" | \
9e87e2
+        awk '{ print and(strtonum($1), 0xf) }')
9e87e2
+    if [ "$leap" -eq 3 ] && [ "$code" -eq 1 ]; then
9e87e2
+        leap=4
9e87e2
+    fi
9e87e2
 
9e87e2
     echo "$leap,$source,$address,$stratum,$distance,$poll"
9e87e2
 }
9e87e2
@@ -176,6 +190,9 @@ if [ "$leap" -ge 0 -a "$leap" -le 2 ]; t
9e87e2
     fi
9e87e2
 else
9e87e2
     printf "unsynchronised\n"
9e87e2
+    if [ "$leap" -eq 4 ]; then
9e87e2
+        printf "  time server re-starting\n"
9e87e2
+    fi
9e87e2
     status=1
9e87e2
 fi
9e87e2