From 55908109a4362ed9f622fdfb42159be1ca8da5b1 Mon Sep 17 00:00:00 2001 From: ajacoutot <> Date: Sat, 19 Dec 2015 13:45:12 +0000 Subject: [PATCH] Child will not return a config parsing error to the parent so rc.d will lie and tell you that the daemon succesfully started; prevent this by running a config check first. Note that we only do this for those particular daemons, not all that support a config test mode. ok benno@ phessler@ --- src/etc/rc.d/bgpd | 7 ++++++- src/etc/rc.d/httpd | 7 ++++++- src/etc/rc.d/iked | 6 ++++-- src/etc/rc.d/relayd | 7 ++++++- src/etc/rc.d/vmd | 7 ++++++- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/etc/rc.d/bgpd b/src/etc/rc.d/bgpd index 48a09f3c..cb78ce58 100644 --- a/src/etc/rc.d/bgpd +++ b/src/etc/rc.d/bgpd @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: bgpd,v 1.1 2011/07/06 18:55:36 robert Exp $ +# $OpenBSD: bgpd,v 1.2 2015/12/19 13:45:12 ajacoutot Exp $ daemon="/usr/sbin/bgpd" @@ -8,4 +8,9 @@ daemon="/usr/sbin/bgpd" pexp="bgpd: parent.*" +# child will not return a config parsing error to the parent +rc_pre() { + ${daemon} -n ${daemon_flags} +} + rc_cmd $1 diff --git a/src/etc/rc.d/httpd b/src/etc/rc.d/httpd index 406f46ea..50be2367 100644 --- a/src/etc/rc.d/httpd +++ b/src/etc/rc.d/httpd @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: httpd,v 1.3 2014/07/22 17:37:16 reyk Exp $ +# $OpenBSD: httpd,v 1.4 2015/12/19 13:45:12 ajacoutot Exp $ daemon="/usr/sbin/httpd" @@ -8,4 +8,9 @@ daemon="/usr/sbin/httpd" pexp="httpd: parent.*" +# child will not return a config parsing error to the parent +rc_pre() { + ${daemon} -n ${daemon_flags} +} + rc_cmd $1 diff --git a/src/etc/rc.d/iked b/src/etc/rc.d/iked index ee4aace0..42faa3a7 100644 --- a/src/etc/rc.d/iked +++ b/src/etc/rc.d/iked @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: iked,v 1.2 2015/12/19 10:09:04 ajacoutot Exp $ +# $OpenBSD: iked,v 1.3 2015/12/19 13:45:12 ajacoutot Exp $ daemon="/sbin/iked" @@ -11,7 +11,9 @@ pexp="iked: parent.*" rc_pre() { [ X"${sasyncd_flags}" != X"NO" ] && \ daemon_flags="-S ${daemon_flags}" - return 0 + #return 0 + # child will not return a config parsing error to the parent + ${daemon} -n ${daemon_flags} } rc_cmd $1 diff --git a/src/etc/rc.d/relayd b/src/etc/rc.d/relayd index 6c73c12b..07b7971e 100644 --- a/src/etc/rc.d/relayd +++ b/src/etc/rc.d/relayd @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: relayd,v 1.1 2011/07/06 18:55:36 robert Exp $ +# $OpenBSD: relayd,v 1.2 2015/12/19 13:45:12 ajacoutot Exp $ daemon="/usr/sbin/relayd" @@ -8,4 +8,9 @@ daemon="/usr/sbin/relayd" pexp="relayd: parent.*" +# child will not return a config parsing error to the parent +rc_pre() { + ${daemon} -n ${daemon_flags} +} + rc_cmd $1 diff --git a/src/etc/rc.d/vmd b/src/etc/rc.d/vmd index b5620e1e..a86631a4 100644 --- a/src/etc/rc.d/vmd +++ b/src/etc/rc.d/vmd @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: vmd,v 1.2 2015/12/16 14:21:28 jturner Exp $ +# $OpenBSD: vmd,v 1.3 2015/12/19 13:45:12 ajacoutot Exp $ daemon="/usr/sbin/vmd" @@ -8,4 +8,9 @@ daemon="/usr/sbin/vmd" pexp="vmd: parent.*" +# child will not return a config parsing error to the parent +rc_pre() { + ${daemon} -n ${daemon_flags} +} + rc_cmd $1