Blame SOURCES/ntpstat-compat.patch

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