]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Remove apply_edns_options from worker and mesh...
authorTom Carpay <tom@nlnetlabs.nl>
Mon, 1 Nov 2021 10:44:55 +0000 (10:44 +0000)
committerTom Carpay <tom@nlnetlabs.nl>
Mon, 1 Nov 2021 10:44:55 +0000 (10:44 +0000)
to be returned in message encoding later...

daemon/worker.c
services/mesh.c

index 0d483de73150e3745bd1fc0f2728430e14081fba..7965a188126fec3d7e216e4475bfb1a30eb781d2 100644 (file)
@@ -449,7 +449,6 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
         * Then check if it needs validation, if so, this routine fails,
         * so that iterator can prime and validator can verify rrsets.
         */
-       struct edns_data edns_bak;
        uint16_t udpsize = edns->udp_size;
        int secure = 0;
        time_t timenow = *worker->env.now;
@@ -508,7 +507,6 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
                }
        }
        /* return this delegation from the cache */
-       edns_bak = *edns;
        edns->edns_version = EDNS_ADVERTISED_VERSION;
        edns->udp_size = EDNS_ADVERTISED_SIZE;
        edns->ext_rcode = 0;
@@ -518,9 +516,7 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
                worker->env.now_tv))
                        return 0;
        msg->rep->flags |= BIT_QR|BIT_RA;
-       if(!apply_edns_options(edns, &edns_bak, worker->env.cfg,
-               repinfo->c, worker->scratchpad) ||
-               !reply_info_answer_encode(&msg->qinfo, msg->rep, id, flags, 
+       if(!reply_info_answer_encode(&msg->qinfo, msg->rep, id, flags,
                repinfo->c->buffer, 0, 1, worker->scratchpad,
                udpsize, edns, (int)(edns->bits & EDNS_DO), secure)) {
                if(!inplace_cb_reply_servfail_call(&worker->env, qinfo, NULL, NULL,
@@ -604,7 +600,6 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
        struct reply_info* rep, uint16_t id, uint16_t flags,
        struct comm_reply* repinfo, struct edns_data* edns)
 {
-       struct edns_data edns_bak;
        time_t timenow = *worker->env.now;
        uint16_t udpsize = edns->udp_size;
        struct reply_info* encode_rep = rep;
@@ -685,7 +680,6 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
                }
        } else *is_secure_answer = 0;
 
-       edns_bak = *edns;
        edns->edns_version = EDNS_ADVERTISED_VERSION;
        edns->udp_size = EDNS_ADVERTISED_SIZE;
        edns->ext_rcode = 0;
@@ -722,9 +716,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
                        if(!*partial_repp)
                                goto bail_out;
                }
-       } else if(!apply_edns_options(edns, &edns_bak, worker->env.cfg,
-               repinfo->c, worker->scratchpad) ||
-               !reply_info_answer_encode(qinfo, encode_rep, id, flags,
+       } else if(!reply_info_answer_encode(qinfo, encode_rep, id, flags,
                repinfo->c->buffer, timenow, 1, worker->scratchpad,
                udpsize, edns, (int)(edns->bits & EDNS_DO), *is_secure_answer)) {
                if(!inplace_cb_reply_servfail_call(&worker->env, qinfo, NULL, NULL,
index be532610fcdc5d9fbb45870e1bd8c41d3e5e1064..df99f891c1385d2fa3c4b2916497215543871fca 100644 (file)
@@ -1217,9 +1217,6 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
        struct timeval end_time;
        struct timeval duration;
        int secure;
-       /* Copy the client's EDNS for later restore, to make sure the edns
-        * compare is with the correct edns options. */
-       struct edns_data edns_bak = r->edns;
        /* briefly set the replylist to null in case the
         * meshsendreply calls tcpreqinfo sendreply that
         * comm_point_drops because of size, and then the
@@ -1307,9 +1304,6 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
                m->s.qinfo.local_alias = r->local_alias;
                if(!inplace_cb_reply_call(m->s.env, &m->s.qinfo, &m->s, rep,
                        LDNS_RCODE_NOERROR, &r->edns, &r->query_reply, m->s.region, &r->start_time) ||
-                       !apply_edns_options(&r->edns, &edns_bak,
-                               m->s.env->cfg, r->query_reply.c,
-                               m->s.region) ||
                        !reply_info_answer_encode(&m->s.qinfo, rep, r->qid, 
                        r->qflags, r_buffer, 0, 1, m->s.env->scratch,
                        udp_size, &r->edns, (int)(r->edns.bits & EDNS_DO),
@@ -1321,7 +1315,6 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
                        error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
                                &m->s.qinfo, r->qid, r->qflags, &r->edns);
                }
-               r->edns = edns_bak;
                m->reply_list = NULL;
                comm_point_send_reply(&r->query_reply);
                m->reply_list = rlist;