--- ipv6mon/files/ipv6mon.in 2013-04-02 17:46:28.000000000 +0200 +++ ipv6mon/files/ipv6mon.in 2013-07-05 17:05:56.000000000 +0200 @@ -6,13 +6,51 @@ # BEFORE: LOGIN # KEYWORD: nojail shutdown +# To use ipv6mon with multiple interfaces, the following additional steps +# are needed (example with 2 interfaces, em0 and em1): +# +# Copy the %%PREFIX%%/etc/ipv6mon.conf to %%PREFIX%%/etc/ipv6mon-em0.conf and +# to %%PREFIX%%/etc/ipv6mon-em1.conf +# In both copied config files adjust 'NetworkInterface' accordingly with em0 +# and em1 and also adjust the 'LockFile' accordingly to +# /var/run/ipv6mon-em0.pid and /var/run/ipv6mon-em1.pid. +# Add in /etc/rc.conf the additional line: +# ipv6mon_interfaces="em0 em1" + + . /etc/rc.subr name="ipv6mon" rcvar="${name}_enable" command="%%PREFIX%%/sbin/${name}" -pidfile="/var/run/${name}.pid" required_files="%%PREFIX%%/etc/${name}.conf" load_rc_config $name -run_rc_command "$1" + +case ${ipv6mon_interfaces} in + '') + pidfile="/var/run/${name}.pid" + run_rc_command "$1" + ;; + + *) + case "$1" in + *start) + for interface in ${ipv6mon_interfaces}; do + eval options=\$ipv6mon_${interface}_options + command_args="${options} -c %%PREFIX%%/etc/${name}-${interface}.conf" + pidfile="/var/run/${name}-${interface}.pid" + run_rc_command "$1" + done + ;; + + *stop) + for interface in ${ipv6mon_interfaces}; do + eval options=\$ipv6mon_${interface}_options + pidfile="/var/run/${name}-${interface}.pid" + run_rc_command "$1" + done + ;; + esac + ;; +esac