git: 6725d1053614 - main - net/isc-dhcp44-server: Fix checkconfig command.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Oct 2024 10:45:25 UTC
The branch main has been updated by des: URL: https://cgit.FreeBSD.org/ports/commit/?id=6725d10536142ea378a9207aecb99c2d2e1a9229 commit 6725d10536142ea378a9207aecb99c2d2e1a9229 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2024-10-02 10:37:30 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2024-10-02 10:37:30 +0000 net/isc-dhcp44-server: Fix checkconfig command. This adds an undocumented -Q flag which cancels out any -q option that may be present in dhcpd_flags, avoiding the need for a fragile sed command. It also adds a comment explaining why we are running the check twice and what the -q and -Q are for. PR: 281701 --- net/isc-dhcp44-server/Makefile | 2 +- net/isc-dhcp44-server/files/isc-dhcpd.in | 19 +++++++++---------- net/isc-dhcp44-server/files/patch-server_dhcpd.c | 12 ++++++++++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/net/isc-dhcp44-server/Makefile b/net/isc-dhcp44-server/Makefile index b25044874a60..208d09a1191f 100644 --- a/net/isc-dhcp44-server/Makefile +++ b/net/isc-dhcp44-server/Makefile @@ -19,7 +19,7 @@ USES= cpe gmake CPE_VENDOR= isc -PORTREVISION_SERVER= 1 +PORTREVISION_SERVER= 2 PORTREVISION_CLIENT= 1 PORTREVISION_RELAY= 1 diff --git a/net/isc-dhcp44-server/files/isc-dhcpd.in b/net/isc-dhcp44-server/files/isc-dhcpd.in index b92fad444b43..25def60b3ada 100644 --- a/net/isc-dhcp44-server/files/isc-dhcpd.in +++ b/net/isc-dhcp44-server/files/isc-dhcpd.in @@ -499,16 +499,15 @@ dhcpd_restartprecmd () dhcpd_checkconfig () { - local rc_flags_mod - setup_flags - rc_flags_mod="$rc_flags" - # Eliminate '-q' flag if it is present - case "$rc_flags" in - *-q*) rc_flags_mod=`echo "${rc_flags}" | sed -Ee 's/(^-q | -q | -q$)//'` ;; - esac - if ! ${command} -t -q ${rc_flags_mod}; then - err 1 "`${command} -t ${rc_flags_mod}` Configuration file sanity check failed" - fi + setup_flags + # Run dhcpcd -t quietly to check for errors. If this fails, + # run it again unquietly so the errors are shown to the user, + # then error out. The -q and -Q flags need to be at the end + # to override contradictory flags in ${rc_flags}. + if ! ${command} -t ${rc_flags} -q; then + ${command} -t ${rc_flags} -Q + err 1 "Configuration file sanity check failed" + fi } rcvar=${name}_enable diff --git a/net/isc-dhcp44-server/files/patch-server_dhcpd.c b/net/isc-dhcp44-server/files/patch-server_dhcpd.c new file mode 100644 index 000000000000..17e6c79025bb --- /dev/null +++ b/net/isc-dhcp44-server/files/patch-server_dhcpd.c @@ -0,0 +1,12 @@ +--- server/dhcpd.c.orig 2022-09-28 14:39:15 UTC ++++ server/dhcpd.c +@@ -492,6 +492,9 @@ main(int argc, char **argv) { + cftest = 1; + lftest = 1; + log_perror = -1; ++ } else if (!strcmp (argv [i], "-Q")) { ++ quiet = 0; ++ quiet_interface_discovery = 0; + } else if (!strcmp (argv [i], "-q")) { + quiet = 1; + quiet_interface_discovery = 1;