Skip to content

Commit

Permalink
Include all interface types from RFC 3635
Browse files Browse the repository at this point in the history
Because:

- Although RFC 3635 specifies that implementations MUST use
  ifType=ethernetCsmacd(6) for all ethernet-like interface types, many
  fielded implementations have incorrectly used other values that were
  never reserved by the IETF.
- D-Link is one such vendor, where interfaces would not be listed in the
  room interface list because of this.

Fixes Uninett#2280
  • Loading branch information
lunkwill42 committed May 10, 2021
1 parent a323e01 commit f355860
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions python/nav/web/info/room/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
RACK_CENTER: 'center',
RACK_RIGHT: 'right',
}
# See section 3.2.4 of RFC 3635:
ETHERNET_INTERFACE_TYPES = (
6, # ethernetCsmacd
62, # fastEther
69, # fastEtherFX
117, # gigabitEthernet
)

_logger = logging.getLogger('nav.web.info.room')

Expand Down Expand Up @@ -202,8 +209,11 @@ def render_netboxes(request, roomid):

# Filter interfaces on iftype and add fast last_cam lookup
for netbox in netboxes:
netbox.interfaces = netbox.interface_set.filter(
iftype=6).order_by("ifindex").extra(select=cam_query)
netbox.interfaces = (
netbox.interface_set.filter(iftype__in=ETHERNET_INTERFACE_TYPES)
.order_by("ifindex")
.extra(select=cam_query)
)

return render(
request,
Expand Down

0 comments on commit f355860

Please sign in to comment.