Skip to content

zebra: fix wrong hash count function call - #21512

Merged
cscarpitta merged 1 commit into
FRRouting:masterfrom
opensourcerouting:hash-count-fix
Apr 14, 2026
Merged

zebra: fix wrong hash count function call#21512
cscarpitta merged 1 commit into
FRRouting:masterfrom
opensourcerouting:hash-count-fix

Conversation

@rzalamena

@rzalamena rzalamena commented Apr 14, 2026

Copy link
Copy Markdown
Member

The Pull Requests #21263 and #21388 had conflicting changes:

  • 21263 uses hashcount (lib/hash.h implementation) to count items in a hash
  • 21388 changes the hash type being referenced in the other PR with type safe hash (lib/typesafe.h)

Since both Pull Requests got merged at nearly the same time the CI didn't have a chance to build them together.

@greptile-apps

greptile-apps Bot commented Apr 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a merge conflict between #21263 (which added hashcount() calls to count EVPN neighbor entries) and #21388 (which converted nh_table from struct hash * to a typesafe hash zebra_neigh_db_head). The fix correctly replaces hashcount(zl3vni->nh_table) with zebra_neigh_db_count(zl3vni->nh_table) throughout zebra_vxlan.c, while leaving hashcount(zl3vni->rmac_table) intact since rmac_table remains a plain struct hash *.

Confidence Score: 5/5

Safe to merge β€” targeted, correct bug fix with no side effects.

Single-file change that replaces hashcount() with the correct typesafe zebra_neigh_db_count() for nh_table, which was converted to a typesafe hash by PR #21388. rmac_table (a plain struct hash *) correctly retains hashcount(). No logic errors, no missing cases, and no P1/P0 findings.

No files require special attention.

Important Files Changed

Filename Overview
zebra/zebra_vxlan.c Replaces incorrect hashcount(zl3vni->nh_table) calls with zebra_neigh_db_count(zl3vni->nh_table) to match the typesafe hash type introduced by PR #21388; rmac_table (still struct hash *) correctly retains hashcount().

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[zebra_l3vni struct] --> B["rmac_table\n(struct hash *)"]
    A --> C["nh_table\n(zebra_neigh_db_head β€” typesafe)"]

    B --> D["hashcount(rmac_table)\nβœ… correct for struct hash *"]
    C --> E["hashcount(nh_table)\n❌ BEFORE β€” wrong type"]
    C --> F["zebra_neigh_db_count(nh_table)\nβœ… AFTER β€” correct for typesafe hash"]

    style E fill:#ffcccc,stroke:#cc0000
    style F fill:#ccffcc,stroke:#00cc00
    style D fill:#ccffcc,stroke:#00cc00
Loading

Reviews (1): Last reviewed commit: "zebra: fix wrong hash count function cal..." | Re-trigger Greptile

The Pull Requests FRRouting#21263 and FRRouting#21388 had conflicting changes:
- 21263 uses `hashcount` (lib/hash.h implementation) to count items in a
  hash
- 21388 changes the hash type being referenced in the other PR with type
  safe hash (lib/typesafe.h)

Since both Pull Requests got merged at nearly the same time the CI
didn't have a chance to build them together.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
@cscarpitta
cscarpitta merged commit aa488b2 into FRRouting:master Apr 14, 2026
23 checks passed
@rzalamena
rzalamena deleted the hash-count-fix branch April 14, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants