Bug 115967

Summary: enable chrooted net/isc-dhcp3-server on the FreeBSD 7.x
Product: Ports & Packages Reporter: Eygene Ryabinkin <rea-fbsd>
Component: Individual Port(s)Assignee: Tom McLaughlin <tmclaugh>
Status: Closed FIXED    
Severity: Affects Only Me CC: Joerg.Pulz
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Eygene Ryabinkin 2007-08-31 14:30:01 UTC
rc.d script for the ISC dhcpd tries to locate the mount_devfs
executable and disables the creation of the device filesystem
at the chroot directory if the binary was not found.

The reason of the error is that mount_devfs was removed from
FreeBSD 7: see src/sbin/Makefile, rev. 1.164.

Fix: Check for the FreeBSD version and do not look for mount_devfs on
7-CURRENT and later.  The following patch implements a quick check
for the first symbol of the 'uname -r'.  It might be possible to
implement more fine-grained check to catch early 7-CURRENT versions
that had mount_devfs inside, but I doubt that it worth the effort.
How-To-Repeat: 
Install FreeBSD 7, isc-dhcpd3 and try to run the daemon.  It will
warn you that 'dhcpd_devfs_enable disabled -- not available' and
dhcpd will not start because it won't see any bpf devices.
Comment 1 Eygene Ryabinkin 2007-08-31 15:24:54 UTC
Patch was not recognised as the patch by the Web interface, so
I am quoting it properly.
--- isc-dhcpd.in.patch begins here ---
--- files/isc-dhcpd.in.orig	2007-08-31 16:57:04.000000000 +0400
+++ files/isc-dhcpd.in	2007-08-31 16:58:15.000000000 +0400
@@ -354,12 +354,15 @@
 				err 1 "dhcpd_devfs_enable and dhcpd_makedev_enable" \
 				      "are mutually exclusive. enable only one!"
 			fi
+			# mount_devfs disappeared in FreeBSD 7.
+			if test `uname -r | cut -c 1` -le 6; then
 			if checkyesno dhcpd_devfs_enable &&
 			   ! ( type mount_devfs ) > /dev/null 2>&1; then
 				warn "dhcpd_devfs_enable disabled" \
 				     "-- not available"
 				dhcpd_devfs_enable=NO
 			fi
+			fi
 			if checkyesno dhcpd_makedev_enable &&
 			   ! [ -x ${__dhcpd_devdir}/MAKEDEV ]; then
 				warn "dhcpd_makedev_enable disabled" \
--- isc-dhcpd.in.patch ends here ---
-- 
Eygene
Comment 2 Edwin Groothuis freebsd_committer 2007-09-01 07:16:10 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 3 Sergey Matveychuk freebsd_committer 2007-09-05 16:11:42 UTC
2committer, who will commit it: fix an indentation in if..fi block.

-- 
Dixi.
Sem.
Comment 4 Eygene Ryabinkin 2007-09-18 07:08:35 UTC
Good day.

Per note of Sergey Matveichuk, I am attaching the properly idented
version of the patch for the rc.d script.

--- isc-dhcpd.in.patch begins here ---
--- isc-dhcpd.in.orig	2007-09-18 09:53:53.000000000 +0400
+++ isc-dhcpd.in	2007-09-18 09:54:41.000000000 +0400
@@ -354,11 +354,14 @@
 				err 1 "dhcpd_devfs_enable and dhcpd_makedev_enable" \
 				      "are mutually exclusive. enable only one!"
 			fi
-			if checkyesno dhcpd_devfs_enable &&
-			   ! ( type mount_devfs ) > /dev/null 2>&1; then
-				warn "dhcpd_devfs_enable disabled" \
-				     "-- not available"
-				dhcpd_devfs_enable=NO
+			if test `uname -r | cut -c 1` -le 6; then
+				if checkyesno dhcpd_devfs_enable &&
+				   ! ( type mount_devfs ) > /dev/null 2>&1;
+				then
+					warn "dhcpd_devfs_enable disabled" \
+					     "-- not available"
+					dhcpd_devfs_enable=NO
+				fi
 			fi
 			if checkyesno dhcpd_makedev_enable &&
 			   ! [ -x ${__dhcpd_devdir}/MAKEDEV ]; then
--- isc-dhcpd.in.patch ends here ---

Please, treat this as a gentle reminder ;)) for the maintainer that
this problem exists and it will be great to fix it before 7.0,
because some people running ISC DHCPD can move there and find that
the (almost) default configuration of dhcpd does no work anymore.
-- 
Eygene
Comment 5 Eygene Ryabinkin 2007-09-24 06:06:23 UTC
Tue, Sep 18, 2007 at 10:42:20AM +0200, Joerg Pulz wrote:
> Would you please submit the refined version of the patch as follow-up to the 
> original PR, i will then approve it ASAP.

Trying to submit the patch as the follow-up.  Doing it for the first
time in my life, so there can be errors ;))

--- isc-dhcpd.in.patch begins here ---
--- isc-dhcpd.in.orig	2007-09-18 09:53:53.000000000 +0400
+++ isc-dhcpd.in	2007-09-18 09:54:41.000000000 +0400
@@ -354,11 +354,14 @@
 				err 1 "dhcpd_devfs_enable and dhcpd_makedev_enable" \
 				      "are mutually exclusive. enable only one!"
 			fi
-			if checkyesno dhcpd_devfs_enable &&
-			   ! ( type mount_devfs ) > /dev/null 2>&1; then
-				warn "dhcpd_devfs_enable disabled" \
-				     "-- not available"
-				dhcpd_devfs_enable=NO
+			if test `uname -r | cut -c 1` -le 6; then
+				if checkyesno dhcpd_devfs_enable &&
+				   ! ( type mount_devfs ) > /dev/null 2>&1;
+				then
+					warn "dhcpd_devfs_enable disabled" \
+					     "-- not available"
+					dhcpd_devfs_enable=NO
+				fi
 			fi
 			if checkyesno dhcpd_makedev_enable &&
 			   ! [ -x ${__dhcpd_devdir}/MAKEDEV ]; then
--- isc-dhcpd.in.patch ends here ---
Comment 6 Joerg Pulz 2007-10-15 13:02:50 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

sorry for the long delay, but real life is eating my time.

To make it really short: Approved!

Kind regards and special thanks to Eygene

Joerg

- -- 
The beginning is the most important part of the work.
 				-Plato
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFHE1btSPOsGF+KA+MRAjTXAJ9b5agucF71EqyLcmUPz8A8+dT9NgCgrS/h
JpwuoLHtv3cDCzHz5WDz3lM=
=K4TE
-----END PGP SIGNATURE-----
Comment 7 Tom McLaughlin freebsd_committer 2007-11-05 17:58:39 UTC
Responsible Changed
From-To: freebsd-ports-bugs->tmclaugh

Grab
Comment 8 dfilter service freebsd_committer 2007-12-04 01:28:49 UTC
tmclaugh    2007-12-04 01:28:43 UTC

  FreeBSD ports repository

  Modified files:
    net/isc-dhcp3-server Makefile 
    net/isc-dhcp3-server/files isc-dhcpd.in 
  Log:
  Fix dhcpd_devfs_enable on 7.x and later.
  
  PR:             115967
  Submitted by:   Eygene Ryabinkin
  Approved by:    portmgr (linimon, pav), maintainer
  
  Revision  Changes    Path
  1.122     +1 -0      ports/net/isc-dhcp3-server/Makefile
  1.3       +9 -6      ports/net/isc-dhcp3-server/files/isc-dhcpd.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 9 Tom McLaughlin freebsd_committer 2007-12-04 05:38:34 UTC
State Changed
From-To: feedback->closed

Fix committed