HomeFreeBSD

nhop: hash ifnet pointer instead of if_index

Description

nhop: hash ifnet pointer instead of if_index

Yet another problem created by VIMAGE/if_vmove/epair design that
relocates ifnet between vnets and changes if_index. Since if_index
changes, nhop hash values also changes, unlink_nhop() isn't able to
find entry in hash and leaks the nhop. Since nhop references ifnet,
the latter is also leaked. As result running network tests leaks
memory on every single test that creates vnet jail.

While here, rewrite whole hash_priv() to use static initializer,
per Alexander's suggestion.

Reviewed by: melifaro

(cherry picked from commit ad2a0aec295478e750158b8985422f15deee0e54)

Details

Provenance
glebiusAuthored on Dec 4 2021, 6:05 PM
melifaroCommitted on Jan 23 2023, 10:10 PM
Parents
rG0edb2cd13d89: if_clone: rework cloning KPI
Branches
Unknown
Tags
Unknown