Skip to content

Fixes for DH-HMAC-CHAP#3187

Merged
igaw merged 6 commits intolinux-nvme:masterfrom
hreinecke:dhchap-fixes
Mar 17, 2026
Merged

Fixes for DH-HMAC-CHAP#3187
igaw merged 6 commits intolinux-nvme:masterfrom
hreinecke:dhchap-fixes

Conversation

@hreinecke
Copy link
Collaborator

There had been some issues during libnvme merge, where the distinction between dhchap host and controller keys was not correctly maintained. And some functions had been duplicated, making the code very hard to follow.
This patchset fixes up these issues.

* ctrl->s ctrl->subsystem
* ctrl->dhchap_key ctrl->dhchap_host_key
* ctrl->dhchap_host_key ctrl->dhchap_host_key
* ctrl->dhchap_ctrl_key ctrl->dhchap_key

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hreinecke — For consistency, it might make sense to have the Python ctrl_key match the C definition. Backward compatibility shouldn’t be a concern since this is a major release, and nvme-stas is already planning a corresponding major release for nvme-cli 3.0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'm more than happy to update the SWIG interface, too.

@hreinecke hreinecke force-pushed the dhchap-fixes branch 2 times, most recently from e60e59e to 431e658 Compare March 17, 2026 11:37
During merge two sets of discovery functions had been created with
identical content. Delete one set.

Signed-off-by: Hannes Reinecke <hare@suse.de>
@hreinecke hreinecke force-pushed the dhchap-fixes branch 3 times, most recently from 4bcafb6 to ad1d899 Compare March 17, 2026 12:21
There are two dhchap keys, a 'host' and a 'ctrl' key. Additionally,
the libnvme interface prefixes function calls with 'nvme_ctrl_XX'
and 'nvme_host_XX', depending on whether the first argument is a
controller or a host.
But that means that the function 'nvme_ctrl_dhchap_key' does _not_
refer to the dhchap ctrl key, but in fact to the dhchap host key.
So to avoid all confusion make the naming consistent, and use the
'_host_key' suffix for all functions referring to the dhchap host
key, and '_ctrl_key' to all functions referring to the dhchap ctrl key.

Which, incidentally, uncovered quite a few mixups.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Update dhchap key options when calling __create_discovery_ctrl().

Signed-off-by: Hannes Reinecke <hare@suse.de>
When we have a unique discovery controller we can use dhchap authentication,
so remove the limitations and ensure we're only setting the dhchap host key
when a unique discovery controller is referenced.

Signed-off-by: Hannes Reinecke <hare@suse.de>
@hreinecke hreinecke force-pushed the dhchap-fixes branch 2 times, most recently from f68416e to c8aad19 Compare March 17, 2026 12:48
There already is an accessor function nvme_ctrl_get_traddr(), so use that
instead and drop the old function.

Signed-off-by: Hannes Reinecke <hare@suse.de>
The accessor functions already have implementations for the various
nvme subsystem accessors, so drop them from tree.c

Signed-off-by: Hannes Reinecke <hare@suse.de>
@igaw igaw merged commit cd3c691 into linux-nvme:master Mar 17, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants