Commit d0c50d1f authored by Jan Kadlec's avatar Jan Kadlec

new_node: Cleaned up getting SOA from packet in xfr-in.c.

parent 94ad27de
......@@ -97,13 +97,16 @@ int xfrin_transfer_needed(const knot_zone_contents_t *zone,
* Retrieve the remote Serial
*/
// the SOA should be the first (and only) RRSet in the response
const knot_pktsection_t *answer = knot_pkt_section(soa_response, KNOT_ANSWER);
if (answer->count < 1 || (&answer->rr[0])->type != KNOT_RRTYPE_SOA) {
if (answer->count < 1) {
return KNOT_EMALF;
}
knot_rrset_t soa_rr = answer->rr[0];
if (soa_rr.type != KNOT_RRTYPE_SOA) {
return KNOT_EMALF;
}
int64_t remote_serial = knot_rrs_soa_serial(&answer->rr[0].rrs);
int64_t remote_serial = knot_rrs_soa_serial(&soa_rr.rrs);
if (remote_serial < 0) {
return KNOT_EMALF; // maybe some other error
}
......
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