Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nsec3-hash command. #6

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open

Add nsec3-hash command. #6

wants to merge 49 commits into from

Conversation

ximon18
Copy link
Member

@ximon18 ximon18 commented Oct 15, 2024

Note: A minimal working version of this command already existed in main but used code copied from domain rather than depending on domain.

Currently depends on domain branch initial-nsec3-generation, see NLnetLabs/domain#416.

Contains several kinds of tests:

  • Unit tests.
  • Integration tests in tests/ (ignored by default) that compare outputs to a host installed ldns-nsec3-hash command.

Fuzz tests and man page changes were moved out to #24 and #25.

@ximon18 ximon18 marked this pull request as draft October 15, 2024 14:44
@ximon18 ximon18 marked this pull request as ready for review October 17, 2024 13:32
@ximon18 ximon18 mentioned this pull request Oct 17, 2024
12 tasks
@ximon18 ximon18 changed the base branch from main to add-ci-workflow October 30, 2024 00:09
@ximon18 ximon18 changed the base branch from add-ci-workflow to main October 30, 2024 00:10
@ximon18 ximon18 changed the title Use domain crate NSEC3 support. Add nsec3-hash command. Nov 12, 2024
ldns-nsec3-hash Outdated Show resolved Hide resolved
src/commands/nsec3hash.rs Show resolved Hide resolved
src/commands/nsec3hash.rs Show resolved Hide resolved
tests/vs-ldns.rs Outdated Show resolved Hide resolved
tests/vs-ldns.rs Outdated Show resolved Hide resolved
doc/manual/source/conf.py Outdated Show resolved Hide resolved
doc/manual/source/man/dnst-nsec3-hash.rst Outdated Show resolved Hide resolved
ximon18 and others added 4 commits November 12, 2024 20:28
…l tree slightly to allow args to be parsed from within a module without knowing how arg parsing works for dnst vs ldns.
@ximon18 ximon18 self-assigned this Nov 13, 2024
src/commands/nsec3hash.rs Outdated Show resolved Hide resolved
let binary_path = args_iter.next()?;
let binary_path = args_iter
.next()
.ok_or::<Error>("Missing binary name".into())?;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the type annotation is only necessary because the ? adds an into as well, so removing the .into() might clean this up a bit.

Copy link
Member Author

@ximon18 ximon18 Nov 14, 2024

Choose a reason for hiding this comment

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

The latest code (in the packaging PR that merges into this branch) changes this behaviour, but I noted there still seems to be unwanted error output in some cases, e.g. on --help, so I would rather just merge your env PR to main and merge that into this and see what we end up with.

// nsec-hash defaults NSEC3 iterations to 0.
assert_cmds_eq(
&[LDNS_NSEC3_CMD, TEST_ZONE_NAME],
&[DNST_NSEC3_SUBCMD, "--iterations", "1", TEST_ZONE_NAME],
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about how useful these tests are when the defaults are different? It would make more sense to run this with the ldns compatibility mode I suppose.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think both make sense, otherwise we don't have a complete sanity check of the dnst command as a black box (though we do have that in the packaging workflow sanity check).

Copy link
Member

@mozzieongit mozzieongit left a comment

Choose a reason for hiding this comment

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

I've not tested the new changes, but LGTM

Comment on lines +16 to +18
try_ldns_compatibility(args_provider()).or_else(|_| {
Args::try_parse_from(args_provider()).map_err(|err| Error::new(err.to_string().as_str()))
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This is subtly wrong. The try_ldns_compatibility function has three outcomes:

  1. The command was not matched
  2. The command matched and parsing succeeded
  3. The command matched and parsing failed

You've now combined the first and third case even though they should be handled differently.

I think you're also removing the color from the clap output by turning it into a string.

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.

3 participants