Project

General

Profile

Actions

Bug #956

closed

# cannot be used in SNMP configuration

Added by Adam Thompson over 13 years ago. Updated over 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
SNMP
Target version:
Start date:
10/15/2010
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.0
Affected Architecture:

Description

Actual problem is a # character can't be used in any of the SNMP configuration fields. Original post follows.

Running 2.0-BETA4 (i386) built on Thu Oct 14 01:16:12 EDT 2010 FreeBSD 8.1-RELEASE-p1

Oct 15 15:11:44 pfsense snmpd44594: unexpected character 0xa
Oct 15 15:11:44 pfsense snmpd44594: in file /var/etc/snmpd.conf line 25
Oct 15 15:11:44 pfsense snmpd44594: error in config file

Unsurprisingly, "bsnmpd" service always shows "stopped".

Don't know a lot about this config file's syntax, but on line 9, changing

system := 1     # pfSense
to
system := "1" # pfSense

at least allows bsnmpd to start. That fix doesn't make sense to me, but it works anyway. Deleting the comment also seems to do the trick. This might relate to the way bsnmpd parses its config file - if everything after a ":=" is copied verbatim and comments ignored...?

Actions #1

Updated by Pierre POMES over 13 years ago

Hi Adam,

I just upgraded to the latest snapshot and I cannot reproduce the problem.

Can you give me the "snmpd" section of your config file (/cf/conf/config.xml) ?

Thanks,
Pierre

Actions #2

Updated by Adam Thompson over 13 years ago

Just figured it out. Don't use "#" characters in any of the fields...

(I had the address set to "#200-135 Innovation Dr.", a common short way of saying "Suite 200, 135 Innovation Drive" here.)

Actions #3

Updated by Chris Buechler over 13 years ago

  • Subject changed from snmpd: unexpected character 0xa in file /var/etc/snmpd.conf to # cannot be used in SNMP configuration
  • Category changed from Unknown to SNMP
Actions #4

Updated by Pierre POMES over 13 years ago

Chris,

The man page of bsnmp deals with '#' in config file:

   VARIABLE ASSIGNMENTS
     Variable assignments can take one of two forms:

       variable := string
       variable ?= string

     The string reaches from the first non-blank character after the equal
     sign until the first new line or "#" character.  In the first case the
     string is assigned to the variable unconditionally, in the second case
     the variable is only assigned if it does not exist yet.

So I suggest to replace all "#" by "_" when generating snmpd.conf. This could apply to system location, system contact, read community, and snmp trap string (ie : all strings in the screen).

Are you ok with this ?
Pierre

Actions #5

Updated by Chris Buechler over 13 years ago

That's fine, though it'd be easier and fine to just throw an input validation error if any of the fields contain #

Actions #6

Updated by Pierre POMES over 13 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

You are right. Fix commited in the screen.

Actions #7

Updated by Chris Buechler over 13 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF