Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2013 15:25:58 GMT
From:      Fabian Wenk <fabian@wenks.ch>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/180324: [PATCH] net-mgmt/ipv6mon modified rc.d script for multiple interfaces
Message-ID:  <201307051525.r65FPwYM070085@oldred.freebsd.org>
Resent-Message-ID: <201307051530.r65FU0SV097784@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         180324
>Category:       ports
>Synopsis:       [PATCH] net-mgmt/ipv6mon modified rc.d script for multiple interfaces
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 05 15:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Fabian Wenk
>Release:        9.1-RELEASE-p4
>Organization:
>Environment:
FreeBSD superman.wenks.ch 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4 #3 r251905: Tue Jun 18 10:41:28 CEST 2013     root@superman.wenks.ch:/usr/obj/usr/src/sys/SUPERMAN  amd64
>Description:
I modified the rc.d/ipv6mon script to be able to start multiple instances of ipv6mon when multiple interfaces are present on the system.

Explanation on how to use it is as comment in the script itself.

Patch is attached.
>How-To-Repeat:
n/a
>Fix:
Apply the attached patch.

Patch attached with submission follows:

diff -ru ipv6mon.orig/files/ipv6mon.in ipv6mon/files/ipv6mon.in
--- ipv6mon.orig/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


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307051525.r65FPwYM070085>