Lines Matching defs:sq

93 	struct subnet_qstate *sq = (struct subnet_qstate*)regional_alloc(
95 if(!sq)
97 qstate->minfo[id] = sq;
98 memset(sq, 0, sizeof(*sq));
99 sq->started_no_cache_store = qstate->no_cache_store;
100 sq->started_no_cache_lookup = qstate->no_cache_lookup;
149 struct subnet_qstate *sq;
152 if(!(sq=(struct subnet_qstate*)qstate->minfo[id]))
162 sq->subnet_sent_no_subnet = 0;
163 if(sq->ecs_server_out.subnet_validdata && ((sq->subnet_downstream &&
176 if(sq->ecs_server_out.subnet_source_mask == 0) {
177 sq->subnet_sent_no_subnet = 1;
178 sq->subnet_sent = 0;
181 subnet_ecs_opt_list_append(&sq->ecs_server_out,
184 sq->subnet_sent = 1;
194 sq->subnet_sent = 0;
363 struct subnet_qstate *sq = (struct subnet_qstate*)qstate->minfo[id];
365 struct ecs_data *edns = &sq->ecs_client_in;
435 edns->subnet_source_mask, sq->max_scope, rep,
451 lookup_and_reply(struct module_qstate *qstate, int id, struct subnet_qstate *sq, int prefetch)
458 struct ecs_data *ecs = &sq->ecs_client_in;
463 memset(&sq->ecs_client_out, 0, sizeof(sq->ecs_client_out));
465 if (sq) {
466 sq->qinfo_hash = h; /* Might be useful on cache miss */
467 sq->qinfo_hash_calculated = 1;
495 if (sq->subnet_downstream) { /* relay to interested client */
496 sq->ecs_client_out.subnet_scope_mask = scope;
497 sq->ecs_client_out.subnet_addr_fam = ecs->subnet_addr_fam;
498 sq->ecs_client_out.subnet_source_mask = ecs->subnet_source_mask;
499 memcpy(&sq->ecs_client_out.subnet_addr, &ecs->subnet_addr,
501 sq->ecs_client_out.subnet_validdata = 1;
526 eval_response(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
530 struct ecs_data *c_in = &sq->ecs_client_in; /* rcvd from client */
531 struct ecs_data *c_out = &sq->ecs_client_out;/* will send to client */
532 struct ecs_data *s_in = &sq->ecs_server_in; /* rcvd from auth */
533 struct ecs_data *s_out = &sq->ecs_server_out;/* sent to auth */
545 if (!sq->subnet_sent && !sq->subnet_sent_no_subnet) {
548 if (sq->subnet_downstream) /* Copy back to client */
554 if (!s_in->subnet_validdata && !sq->subnet_sent_no_subnet) {
560 if(!sq->started_no_cache_store) {
565 if (sq->subnet_downstream)
573 if(sq->subnet_sent_no_subnet && !s_in->subnet_validdata) {
597 sq->subnet_sent = 0;
598 sq->subnet_sent_no_subnet = 0;
603 if(!sq->started_no_cache_store) {
623 if (sq->subnet_downstream) {
629 c_out->subnet_scope_mask = sq->max_scope;
722 struct subnet_qstate *sq;
724 if(!response || !(sq=(struct subnet_qstate*)qstate->minfo[id]))
727 if(sq->subnet_sent &&
732 sq->subnet_sent = 0;
733 sq->subnet_sent_no_subnet = 0;
734 memset(&sq->ecs_server_out, 0, sizeof(sq->ecs_server_out));
735 } else if (!sq->track_max_scope &&
746 sq->track_max_scope = 1;
774 struct subnet_qstate *sq;
777 if(!(sq=(struct subnet_qstate*)qstate->minfo[id]))
782 parse_subnet_option(ecs_opt, &sq->ecs_server_in) &&
783 sq->subnet_sent && sq->ecs_server_in.subnet_validdata) {
791 if(!sq->track_max_scope || (sq->track_max_scope &&
792 sq->ecs_server_in.subnet_scope_mask >
793 sq->max_scope))
794 sq->max_scope = sq->ecs_server_in.subnet_scope_mask;
795 } else if(sq->subnet_sent_no_subnet) {
808 struct subnet_qstate *sq = (struct subnet_qstate*)qstate->minfo[id];
816 sq == NULL) {
824 sq = (struct subnet_qstate*)qstate->minfo[id];
829 if(!parse_subnet_option(ecs_opt, &sq->ecs_client_in)) {
837 sq->subnet_downstream = 1;
842 &sq->ecs_client_in, qstate->env->cfg);
847 &sq->ecs_client_in, qstate->env->cfg);
850 if(sq->ecs_client_in.subnet_validdata == 0) {
853 sq->ecs_server_out.subnet_validdata = 0;
860 if(sq->ecs_client_in.subnet_source_mask != 0 && (
861 (sq->ecs_client_in.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP4 &&
862 sq->ecs_client_in.subnet_source_mask < qstate->env->cfg->min_client_subnet_ipv4) ||
863 (sq->ecs_client_in.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP6 &&
864 sq->ecs_client_in.subnet_source_mask < qstate->env->cfg->min_client_subnet_ipv6))) {
870 if(!sq->started_no_cache_lookup && !qstate->blacklist) {
873 lookup_and_reply(qstate, id, sq,
880 subnet_ecs_opt_list_append(&sq->ecs_client_out,
895 sq->ecs_server_out.subnet_addr_fam =
896 sq->ecs_client_in.subnet_addr_fam;
897 sq->ecs_server_out.subnet_source_mask =
898 sq->ecs_client_in.subnet_source_mask;
900 if(sq->ecs_server_out.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP4
901 && sq->ecs_server_out.subnet_source_mask >
903 sq->ecs_server_out.subnet_source_mask =
905 else if(sq->ecs_server_out.subnet_addr_fam == EDNSSUBNET_ADDRFAM_IP6
906 && sq->ecs_server_out.subnet_source_mask >
908 sq->ecs_server_out.subnet_source_mask =
913 memcpy(&sq->ecs_server_out.subnet_addr,
914 sq->ecs_client_in.subnet_addr, INET6_SIZE);
915 sq->ecs_server_out.subnet_scope_mask = 0;
916 sq->ecs_server_out.subnet_validdata = 1;
917 if(sq->ecs_server_out.subnet_source_mask != 0 &&
919 sq->subnet_downstream)
931 if(sq && event == module_event_moddone) {
932 qstate->ext_state[id] = eval_response(qstate, id, sq);
935 subnet_ecs_opt_list_append(&sq->ecs_client_out,
946 qstate->no_cache_store = sq->started_no_cache_store;
947 qstate->no_cache_lookup = sq->started_no_cache_lookup;
950 if(sq && outbound) {
960 if(!sq && (event == module_event_moddone)) {