After the change on 2006-09-23 adding support for snmpd_conffile: http://www.freshports.org/commit.php?category=net-mgmt&port=net-snmp&files=yes&message_id=200609231131.k8NBV94x051193@repoman.freebsd.org .. handling of multiple snmpd.conf files is not possible using the $snmpd_conffile variable. The rc script assumes that there is only one file specified by -c: if [ ! -z "${snmpd_conffile}" -a -f ${snmpd_conffile} ]; then .. but snmpd supports specifying multiple configuration files: From the snmpd man page: -c FILE Read FILE as a configuration file (or a comma-separated list of configuration files). Note that the loaded file will only understand snmpd.conf tokens, unless the configuration type is specified in the file as described in the snmp_config man page under SWITCHING CONFIGURATION TYPES IN MID-FILE. Fix: 1) Revert to handling -c in $snmpd_flags, or 2) Parse $snmp_conffile to verify the existence of all included files. #2 is preferable, but it's tricky. '-c' expects the files to be separated by commas, but most rc parsing appears to expect tokens to be separated by spaces. A good compromise: separate them by spaces in /etc/rc.conf: snmpd_conffile='/usr/local/etc/snmp/snmpd.conf /usr/local/etc/snmp/snmpd.conf.local' and then assembling the -c parameter in the rc script. This patch has been tested with a single snmpd.conf value and two values. +for conffile in ${snmpd_conffile}; do + if [ ! -z ${conffile} -a -f ${conffile} ]; then + if [ -z ${snmpd_conffile_set} ]; then + snmpd_conffile_set="${conffile}" + else + snmpd_conffile_set="${snmpd_conffile_set},${conffile}" + fi + else + echo "snmpd configuration file $conffile not set or not found." + exit 1 + fi +done + case "${snmpd_flags}" in *-c\ *) echo "Warning: \$snmpd_flags includes -c option." \ "Please use \$snmpd_conffile instead." ;; *) - if [ ! -z "${snmpd_conffile}" -a -f ${snmpd_conffile} ]; then - snmpd_flags="-c ${snmpd_conffile} ${snmpd_flags}" - fi + snmpd_flags="-c ${snmpd_conffile_set} ${snmpd_flags}" ;; esac--5E5EhR99W6NBBKykC4OQXDLOMMexPK010flAsAtYpQucecj4 Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" --- snmpd Wed Apr 18 10:51:57 2007 +++ snmpd.new Fri May 18 09:48:18 2007 @@ -52,15 +52,26 @@ ;; esac How-To-Repeat: 1. In /etc/rc.conf, add this line: snmpd_conffile='/usr/local/etc/snmp/snmpd.conf,/usr/local/etc/snmp/snmpd.conf.local' 2. Stop and start snmpd: /usr/local/etc/rc.d/snmpd stop /usr/local/etc/rc.d/snmpd start 3. Check the log: [root@beaver /usr/local/etc/snmp]# tail /var/log/snmpd.log Warning: no access control information configured. It's unlikely this agent can serve any useful purpose in this state. Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent. NET-SNMP version 5.3.1
Responsible Changed From-To: freebsd-ports-bugs->kuriyama Over to maintainer
Note that I have now been using this patched rc script on 16 systems for the past month -- working fine. Royce
kuriyama 2007-10-27 07:20:34 UTC FreeBSD ports repository Modified files: net-mgmt/net-snmp Makefile pkg-message net-mgmt/net-snmp/files snmpd.sh.in Log: - Support multiple files in ${snmp_conffile} variable (1). - Update pkg-message to reflect recent rc.conf variable usage. PR: ports/112766 (1) Submitted by: Royce Williams<royce@alaska.net> (1) Revision Changes Path 1.146 +1 -1 ports/net-mgmt/net-snmp/Makefile 1.7 +16 -3 ports/net-mgmt/net-snmp/files/snmpd.sh.in 1.5 +2 -1 ports/net-mgmt/net-snmp/pkg-message _______________________________________________ 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"
State Changed From-To: open->closed Committed with minor modification (care about users who does not set $snmpd_conffile in rc.conf). Thanks!