ports/161168: security/barnyard2 update: multi-conf might break status/restart

Michael Scheidell scheidell at secnap.net
Fri Sep 30 18:30:06 UTC 2011


>Number:         161168
>Category:       ports
>Synopsis:       security/barnyard2 update:  multi-conf might break status/restart
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 30 18:30:05 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Michael Scheidell
>Release:        7.4
>Organization:
SECNAP Network Security Corp
>Environment:
amd, etc.
>Description:
new multi-conf options for barnyard2 rc file may not support status and/or restart.

example:

barnyard2_1.conf= (something)
barnyard2_2.conf= (something else)

service barnyard status works BUT: only gives you rc0 or rc=1 depending on status of the LAST service. (ie: if 1.conf is offline, but 2.conf is running, you get rc=0 )

start, stop, reload, all seem to work.
: reload will not reload 1.conf if its offline.  this fixes that.

restart only restarts the first conf.

Additionally, this patch adds the ability to look at, monitor, start, stop, do status on a subset of *.conf.

service barnyard2 status
(status of all conf's)

service barnyard2 status 
lan:barnyard2 is running as pid 25360.
wan:barnyard2 is running as pid 25365.


this add this:

service barnyard2 status lan

service barnyard2 status lan
lan:barnyard2 is running as pid 25360.


you can start/stop, reload, restart get status on individual instances.


>How-To-Repeat:
start a multi conf barnyard2.

kill (manually) the first one.

restart/reload/status don't act like you want.
>Fix:
this patch:

Not sure if you want to bump portsrevision, no need to force people using single conf to update.  someone would only update if they needed this functionality.
maintainers decision.

parses option $2, unsets rc and pid stuff from rc.subr so restart/reload/ works.
adds 'stateful' status of rc on exit.



Patch attached with submission follows:

--- /tmp/files/barnyard2.sh.in	2011-09-30 11:36:19.000000000 -0400
+++ /files/barnyard2.sh.in	2011-09-30 14:16:30.000000000 -0400
@@ -37,13 +37,18 @@
 load_rc_config $name
 
 if [ -n "${barnyard2_rules}" ];then
+  _1=$1
+  rc=0
+  if [ $# -gt 1 ];then shift; barnyard2_rules=$*; fi
   for i in ${barnyard2_rules}; do
     echo -n "$i:"
     eval barnyard2_flags=\$barnyard2_${i}_flags
     eval pidfile=\$barnyard2_${i}_pidfile
     eval barnyard2_conf=\$barnyard2_${i}_conf
     command_args="-c $barnyard2_conf -D"
-    run_rc_command "$1"
+    run_rc_command "$_1"
+    if [ $? -ne 0 ];then rc=1 ; fi
+    unset _pidcmd _rc_restart_done
   done
 else
    run_rc_command "$1"


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list