[Bug 281701] net/isc-dhcp44-server: restart fails with certain values of dhcpd_flags

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 25 Sep 2024 03:38:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281701

            Bug ID: 281701
           Summary: net/isc-dhcp44-server: restart fails with certain
                    values of dhcpd_flags
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: zi@FreeBSD.org
          Reporter: cross+freebsd@distal.com
             Flags: maintainer-feedback?(zi@FreeBSD.org)
          Assignee: zi@FreeBSD.org

With the following value in my /etc/rc.conf, "service isc-dhcpd restart" will
fail due to invalid command line arguments.

dhcpd_flags="-4 -q"

For some reason, "stop" and "start" both work.  But, "restart" invokes
dhcpd_checkconfig() which performs a sed that breaks the above value of
dhcpd_flags.

Portion of sh -x of the restart operation shows the problem:

+ rc_flags='-4 -q -cf /usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases
-pf /var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2 -cf
/usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases -pf
/var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2’
+ rc_flags_mod='-4 -q -cf /usr/local/etc/dhcpd.conf -lf
/var/db/dhcpd/dhcpd.leases -pf /var/run/dhcpd/dhcpd.pid -user dhcpd -group
dhcpd int1 int2 -cf /usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases
-pf /var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2’
+ echo '-4 -q -cf /usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases -pf
/var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2 -cf
/usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases -pf
/var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2’
+ sed -Ee 's/(^-q | -q | -q$)//‘
+ rc_flags_mod='-4-cf /usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases
-pf /var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2 -cf
/usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases -pf
/var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2’
+ /usr/local/sbin/dhcpd -t -q -4-cf /usr/local/etc/dhcpd.conf -lf
/var/db/dhcpd/dhcpd.leases -pf /var/run/dhcpd/dhcpd.pid -user dhcpd -group
dhcpd int1 int2 -cf /usr/local/etc/dhcpd.conf -lf /var/db/dhcpd/dhcpd.leases
-pf /var/run/dhcpd/dhcpd.pid -user dhcpd -group dhcpd int1 int2


I think replacing "-q" and surrounding spaces with "//" (empty string) is an
error.  If also removing the spaces around the argument you ae removing, you
need to replace the sequence with space to avoid the above problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.