Skip to content

Commit

Permalink
Merge pull request #168 from matsduf/merge-develop-into-master
Browse files Browse the repository at this point in the history
Merge develop into master (Zonemaster-LDNS)
  • Loading branch information
matsduf authored Jan 31, 2023
2 parents 6352fde + 4e30eeb commit 7d1b243
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Release history for Zonemaster component Zonemaster-LDNS

3.1.0 2023-01-31 (public fix version)
[Feature]
- Includes the OPT RDATA from the edns_data function
(needed to fix a bug in Zonemaster-Engine) (#166)


3.0.0 2022-12-19

[Breaking change]
Expand Down
2 changes: 1 addition & 1 deletion lib/Zonemaster/LDNS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package Zonemaster::LDNS;

use 5.014;

our $VERSION = '3.0.0';
our $VERSION = '3.1.0';

use parent 'Exporter';
our @EXPORT_OK = qw[to_idn has_idn ldns_version load_zonefile];
Expand Down
19 changes: 14 additions & 5 deletions src/LDNS.xs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,12 +1375,17 @@ packet_edns_version(obj,...)
# -------------------
# Get/set EDNS data
#
# Beware, this code can only take a unique U32 parameter which means it
# is not a full implementation of EDNS data but it is enough for our
# This function acts on the OPT RDATA field of a packet. An OPT RDATA consists of at least one triplet
# {OPTION-CODE, OPTION-LENGTH, OPTION-DATA}.
# When given a parameter, this function will set and return the field, although with the limitation described below.
# Otherwise, it will get and return the field (if any).
#
# Beware, when setting OPT RDATA, this code can only take a unique U32 parameter
# which means it is not a full implementation of EDNS data but it is enough for our
# current purpose. It can only deal with option codes with OPTION-LENGTH=0
# (see 6.1.2 section of RFC 6891) which means OPTION-DATA is always empty.
#
# returns: a bytes string
# returns: a bytes string (or undef if no OPT RDATA is found)
#
SV *
packet_edns_data(obj,...)
Expand All @@ -1391,16 +1396,20 @@ packet_edns_data(obj,...)
{
SvGETMAGIC(ST(1));
opt = ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, (U32)SvIV(ST(1)));
if(opt == NULL)
if(opt == NULL)
{
croak("Failed to set OPT RDATA");
}
ldns_pkt_set_edns_data(obj, opt);
}
else {
opt = ldns_pkt_edns_data(obj);
if(opt == NULL)
{
XSRETURN_UNDEF;
}
}
RETVAL = newSVpvn((char*)(opt), 4);
RETVAL = newSVpvn((char*)(opt->_data), opt->_size);
OUTPUT:
RETVAL

Expand Down

0 comments on commit 7d1b243

Please sign in to comment.