Commit d8ff1a43 authored by Lubos Slovak's avatar Lubos Slovak

EDNS: Fixed reading of Extended RCODE.

parent 5fde8dd4
......@@ -138,6 +138,12 @@ void knot_edns_set_payload(knot_rrset_t *opt_rr, uint16_t payload);
*/
uint8_t knot_edns_get_ext_rcode(const knot_rrset_t *opt_rr);
static inline uint16_t knot_edns_whole_rcode(uint8_t ext_rcode, uint8_t rcode)
{
uint16_t high = ext_rcode;
return (high << 4) | rcode;
  • Could be one line...

    I'm taking this back. The result would be truncated to 8 bits. Sorry.

Please register or sign in to reply
}
/*!
* \brief Sets the Extended RCODE field in the OPT RR.
*
......
......@@ -213,9 +213,10 @@ static void print_edns_client_subnet(const uint8_t *data, const uint16_t len)
printf("%s/%u/%u\n", addr_str, src_mask, dst_mask);
}
static void print_section_opt(const knot_rrset_t *rr)
static void print_section_opt(const knot_rrset_t *rr, uint8_t rcode)
{
uint8_t ext_rcode_id = knot_edns_get_ext_rcode(rr);
uint16_t ext_rcode_id = knot_edns_whole_rcode(
knot_edns_get_ext_rcode(rr), rcode);
const char *ext_rcode_str = "NULL";
knot_lookup_table_t *ext_rcode;
......@@ -587,7 +588,8 @@ void print_packet(const knot_pkt_t *packet,
// Print EDNS section.
if (style->show_edns && knot_pkt_has_edns(packet)) {
printf("\n;; EDNS PSEUDOSECTION:\n;; ");
print_section_opt(packet->opt_rr);
print_section_opt(packet->opt_rr,
knot_wire_get_rcode(packet->wire));
}
// Print DNS sections.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment