I'd like to add a new option to ntpd however I couldn't find how to generate ntpd/ntpd-opts{.c, .h}
after adding some lines to ntpd/ntpdbase-opts.def
e.g.,
$ git diff ntpd/ntpdbase-opts.def
diff --git a/ntpd/ntpdbase-opts.def b/ntpd/ntpdbase-opts.def
index 66b953528..a790cbd51 100644
--- a/ntpd/ntpdbase-opts.def
b/ntpd/ntpdbase-opts.def
@@ -479,3 479,13 @@ flag = {
the server to be discovered via mDNS client lookup.
_EndOfDoc_;
};
flag = {
name = foo;
value = F;
arg-type = number;
descrip = "Some new option";
doc = <<- _EndOfDoc_
For testing purpose only.
_EndOfDoc_;
};
Do you have any ideas?
CodePudding user response:
how to generate ntpd/ntpd-opts{.c, .h} after adding some lines to ntpd/ntpdbase-opts.def
It is just in build scripts. Just compile https://github.com/ntp-project/ntp/blob/master-no-authorname/INSTALL#L30 it normally and make will pick it up.
https://github.com/ntp-project/ntp/blob/master-no-authorname/ntpd/Makefile.am#L304
https://github.com/ntp-project/ntp/blob/master-no-authorname/ntpd/Makefile.am#L183
CodePudding user response:
In addition to @KamilCuk's answer, we need to do the following to add custom options:
- Edit
*.def
file - Run
bootstrap
script - Run
configure
script with--disable-local-libopts
option - Run make
For example,
$ git diff ntpd/ntpdbase-opts.def
diff --git a/ntpd/ntpdbase-opts.def b/ntpd/ntpdbase-opts.def
index 66b953528..a790cbd51 100644
--- a/ntpd/ntpdbase-opts.def
b/ntpd/ntpdbase-opts.def
@@ -479,3 479,13 @@ flag = {
the server to be discovered via mDNS client lookup.
_EndOfDoc_;
};
flag = {
name = foo;
value = F;
arg-type = number;
descrip = "Some new option";
doc = <<- _EndOfDoc_
For testing purpose only.
_EndOfDoc_;
};
This change yields:
$ ./ntpd --help
ntpd - NTP daemon program - Ver. 4.2.8p15
Usage: ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
[ <server1> ... <serverN> ]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
- prohibits the option 'ipv6'
...
-F Num foo Some new option
opt version output version information and exit
-? no help display extended usage information and exit
-! no more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
...