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 support for NSID option + update internal LDNS to 1.8.3 #151

Merged
7 commits merged into from Nov 3, 2022
Merged

Add support for NSID option + update internal LDNS to 1.8.3 #151

7 commits merged into from Nov 3, 2022

Conversation

ghost
Copy link

@ghost ghost commented Aug 23, 2022

Purpose

Since version 1.8.2 (released earlier this year) LDNS can easily retrieve the NSID from the nameserver. This is a proof of concept to retrieve the NSID in Zonemaster::LDNS.

Context

Addresses zonemaster/zonemaster-engine#178 (comment)
Addresses #143.

Changes

  • New nsid and get_nsid methods for Zonemaster::LDNS::Packet.
  • Update internal LDNS to 1.8.3.

How to test this PR

After installing ldns 1.8.2 (or later), the following snippet should return the NSID from the host it connects to (if any):

use Zonemaster::LDNS;
#print(Zonemaster::LDNS::lib_version() . "\n");

my $host = '194.0.9.1';
my $pkt = Zonemaster::LDNS::Packet->new('domain.example');
$pkt->nsid; # set the NSID EDNS option
my $res = Zonemaster::LDNS->new($host)->query_with_pkt($pkt);
print($res->get_nsid() . "\n");

@matsduf
Copy link
Contributor

matsduf commented Aug 23, 2022

It is an interesting feature for Zonemaster, but shouldn't the first step be to make Zonemaster-LDNS work with v1.8.2 -- or even v1.8.3 with bug fixes?

FreeBSD has support for v1.8.3, but is that true for Debian, Ubuntu and Rocky Linux? Else we have to use built-in LDNS again.

@ghost
Copy link
Author

ghost commented Aug 24, 2022

I've added some logic to check that the installed version of libldns is at least 1.8.2 to prevent errors.

is that true for Debian, Ubuntu and Rocky Linux?

From what I see, there is currently no support (and I don't know when there will be)

@matsduf
Copy link
Contributor

matsduf commented Aug 25, 2022

From what I see, there is currently no support (and I don't know when there will be)

Is it feasible to let the debian packages of Zonemaster-LDNS include internal LDNS? If the feature is to be used the new version of LDNS must be installed everywhere.

Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

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

The submodule in Zonemaster-LDNS must be updated to point at the tag of LDNS 1.8.3. Else built-in LDNS will not be able to use this feature. There is no reason not to do that.

@ghost
Copy link
Author

ghost commented Sep 28, 2022

There is no reason not to do that.

I didn't want to update the submodule since there is an open issue about considering such an update #143. I'll do it in a separate PR.

@matsduf
Copy link
Contributor

matsduf commented Sep 28, 2022

I didn't want to update the submodule since there is an open issue about considering such an update #143. I'll do it in a separate PR.

This PR introduces features from the new version. Why not include that now?

@ghost
Copy link
Author

ghost commented Sep 28, 2022

I've updated the internal LDNS to latest release, which is 1.8.3.

@ghost ghost changed the title POC: set and get EDNS option NSID for/from a packet Add support for NSID option Sep 28, 2022
@ghost ghost requested a review from matsduf September 28, 2022 16:16
* internal LDNS is 1.8.3 so it supports NSID
* external LDNS is unknown, a check is needed
@ghost ghost changed the title Add support for NSID option Add support for NSID option + update internal LDNS to 1.8.3 Oct 4, 2022
matsduf
matsduf previously approved these changes Oct 5, 2022
Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

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

Looks fine.

@ghost ghost added this to the v2022.2 milestone Oct 12, 2022
@ghost
Copy link
Author

ghost commented Oct 12, 2022

The test file was missing in the MANIFEST.

@ghost ghost requested a review from matsduf October 12, 2022 12:33
Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

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

Press return to run 'make distcheck'...
"/usr/local/bin/perl" "-Iinc" "-MExtUtils::Manifest=fullcheck" -e fullcheck
Not in MANIFEST: ldns/.github/FUNDING.yml
Not in MANIFEST: ldns/.github/workflows/testsuite.yml
Not in MANIFEST: ldns/libdns.doxygen.in
Not in MANIFEST: ldns/README-Travis.md

@matsduf
Copy link
Contributor

matsduf commented Oct 17, 2022

I have created an installation package for CPAN and try to install it on Ubuntu with built-in LDNS. I fails:

config.status: creating ldns/config.h
config.status: executing libtool commands
copying header files
make[1]: Entering directory '/root/.cpanm/work/1666001014.249574/Zonemaster-LDNS-2.2.2/ldns'
./libtool --tag=CC --quiet --mode=compile gcc -I. -I.  -DHAVE_CONFIG_H -DLDNS_TRUST_ANCHOR_FILE="\"/usr/local/etc/unbound/root.key\"" -Wunused-function -Wstrict-prototypes -Wwrite-strings -W -Wall -fPIC  -c ./buffer.c -o buffer.lo
In file included from ./ldns/util.h:19,
                 from ./ldns/ldns.h:95,
                 from ./buffer.c:12:
./ldns/common.h:30:44: error: token "@" is not valid in preprocessor expressions
   30 | #define LDNS_BUILD_CONFIG_USE_DSA          @ldns_build_config_use_dsa@
      |                                            ^
./ldns/keys.h:85:5: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_DSA'
   85 | #if LDNS_BUILD_CONFIG_USE_DSA
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
./ldns/common.h:30:44: error: token "@" is not valid in preprocessor expressions
   30 | #define LDNS_BUILD_CONFIG_USE_DSA          @ldns_build_config_use_dsa@
      |                                            ^
./ldns/keys.h:91:5: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_DSA'
   91 | #if LDNS_BUILD_CONFIG_USE_DSA
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
./ldns/common.h:31:44: error: token "@" is not valid in preprocessor expressions
   31 | #define LDNS_BUILD_CONFIG_USE_ED25519      @ldns_build_config_use_ed25519@
      |                                            ^
./ldns/keys.h:97:5: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_ED25519'
   97 | #if LDNS_BUILD_CONFIG_USE_ED25519
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./ldns/common.h:32:44: error: token "@" is not valid in preprocessor expressions
   32 | #define LDNS_BUILD_CONFIG_USE_ED448        @ldns_build_config_use_ed448@
      |                                            ^
./ldns/keys.h:100:5: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_ED448'
  100 | #if LDNS_BUILD_CONFIG_USE_ED448
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
./ldns/common.h:30:44: error: token "@" is not valid in preprocessor expressions
   30 | #define LDNS_BUILD_CONFIG_USE_DSA          @ldns_build_config_use_dsa@
      |                                            ^
./ldns/keys.h:258:6: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_DSA'
  258 | # if LDNS_BUILD_CONFIG_USE_DSA
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
./ldns/common.h:30:44: error: token "@" is not valid in preprocessor expressions
   30 | #define LDNS_BUILD_CONFIG_USE_DSA          @ldns_build_config_use_dsa@
      |                                            ^
./ldns/keys.h:323:6: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_DSA'
  323 | # if LDNS_BUILD_CONFIG_USE_DSA
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
./ldns/common.h:30:44: error: token "@" is not valid in preprocessor expressions
   30 | #define LDNS_BUILD_CONFIG_USE_DSA          @ldns_build_config_use_dsa@
      |                                            ^
./ldns/keys.h:341:6: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_DSA'
  341 | # if LDNS_BUILD_CONFIG_USE_DSA
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
./ldns/common.h:30:44: error: token "@" is not valid in preprocessor expressions
   30 | #define LDNS_BUILD_CONFIG_USE_DSA          @ldns_build_config_use_dsa@
      |                                            ^
./ldns/keys.h:467:6: note: in expansion of macro 'LDNS_BUILD_CONFIG_USE_DSA'
  467 | # if LDNS_BUILD_CONFIG_USE_DSA
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:140: buffer.lo] Error 1
make[1]: Leaving directory '/root/.cpanm/work/1666001014.249574/Zonemaster-LDNS-2.2.2/ldns'
make: *** [Makefile:1433: ldns/.libs/libldns.a] Error 2
FAIL

@ghost
Copy link
Author

ghost commented Oct 17, 2022

I have created an installation package for CPAN and try to install it on Ubuntu with built-in LDNS. I fails:

I can't reproduce on Ubuntu 22.04. Can you provide more information on the steps you used?

@matsduf
Copy link
Contributor

matsduf commented Oct 17, 2022

First create a package on one server (FreeBSD) with the relevant branch checked out:

git branch -v | head -1
* (HEAD detached at pnax/nsid) 7535a41 Missing files in MANIFEST from libldns

Then

perl Makefile.PL --no-ed25519
make all
make distcheck
make dist

The distribution file is copied to the target server:

$ lsb_release -a 2>/dev/null | grep Description
Description:	Ubuntu 22.04 LTS

Installing Zonemaster-LDNS (or trying):

$ sudo cpanm -iv Zonemaster-LDNS-2.2.2-PR151-7535a41-2022-10-17-A.tar.gz 

Have you created a distrubution file? I could try yours, and you could try mine (enclosed).
Zonemaster-LDNS-2.2.2-PR151-7535a41-2022-10-17-A.tar.gz

@ghost
Copy link
Author

ghost commented Oct 17, 2022

With the distribution file you provided I could reproduce. I haven't looked more thoroughly into it yet. Here is the distribution file I used: Zonemaster-LDNS-2.2.2-PR151.tar.gz

@matsduf
Copy link
Contributor

matsduf commented Oct 17, 2022

I compared the contents of the two packages. The following files differ:

  • ./ldns/config.sub
  • ./ldns/configure
  • ./ldns/config.guess
  • ./ldns/ltmain.sh
  • ./ldns/ldns/config.h.in

The rest of the files are identical.

I tested your package on Ubuntu and FreeBSD, and it passed. I tested mine on FreeBSD too, and it failed. I will recreate the package and also create a package from master and develop branches.

@matsduf
Copy link
Contributor

matsduf commented Oct 17, 2022

When changing between the branch of this PR and the develop branch the submodule path "ldns" must be updated. When testing, "git submodule update" seemed to do that (since the ldns/Changelog file was updated) but something did not work right. Something else must be done. We should support that since we need to be able to switch between branches with different submodule content.

Do you know the correct git commands to wipe the current content and checking out the correct content?


The following works, but there might be something in one command that works

git submodule deinit -f .
git submodule update --init --recursive 

@matsduf
Copy link
Contributor

matsduf commented Oct 17, 2022

With updated instructions for how to reset the submodule it seems to work. See zonemaster/zonemaster#1108 (and please review it). I will retest this PR.

Copy link
Contributor

@matsduf matsduf left a comment

Choose a reason for hiding this comment

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

It works fine, but I have one request of change:

I suggest that the ldns/Changelog file moved from MANIFEST.SKIP to MANIFEST to make it easy to verify the version of LDNS in the Zonemaster-LDNS package.

@ghost
Copy link
Author

ghost commented Oct 19, 2022

When testing, "git submodule update" seemed to do that (since the ldns/Changelog file was updated) but something did not work right.

@matsduf can you be more explicit on what fails with git submodule update?

@matsduf
Copy link
Contributor

matsduf commented Oct 19, 2022

When testing, "git submodule update" seemed to do that (since the ldns/Changelog file was updated) but something did not work right.

@matsduf can you be more explicit on what fails with git submodule update?

If you build Zonemaster-LDNS with one branch where LDNS is 1.7.1 (e.g. current develop) and then switch to another branch where LDNS is 1.8.3 then git submodule update will not do a complete clean-up. Specifically, ldns/configure/ will have the following lines

PACKAGE_VERSION='1.7.1'
PACKAGE_STRING='ldns 1.7.1'

instead of

PACKAGE_VERSION='1.8.3'
PACKAGE_STRING='ldns 1.8.3'

With git submodule deinit -f . ; git submodule update --init --recursive the file (ldns/configure) will be removed, and then recreated when building again.

@ghost
Copy link
Author

ghost commented Oct 20, 2022

I think I found a better solution than removing the submodule. This comes to using the update of ldns/Changelog as a prerequisite in the Makefile, see #158.

@ghost ghost merged commit b5930f6 into zonemaster:develop Nov 3, 2022
@hannaeko hannaeko added S-ReleaseTested Status: The PR has been successfully tested in release testing V-Minor Versioning: The change gives an update of minor in version. labels Dec 7, 2022
@ghost ghost deleted the nsid branch May 24, 2023 12:51
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-ReleaseTested Status: The PR has been successfully tested in release testing V-Minor Versioning: The change gives an update of minor in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants