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 Feb 22, 2022
1 parent 2da4bef commit fcc5690
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions python/nav/models/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,16 @@ class Interface(models.Model):
(DUPLEX_HALF, 'half duplex'),
)

# These are the subset of IF-MIB::ifType values NAV considers to be
# ethernet interfaces. See section 3.2.4 of RFC 3635 for the full list of
# ifType values:
ETHERNET_INTERFACE_TYPES = (
6, # ethernetCsmacd
62, # fastEther
69, # fastEtherFX
117, # gigabitEthernet
)

id = models.AutoField(db_column='interfaceid', primary_key=True)
netbox = models.ForeignKey('Netbox', on_delete=models.CASCADE, db_column='netboxid')
module = models.ForeignKey(
Expand Down
2 changes: 1 addition & 1 deletion python/nav/web/info/room/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ 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)
netbox.interface_set.filter(iftype__in=Interface.ETHERNET_INTERFACE_TYPES)
.order_by("ifindex")
.extra(select=cam_query)
)
Expand Down

0 comments on commit fcc5690

Please sign in to comment.