Port Admin may not work properly for any non-HP and non-Cisco device

Bug #1397257 reported by Morten Brekkevold
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
High
Unassigned

Bug Description

While investigating a strange Django traceback I received from one customer installation of NAV 4.2, I found some code in Port Admin that seems to do "the wrong thing"™.

The traceback looks like this:

Traceback:
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  109. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.7/dist-packages/nav/web/portadmin/views.py" in render_trunk_edit
  467. interface)
File "/usr/lib/python2.7/dist-packages/nav/portadmin/snmputils.py" in get_native_and_trunked_vlans
  345. if bitvector[bitvector_index]:
File "/usr/lib/python2.7/dist-packages/nav/bitvector.py" in __getitem__
  71. return (self.vector[block] << shift) & 128 and 1 or 0

Exception Type: IndexError at /portadmin/trunk/4262563
Exception Value: array index out of range

Looking at the code referred in the traceback, it seems it assumes that objects of the PortList Textual Convention retrieved from Q-BRIDGE-MIB refer to interface indexes (ifIndex). This is _wrong_. The port numbers from a PortList type object are baseport numbers from the BRIDGE-MIB. The mapping from baseport numbers to interface indexes can be found in the BRIDGE-MIB::dot1dBasePortTable.

It just so happens that many HP devices map baseport numbers and interface indexes one-to-one, so this code happens to work by chance on HP devices. It will likely faily on other vendors that support writing to the Q-BRIDGE-MIB, and also on any HP device that does not number interface indexes and baseport numbers the same.

This should be investigated, the code fixed and tested on both HP devices and some other vendors that support Q-BRIDGE-MIB.

Tags: portadmin snmp
Revision history for this message
John-Magne Bredal (john-m-bredal) wrote :
Changed in nav:
milestone: none → 4.3.0
status: Confirmed → Fix Committed
Changed in nav:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.