/** Prepare answer packet to be filled by RRs (without RR data in wire). */
int pkt_renew(knot_pkt_t *pkt, const knot_dname_t *name, uint16_t type);
-/** Append RRset + its RRSIGs into the current section (*shallow* copy), with given rank.
+/** Append RRset + its RRSIGs into the current section (*shallow* copy).
*
* \note it works with empty set as well (skipped)
* \note pkt->wire is not updated in any way
* \note Whole RRsets are put into the pseudo-packet;
* normal parsed packets would only contain single-RR sets.
*/
-int pkt_append(knot_pkt_t *pkt, const struct answer_rrset *rrset, uint8_t rank);
+int pkt_append(knot_pkt_t *pkt, const struct answer_rrset *rrset);
return kr_ok();
}
-int pkt_append(knot_pkt_t *pkt, const struct answer_rrset *rrset, uint8_t rank)
+int pkt_append(knot_pkt_t *pkt, const struct answer_rrset *rrset)
{
/* allocate space, to be sure */
int rrset_cnt = (rrset->set.rr->rrs.count > 0) + (rrset->sig_rds.count > 0);
/* allocate rank */
uint8_t *rr_rank = mm_alloc(&pkt->mm, sizeof(*rr_rank));
if (!rr_rank) return kr_error(ENOMEM);
- *rr_rank = (i == 0) ? rank : (KR_RANK_OMIT | KR_RANK_AUTH);
+ *rr_rank = (i == 0) ? rrset->set.rank : (KR_RANK_OMIT | KR_RANK_AUTH);
/* rank for RRSIGs isn't really useful: ^^ */
if (i == 0) {
pkt->rr[pkt->rrset_count] = *rrset->set.rr;
if (i == 1) knot_pkt_begin(pkt, KNOT_AUTHORITY);
if (!ans.rrsets[i].set.rr) continue;
expiring = expiring || ans.rrsets[i].set.expiring;
- ret = pkt_append(pkt, &ans.rrsets[i], ans.rrsets[i].set.rank);
+ ret = pkt_append(pkt, &ans.rrsets[i]);
if (kr_fails_assert(ret == 0))
return ctx->state;
}
qry->sname, type, new_ttl);
CHECK_RET(ret);
/* Put links to the materialized data into the pkt. */
- ret = pkt_append(pkt, &ans.rrsets[AR_ANSWER], eh->rank);
+ ret = pkt_append(pkt, &ans.rrsets[AR_ANSWER]);
CHECK_RET(ret);
answer_simple_qflags(&qry->flags, eh, new_ttl);
dname_owner, KNOT_RRTYPE_DNAME, new_ttl);
CHECK_RET(ret);
/* Put link to the RRset into the pkt. */
- ret = pkt_append(pkt, &ans.rrsets[AR_ANSWER], eh->rank);
+ ret = pkt_append(pkt, &ans.rrsets[AR_ANSWER]);
CHECK_RET(ret);
const knot_dname_t *dname_target =
knot_dname_target(ans.rrsets[AR_ANSWER].set.rr->rrs.rdata);
/* Generate CNAME RRset for the answer in (pseudo-)packet. */
const int AR_CNAME = AR_SOA;
+ ans.rrsets[AR_CNAME].set.rank = ans.rrsets[AR_ANSWER].set.rank;
knot_rrset_t *rr = ans.rrsets[AR_CNAME].set.rr
= knot_rrset_new(qry->sname, KNOT_RRTYPE_CNAME, KNOT_CLASS_IN,
new_ttl, ans.mm);
CHECK_RET(rr->rrs.rdata ? kr_ok() : -ENOMEM);
knot_rdata_init(rr->rrs.rdata, rdata_len, cname_target);
/* Put link to the RRset into the pkt. */
- ret = pkt_append(pkt, &ans.rrsets[AR_CNAME], eh->rank);
+ ret = pkt_append(pkt, &ans.rrsets[AR_CNAME]);
CHECK_RET(ret);
} else {
/* Note that it's basically a successful answer; name just doesn't fit. */