Skip to content

Commit

Permalink
lib/rules: when forwarding, avoid resolving NS's name
Browse files Browse the repository at this point in the history
With "authoritative forwarding" it could happen that NS selection
decided to resolve the virtual ns.invalid name of the NS to get
either A or AAAA (if either was missing in the forwarding rule).
  • Loading branch information
vcunat committed Aug 3, 2023
1 parent c123ea3 commit 87e3613
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rules/forward.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ int kr_rule_data_src_check(struct kr_query *qry, struct knot_pkt *pkt)
labels > qry->data_src.rule_depth;
--labels, apex = knot_wire_next_label(apex, NULL));
kr_zonecut_set(&qry->zone_cut, apex);
qry->zone_cut.avoid_resolving = true;
knot_db_val_t targets = qry->data_src.targets_ptr;
kr_assert(targets.len > 0);
while (targets.len > 0) {
Expand Down
3 changes: 3 additions & 0 deletions lib/selection_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ static int get_resolvable_names(struct iter_local_state *local_state,
if (qry->sname[0] == '\0' && qry->stype == KNOT_RRTYPE_DNSKEY) {
return 0;
}
if (qry->zone_cut.avoid_resolving) {
return 0;
}

unsigned count = 0;
trie_it_t *it;
Expand Down
1 change: 1 addition & 0 deletions lib/zonecut.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct kr_zonecut {
struct kr_zonecut *parent; /**< Parent zone cut. */
trie_t *nsset; /**< Map of nameserver => address_set (pack_t). */
knot_mm_t *pool; /**< Memory pool. */
bool avoid_resolving; /**< Avoid resolving the NS names. */
};

/**
Expand Down

0 comments on commit 87e3613

Please sign in to comment.