Page MenuHomeFreeBSD

ifnet(9): split ifc_alloc_unit() (should make code a bit cleaner).
ClosedPublic

Authored by avos on Sep 30 2017, 9:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 2, 2:41 PM
Unknown Object (File)
Dec 6 2025, 11:36 PM
Unknown Object (File)
Nov 29 2025, 1:54 PM
Unknown Object (File)
Nov 28 2025, 3:36 PM
Unknown Object (File)
Nov 27 2025, 9:22 AM
Unknown Object (File)
Nov 26 2025, 5:30 PM
Unknown Object (File)
Nov 24 2025, 10:15 PM
Unknown Object (File)
Nov 23 2025, 9:22 PM
Subscribers

Details

Summary

Allocate smallest unit number from pool from ifc_alloc_unit_next() and exact unit number (if available) from ifc_alloc_unit_specific().

While here, fix potential endless loop (*unit < 0 -> alloc_unr() succeeds but ifunit() fails -> (*unit)++ and then alloc_unr_specific() fails ->(*unit) is overridden with return result (-1) and then used instead of previous unit number).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Yes (but without reassigning *unit - it will not change after alloc_unr_specific() anyway).

Can you please grab the PR? :)

This revision was automatically updated to reflect the committed changes.