[Git][NTPsec/ntpsec][master] 2 commits: ntpdig: Fix steplimit option.
Matt Selsky
gitlab at mg.gitlab.com
Mon Feb 1 01:13:43 UTC 2021
Matt Selsky pushed to branch master at NTPsec / ntpsec
Commits:
7f2dd3ba by Miroslav Lichvar at 2021-01-20T17:46:14+01:00
ntpdig: Fix steplimit option.
Fix the -M/steplimit option to accept milliseconds as documented.
- - - - -
833a6769 by Miroslav Lichvar at 2021-01-20T17:46:15+01:00
Improve ntpdate script.
- Change default to step or slew with 500ms limit as classic ntpdate
- Don't pass -o (no longer supported by ntpdig)
- Initialize ADJUST variable
- Add -h option to print usage
- - - - -
2 changed files:
- attic/ntpdate
- ntpclients/ntpdig.py
Changes:
=====================================
attic/ntpdate
=====================================
@@ -24,7 +24,7 @@
# -d -d -d debugging mode (implies -q)
# -e N.N -q authdelay
# -k file -k file -k file key file
-# -o N -o N -q NTP Protocol version
+# -o N -q NTP Protocol version
# -p N -q How many samples to take
# -q default -q query/report only, don't set clock
# (implies -u for ntpdate)
@@ -40,12 +40,29 @@
#
# SPDX-License-Identifier: BSD-2-Clause
+print_help() {
+ echo "Usage: ntpdate [OPTIONS] HOST..."
+ echo
+ echo "Options:"
+ echo " -4 Force IPv4 DNS name resolution"
+ echo " -6 Force IPv6 DNS name resolution"
+ echo " -a N Specify key number for authentication"
+ echo " -b Force time step"
+ echo " -B Force time slew"
+ echo " -k FILE Specify key file"
+ echo " -q Query only"
+ echo " -s Log to syslog"
+ echo " -t N.N Specify timeout"
+ echo " -h Print help"
+}
+
PASSTHROUGH=""
+ADJUST=""
TIMEOUT="-t 1"
setclock=yes
echo=no
log=no
-while getopts 46a:bBe:k:no:p:qst:uv opt
+while getopts 46a:bBe:hk:no:p:qst:uv opt
do
case $opt in
4) PASSTHROUGH="$PASSTHROUGH -4";;
@@ -55,9 +72,10 @@ do
B) ADJUST="$ADJUST -s";;
d) PASSTHROUGH="$PASSTHROUGH -d";;
e) echo "ntpdate: -e is no longer supported." >&2;;
+ h) print_help; exit;;
k) PASSTHROUGH="$PASSTHROUGH -k $OPTARG";;
n) echo=yes;; # Echo generated command, don't execute
- o) PASSTHROUGH="$PASSTHROUGH -o $OPTARG";;
+ o) echo "ntpdate: -o is no longer supported." >&2;;
p) echo "ntpdate: -p is no longer supported." >&2;;
q) setclock=no;;
s) log=yes;;
@@ -70,7 +88,7 @@ shift $(($OPTIND - 1))
if [ "$setclock" = yes -a -z "$ADJUST" ]
then
- ADJUST="-s -j"
+ ADJUST="-s -S -M 500 -j"
fi
if [ "$echo" = yes ]
=====================================
ntpclients/ntpdig.py
=====================================
@@ -336,6 +336,7 @@ if __name__ == '__main__':
elif switch in ("-M", "--steplimit"):
errmsg = "Error: -M parameter '%s' not a number\n"
steplimit = ntp.util.safeargcast(val, int, errmsg, usage)
+ steplimit /= 1000.0
elif switch in ("-p", "--samples"):
errmsg = "Error: -p parameter '%s' not a number\n"
samples = ntp.util.safeargcast(val, int, errmsg, usage)
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/bfb31615f3cc582ce83059fadf55d39500805218...833a676938f51e531b9b42bbd04bfca4ee6be2dd
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/bfb31615f3cc582ce83059fadf55d39500805218...833a676938f51e531b9b42bbd04bfca4ee6be2dd
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20210201/ee930d08/attachment-0001.htm>
More information about the vc
mailing list