Lines Matching refs:sq

89 	struct subnet_qstate *sq = (struct subnet_qstate*)regional_alloc(
91 if(!sq)
93 qstate->minfo[id] = sq;
94 memset(sq, 0, sizeof(*sq));
95 sq->started_no_cache_store = qstate->no_cache_store;
144 struct subnet_qstate *sq;
147 if(!(sq=(struct subnet_qstate*)qstate->minfo[id]))
157 if(sq->ecs_server_out.subnet_validdata && ((sq->subnet_downstream &&
165 if(!(sq->subnet_sent)) {
166 ecs_opt_list_append(&sq->ecs_server_out,
168 sq->subnet_sent = 1;
171 else if(sq->subnet_sent) {
176 sq->subnet_sent = 0;
325 struct subnet_qstate *sq = (struct subnet_qstate*)qstate->minfo[id];
327 struct ecs_data *edns = &sq->ecs_client_in;
389 edns->subnet_source_mask, sq->max_scope, rep,
401 lookup_and_reply(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
408 struct ecs_data *ecs = &sq->ecs_client_in;
413 memset(&sq->ecs_client_out, 0, sizeof(sq->ecs_client_out));
415 if (sq) sq->qinfo_hash = h; /* Might be useful on cache miss */
442 if (sq->subnet_downstream) { /* relay to interested client */
443 sq->ecs_client_out.subnet_scope_mask = scope;
444 sq->ecs_client_out.subnet_addr_fam = ecs->subnet_addr_fam;
445 sq->ecs_client_out.subnet_source_mask = ecs->subnet_source_mask;
446 memcpy(&sq->ecs_client_out.subnet_addr, &ecs->subnet_addr,
448 sq->ecs_client_out.subnet_validdata = 1;
469 eval_response(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
473 struct ecs_data *c_in = &sq->ecs_client_in; /* rcvd from client */
474 struct ecs_data *c_out = &sq->ecs_client_out;/* will send to client */
475 struct ecs_data *s_in = &sq->ecs_server_in; /* rcvd from auth */
476 struct ecs_data *s_out = &sq->ecs_server_out;/* sent to auth */
488 if (!sq->subnet_sent) {
491 if (sq->subnet_downstream) /* Copy back to client */
503 if(!sq->started_no_cache_store) {
508 if (sq->subnet_downstream)
528 sq->subnet_sent = 0;
533 if(!sq->started_no_cache_store) {
539 if (sq->subnet_downstream) {
545 c_out->subnet_scope_mask = sq->max_scope;
638 struct subnet_qstate *sq;
640 if(!response || !(sq=(struct subnet_qstate*)qstate->minfo[id]))
643 if(sq->subnet_sent &&
648 sq->subnet_sent = 0;
649 memset(&sq->ecs_server_out, 0, sizeof(sq->ecs_server_out));
650 } else if (!sq->track_max_scope &&
661 sq->track_max_scope = 1;
671 struct subnet_qstate *sq;
674 if(!(sq=(struct subnet_qstate*)qstate->minfo[id]))
679 parse_subnet_option(ecs_opt, &sq->ecs_server_in) &&
680 sq->subnet_sent && sq->ecs_server_in.subnet_validdata) {
687 if(!sq->track_max_scope || (sq->track_max_scope &&
688 sq->ecs_server_in.subnet_scope_mask >
689 sq->max_scope))
690 sq->max_scope = sq->ecs_server_in.subnet_scope_mask;
701 struct subnet_qstate *sq = (struct subnet_qstate*)qstate->minfo[id];
709 sq == NULL) {
717 sq = (struct subnet_qstate*)qstate->minfo[id];
722 if(!parse_subnet_option(ecs_opt, &sq->ecs_client_in)) {
729 sq->subnet_downstream = 1;
734 &sq->ecs_client_in, qstate->env->cfg);
737 if(sq->ecs_client_in.subnet_validdata == 0) {
740 sq->ecs_server_out.subnet_validdata = 0;
747 if(sq->ecs_client_in.subnet_source_mask != 0 && (
748 (sq->ecs_client_in.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP4 &&
749 sq->ecs_client_in.subnet_source_mask < qstate->env->cfg->min_client_subnet_ipv4) ||
750 (sq->ecs_client_in.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP6 &&
751 sq->ecs_client_in.subnet_source_mask < qstate->env->cfg->min_client_subnet_ipv6))) {
758 if (lookup_and_reply(qstate, id, sq)) {
764 ecs_opt_list_append(&sq->ecs_client_out,
770 sq->ecs_server_out.subnet_addr_fam =
771 sq->ecs_client_in.subnet_addr_fam;
772 sq->ecs_server_out.subnet_source_mask =
773 sq->ecs_client_in.subnet_source_mask;
775 if(sq->ecs_server_out.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP4
776 && sq->ecs_server_out.subnet_source_mask >
778 sq->ecs_server_out.subnet_source_mask =
780 else if(sq->ecs_server_out.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP6
781 && sq->ecs_server_out.subnet_source_mask >
783 sq->ecs_server_out.subnet_source_mask =
788 memcpy(&sq->ecs_server_out.subnet_addr,
789 sq->ecs_client_in.subnet_addr, INET6_SIZE);
790 sq->ecs_server_out.subnet_scope_mask = 0;
791 sq->ecs_server_out.subnet_validdata = 1;
792 if(sq->ecs_server_out.subnet_source_mask != 0 &&
794 sq->subnet_downstream)
806 if(sq && event == module_event_moddone) {
807 qstate->ext_state[id] = eval_response(qstate, id, sq);
810 ecs_opt_list_append(&sq->ecs_client_out,
813 qstate->no_cache_store = sq->started_no_cache_store;
816 if(sq && outbound) {
826 if(!sq && (event == module_event_moddone)) {