Skip to content

Commit

Permalink
- Fix for EDNS EDE size calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Aug 1, 2023
1 parent 11f12bc commit 990b12b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doc/Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
- For #911: Try to trim EXTRA-TEXT (and LDNS_EDE_OTHER options
altogether) before giving up on attaching EDE options.

1 August 2023: Wouter
- Fix for EDNS EDE size calculation.

31 July 2023: George
- Merge #790 from Tom Carpay: Add support for EDE caching in cachedb
and subnetcache.
Expand Down
6 changes: 4 additions & 2 deletions util/data/msgencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,22 +833,24 @@ calc_ede_option_size(struct edns_data* edns, uint16_t* txt_size)
if(!edns || !edns->edns_present)
return 0;
for(opt = edns->opt_list_inplace_cb_out; opt; opt = opt->next) {
if(opt->opt_code == LDNS_EDNS_EDE)
if(opt->opt_code == LDNS_EDNS_EDE) {
rdatalen += 4 + opt->opt_len;
if(opt->opt_len > 2)
*txt_size += opt->opt_len - 2;
if(opt->opt_len >= 2 && sldns_read_uint16(
opt->opt_data) == LDNS_EDE_OTHER)
*txt_size += 4 + 2;
}
}
for(opt = edns->opt_list_out; opt; opt = opt->next) {
if(opt->opt_code == LDNS_EDNS_EDE)
if(opt->opt_code == LDNS_EDNS_EDE) {
rdatalen += 4 + opt->opt_len;
if(opt->opt_len > 2)
*txt_size += opt->opt_len - 2;
if(opt->opt_len >= 2 && sldns_read_uint16(
opt->opt_data) == LDNS_EDE_OTHER)
*txt_size += 4 + 2;
}
}
return rdatalen;
}
Expand Down

0 comments on commit 990b12b

Please sign in to comment.