Page MenuHomeFreeBSD

libnvmf: Add nvmf_nqn_valid_strict() function
ClosedPublic

Authored by jhb on Jan 31 2025, 8:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 29, 12:42 AM
Unknown Object (File)
Tue, Jul 22, 11:29 PM
Unknown Object (File)
Mon, Jul 21, 7:53 AM
Unknown Object (File)
Sat, Jul 19, 7:47 PM
Unknown Object (File)
Sun, Jul 13, 3:02 PM
Unknown Object (File)
Wed, Jul 9, 1:55 PM
Unknown Object (File)
Jul 2 2025, 4:57 AM
Unknown Object (File)
Jun 30 2025, 10:47 AM
Subscribers

Details

Summary

This moves the checks previously under #ifdef STRICT in
nvmf_nqn_valid() into a separate helper for userland. This
requires that the NQN starts with "nqn.YYYY-MM." followed by at
least one additional character.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jan 31 2025, 8:16 PM

The only improvement I could suggest would be to factor out the guts of both functions into a third, private function. That would save callers of nvmf_nqn_valid_strict from calling strlen twice. But it's probably premature optimization.

This revision is now accepted and ready to land.Jan 31 2025, 10:05 PM

The only improvement I could suggest would be to factor out the guts of both functions into a third, private function. That would save callers of nvmf_nqn_valid_strict from calling strlen twice. But it's probably premature optimization.

Yeah, I thought about it and initially I had made the common routine in the header take a bool strict argument, but the kernel never uses the strict version, only ctld(8) in userspace when parsing a config file (which is not a hot path).

This revision was automatically updated to reflect the committed changes.