&qstate->mesh_info->reply_list->query_reply.client_addr,
&sq->ecs_client_in, qstate->env->cfg);
}
+ else if(qstate->client_addr.ss_family != AF_UNSPEC) {
+ subnet_option_from_ss(
+ &qstate->client_addr,
+ &sq->ecs_client_in, qstate->env->cfg);
+ }
if(sq->ecs_client_in.subnet_validdata == 0) {
/* No clients are interested in result or we could not
return;
}
} else {
- /* Fake the ECS data from the client's IP */
- struct ecs_data ecs;
- memset(&ecs, 0, sizeof(ecs));
- subnet_option_from_ss(&rep->client_addr, &ecs, mesh->env->cfg);
- if(ecs.subnet_validdata == 0) {
- log_err("prefetch_subnet subnet_option_from_ss: invalid data");
- return;
- }
- subnet_ecs_opt_list_append(&ecs, &s->s.edns_opts_front_in,
- &s->s, s->s.region);
- if(!s->s.edns_opts_front_in) {
- log_err("prefetch_subnet subnet_ecs_opt_list_append: out of memory");
- return;
- }
+ /* Store the client's address. Later in the subnet module,
+ * it is decided whether to include an ECS option or not.
+ */
+ s->s.client_addr = rep->client_addr;
}
#ifdef UNBOUND_DEBUG
n =
/** if this is a validation recursion query that does not get
* validation itself */
int is_valrec;
+ /** client network address is needed for the client-subnet option
+ * when probing, but we want use reply_list in mesh_info, because
+ * we don't want to send a reply. */
+ struct sockaddr_storage client_addr;
/** comm_reply contains server replies */
struct comm_reply* reply;