Bug 583807 - linkUpDownNotifications does not behave as described in snmpd.conf man page
Summary: linkUpDownNotifications does not behave as described in snmpd.conf man page
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: net-snmp
Version: 5.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Safranek
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-19 19:10 UTC by Jeff Bastian
Modified: 2018-11-14 20:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-21 09:10:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch for link notification (1.34 KB, patch)
2010-04-19 21:30 UTC, Jeff Bastian
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1076 0 normal SHIPPED_LIVE net-snmp bug fix and enhancement update 2011-07-21 09:07:58 UTC

Description Jeff Bastian 2010-04-19 19:10:34 UTC
Description of problem:
snmpd.conf's linkUpDownNotifications does not report ifIndex, ifAdminStatus,
and ifOperStatus as it should.

The snmpd.conf(5) man page indicates that linkUpDownNotifications "is 
exactly equivalent to the configuration:"
  notificationEvent linkUpTrap   linkUp   ifIndex ifAdminStatus ifOperStatus
  notificationEvent linkDownTrap linkDown ifIndex ifAdminStatus ifOperStatus
  monitor -r 60 -e linkUpTrap   "Generate linkUp" ifOperStatus != 2
  monitor -r 60 -e linkDownTrap "Generate linkDown" ifOperStatus == 2

However, the notifications from linkUpDownNotifications are missing the
data on ifIndex, ifAdminStatus, and ifOperStatus.

Version-Release number of selected component (if applicable):
net-snmp-5.3.2.2-9.el5
net-snmp-libs-5.3.2.2-9.el5
net-snmp-perl-5.3.2.2-9.el5
net-snmp-utils-5.3.2.2-9.el5

How reproducible:
every time

Steps to Reproduce:
1. Create and bring up a virtual interface
ifconfig eth0:0 172.31.19.19 netmask 255.255.0.0 up

2. Add these lines to /etc/snmp/snmpd.conf
agentSecName root
rouser root
trapsink 127.0.0.1 public 162
linkUpDownNotifications yes

3. Start snmpd and snmptrapd
service snmpd start
service snmptrapd start

4. Bring eth0:0 down
ifconfig eth0:0 down

5. Wait up to 60 seconds and you will find this in /var/log/messages 
   (wrapped for readability)
Apr 19 13:55:53 r2d2 snmptrapd[22505]: 2010-04-19 13:55:53 
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:35239)
    TRAP, SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Down Trap (0) Uptime: 0:01:00.11
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10

6. Bring eth0:0 back up again
ifconfig eth0:0 172.31.19.19 netmask 255.255.0.0 up

7. After another 60 seconds or so you'll find
Apr 19 13:56:53 r2d2 snmptrapd[22505]: 2010-04-19 13:56:53
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:35239)
    TRAP, SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:02:00.11
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10

8. Modify snmpd.conf as shown and restart snmpd
#linkUpDownNotifications yes
notificationEvent  linkUpTrap    linkUp   ifIndex ifAdminStatus ifOperStatus
notificationEvent  linkDownTrap  linkDown ifIndex ifAdminStatus ifOperStatus
monitor  -r 60 -e linkUpTrap   "Generate linkUp" ifOperStatus != 2
monitor  -r 60 -e linkDownTrap "Generate linkDown" ifOperStatus == 2

9. Repeat steps to bring eth0:0 down/up.  The new traps look like
Apr 19 14:09:57 r2d2 snmptrapd[22505]: 2010-04-19 14:09:57 
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:34151)
    TRAP, SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Down Trap (0) Uptime: 0:00:30.12
    IF-MIB::ifIndex.3 = INTEGER: 3
    IF-MIB::ifAdminStatus.3 = INTEGER: down(2)
    IF-MIB::ifOperStatus.3 = INTEGER: down(2)
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 
Apr 19 14:10:27 r2d2 snmptrapd[22505]: 2010-04-19 14:10:27
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:34151)
    TRAP, SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.12
    IF-MIB::ifIndex.1 = INTEGER: 1
    IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
    IF-MIB::ifOperStatus.1 = INTEGER: up(1)
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10

Actual results:
With linkUpDownNotifications, these are missing:
    IF-MIB::ifIndex.3 = INTEGER: 3
    IF-MIB::ifAdminStatus.3 = INTEGER: down(2)
    IF-MIB::ifOperStatus.3 = INTEGER: down(2)

Expected results:
linkUpDownNotifications include ifIndex, ifAdminStatus, and ifOperStatus.

Additional info:

Comment 1 Jeff Bastian 2010-04-19 20:02:25 UTC
From net-snmp-5.3.2.2/agent/mibgroup/disman/event/mteTriggerConf.c

void
parse_linkUpDown_traps(const char *token, char *line)
{
    /*
     * XXX - This isn't strictly correct according to the
     *       definitions in IF-MIB, but will do for now.
     */
    if (strncmp( line, "yes", 3) == 0) { 
        DEBUGMSGTL(("disman:event:conf", "Registering linkUpDown traps\n"));

        parse_mteMonitor("monitor",
            "-r 60 -S -e _linkUp   \"linkUp\"   ifOperStatus != 2");
        parse_mteMonitor("monitor",
            "-r 60 -S -e _linkDown \"linkDown\" ifOperStatus == 2");
    } 
}



The latest upstream code has not changed.
http://net-snmp.svn.sourceforge.net/viewvc/net-snmp/tags/Ext-5-4-3-rc2/net-snmp/agent/mibgroup/disman/event/mteTriggerConf.c?revision=18476&view=markup&pathrev=18476#l_731

Comment 2 Jeff Bastian 2010-04-19 21:30:30 UTC
Created attachment 407685 [details]
patch for link notification

The attached patch is a bit of a hack but it seems to work.

With this patch and the single line 'linkUpDownNotifications yes' in the snmpd.conf file, the logs now contain all the details:

Apr 19 16:59:21 r2d2 snmptrapd[23480]: 2010-04-19 16:59:21
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP,
    SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Down Trap (0) Uptime: 0:00:30.14
    IF-MIB::ifIndex.3 = INTEGER: 3
    IF-MIB::ifAdminStatus.3 = INTEGER: down(2)
    IF-MIB::ifOperStatus.3 = INTEGER: down(2)
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 
Apr 19 16:59:51 r2d2 snmptrapd[23480]: 2010-04-19 16:59:51
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP,
    SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.13
    IF-MIB::ifIndex.1 = INTEGER: 1
    IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
    IF-MIB::ifOperStatus.1 = INTEGER: up(1)
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 
Apr 19 16:59:51 r2d2 snmptrapd[23480]: 2010-04-19 16:59:51
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP,
    SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.13
    IF-MIB::ifIndex.2 = INTEGER: 2
    IF-MIB::ifAdminStatus.2 = INTEGER: up(1)
    IF-MIB::ifOperStatus.2 = INTEGER: up(1)
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 
Apr 19 16:59:51 r2d2 snmptrapd[23480]: 2010-04-19 16:59:51
    r2d2.example.com [10.10.58.144] (via UDP: [127.0.0.1]:39886) TRAP,
    SNMP v1, community public
    NET-SNMP-MIB::netSnmpAgentOIDs.10 Link Up Trap (0) Uptime: 0:01:00.13
    IF-MIB::ifIndex.4 = INTEGER: 4
    IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
    IF-MIB::ifOperStatus.4 = INTEGER: up(1)
    SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10

Comment 6 Jan Safranek 2010-04-20 11:18:46 UTC
This bug seems to be fixed differently upstream: http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?view=rev&revision=16984

I'll test if it works.

Comment 12 errata-xmlrpc 2011-07-21 09:10:19 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1076.html

Comment 13 errata-xmlrpc 2011-07-21 12:21:45 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1076.html


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