Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 886468 - snmpd does not report error when clientaddr <ip>:<port> cannot bind to the specified port
snmpd does not report error when clientaddr <ip>:<port> cannot bind to the sp...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: net-snmp (Show other bugs)
6.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Jan Safranek
Dalibor Pospíšil
:
Depends On: 840861
Blocks: 1086925
  Show dependency treegraph
 
Reported: 2012-12-12 06:04 EST by Dalibor Pospíšil
Modified: 2015-07-22 03:22 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: In one of the previous Net-SNMP updates we extended 'clientaddr' and 'clientaddrUsesPort' configuration options to allow system administrators to set specific port for outgoing SNMP requests. When this port number was not usable, for example it was already used, SNMP tools and daemons did not report any error and used random port for outgoing requests. Consequence: SNMP requests were sent from unexpected ports, while the system administrator did not know about it. Fix: Report an error that requested port cannot be used. Result: System admin knows that something is wrong.
Story Points: ---
Clone Of: 840861
: 1086925 (view as bug list)
Environment:
Last Closed: 2015-07-22 03:22:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:1385 normal SHIPPED_LIVE Moderate: net-snmp security and bug fix update 2015-07-20 14:07:39 EDT

  None (edit)
Description Dalibor Pospíšil 2012-12-12 06:04:41 EST
+++ This bug was initially created as a clone of Bug #840861 +++

Description of problem:
Having following /etc/snmp/snmpd.conf file, if snmpd fails to bind the specified clientaddr port, it quietly uses random port instead. It should at least report some error to system log.

rocommunity public
[snmp] clientaddr 127.0.0.1:30000
trapsink localhost public

Version-Release number of selected component (if applicable):
net-snmp-5.5-41.el6

How reproducible:
always

Steps to Reproduce:
1. vi /etc/snmp/snmpd.conf
2. nc -ul localhost 30000 (or have SELinux in enforcing mode)
3. service snmpd start
  
Actual results:
- traps are sent from random port and not from port 30000, which is taken by 'nc'
- system log is empty

Expected results:
- system log should show an error
Comment 1 Dalibor Pospíšil 2012-12-12 11:22:40 EST
The trap is actually sent on IPv6 if the port 30000 is already used on IPv4. It seems like there is some kind of fallback to IPv6 implemented.

17:10:29.409052 IP6 (hlim 64, next-header UDP (17) payload length: 52) ::1.46569 > ::1.162: [udp sum ok]  { SNMPv1 { Trap(29)  .1.3.6.1.4.1.8072.3.2.10 192.168.122.206 coldStart 5 } }
Comment 2 Jan Safranek 2012-12-13 04:21:07 EST
You should have '[snmp] clientaddrUsesPort yes' in your snmpd.conf. With that, no trap is sent and I get in /var/log/messages:

Dec 13 11:17:17 rhel6 snmpd[29457]: getaddrinfo("localhost", NULL, ...): No address associated with hostname
Dec 13 11:17:17 rhel6 snmpd[29457]: snmpd: create_trap_session: 
Dec 13 11:17:17 rhel6 snmpd[29457]: /etc/snmp/snmpd.conf: line 2: Error: cannot create trap2sink: localhost
Dec 13 11:17:17 rhel6 snmpd[29457]: net-snmp: 1 error(s) in config file(s)


I admit the first message is quite confusing. RHEL 6.4 misses patch fixed in 5.9 as #840861.
Comment 3 RHEL Product and Program Management 2012-12-17 01:47:17 EST
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 5 Jan Safranek 2015-01-14 06:39:41 EST
snmpd will now log "Cannot bind for clientaddr 127.0.0.1:30000: Address already in use"
Comment 8 errata-xmlrpc 2015-07-22 03:22:05 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1385.html

Note You need to log in before you can comment on or make changes to this bug.