static inline void
add_link(dns_qpchain_t *chain, dns_qpnode_t *node, size_t offset) {
+ /* prevent duplication */
+ if (chain->chain[chain->len - 1].node == node) {
+ return;
+ }
chain->chain[chain->len].node = node;
chain->chain[chain->len].offset = offset;
chain->len++;
SET_IF_NOT_NULL(pval_r, leaf_pval(n));
SET_IF_NOT_NULL(ival_r, leaf_ival(n));
maybe_set_name(qp, n, foundname);
+ add_link(chain, n, offset);
if (offset == QPKEY_EQUAL) {
- /* add the exact match to the chain */
- add_link(chain, n, offset);
return (ISC_R_SUCCESS);
} else {
return (DNS_R_PARTIALMATCH);
{ ".", "a.", "b.a.", "c.b.a.", "e.d.c.b.a." } },
{ "a.b.c.d.", ISC_R_SUCCESS, 3, { ".", "c.d.", "a.b.c.d." } },
{ "b.c.d.", DNS_R_PARTIALMATCH, 2, { ".", "c.d." } },
+ { "z.x.k.c.d.",
+ DNS_R_PARTIALMATCH,
+ 3,
+ { ".", "c.d.", "x.k.c.d." } },
{ NULL, 0, 0, { NULL } },
};