Lines Matching refs:ns
252 for (int ns = 0; ns < nscount; ns++) { in res_set_usable_server() local
253 if (usable_servers[ns]) ++usableIndex; in res_set_usable_server()
254 if (usableIndex != selectedServer) usable_servers[ns] = false; in res_set_usable_server()
270 int ns; in res_ourserver_p() local
275 for (ns = 0; ns < statp->nscount; ns++) { in res_ourserver_p()
276 srv = (struct sockaddr_in*) (void*) get_nsaddr(statp, (size_t) ns); in res_ourserver_p()
286 for (ns = 0; ns < statp->nscount; ns++) { in res_ourserver_p()
287 srv6 = (struct sockaddr_in6*) (void*) get_nsaddr(statp, (size_t) ns); in res_ourserver_p()
428 for (int ns = 0; ns < statp->nscount; ns++) { in res_nsend() local
429 if (statp->nsaddr_list[ns].sin_family && in res_nsend()
430 !sock_eq((struct sockaddr*) (void*) &statp->nsaddr_list[ns], in res_nsend()
431 (struct sockaddr*) (void*) &statp->_u._ext.ext->nsaddrs[ns])) { in res_nsend()
436 if (statp->_u._ext.nssocks[ns] == -1) continue; in res_nsend()
438 if (getpeername(statp->_u._ext.nssocks[ns], (struct sockaddr*) (void*) &peer, in res_nsend()
443 if (!sock_eq((struct sockaddr*) (void*) &peer, get_nsaddr(statp, (size_t) ns))) { in res_nsend()
459 for (int ns = 0; ns < statp->nscount; ns++) { in res_nsend() local
460 statp->_u._ext.nstimes[ns] = RES_MAXTIME; in res_nsend()
461 statp->_u._ext.nssocks[ns] = -1; in res_nsend()
462 if (!statp->nsaddr_list[ns].sin_family) continue; in res_nsend()
463 statp->_u._ext.ext->nsaddrs[ns].sin = statp->nsaddr_list[ns]; in res_nsend()
483 for (int ns = 0; ns < lastns; ns++) { in res_nsend() local
485 statp->_u._ext.ext->nsaddrs[ns] = statp->_u._ext.ext->nsaddrs[ns + 1]; in res_nsend()
486 statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1]; in res_nsend()
487 statp->_u._ext.nssocks[ns] = statp->_u._ext.nssocks[ns + 1]; in res_nsend()
488 statp->_u._ext.nstimes[ns] = statp->_u._ext.nstimes[ns + 1]; in res_nsend()
523 for (int ns = 0; ns < statp->nscount; ns++) { in res_nsend() local
524 if (!usable_servers[ns]) continue; in res_nsend()
530 nsap = get_nsaddr(statp, (size_t) ns); in res_nsend()
558 LOG(DEBUG) << __func__ << ": Querying server (# " << ns + 1 in res_nsend()
566 n = send_vc(statp, ¶ms, buf, buflen, ans, anssiz, &terrno, ns, &now, rcode, in res_nsend()
577 _resolv_cache_add_resolver_stats_sample(statp->netid, revision_id, ns, &sample, in res_nsend()
594 n = send_dg(statp, ¶ms, buf, buflen, ans, anssiz, &terrno, ns, &v_circuit, in res_nsend()
601 _resolv_cache_add_resolver_stats_sample(statp->netid, revision_id, ns, &sample, in res_nsend()
686 static struct timespec get_timeout(const res_state statp, const res_params* params, const int ns) { in get_timeout() argument
691 msec = params->base_timeout_msec << ns; in get_timeout()
692 if (ns > 0) { in get_timeout()
708 int anssiz, int* terrno, int ns, time_t* at, int* rcode, int* delay) { in send_vc() argument
721 nsap = get_nsaddr(statp, (size_t) ns); in send_vc()
779 get_timeout(statp, params, ns)) < 0) { in send_vc()
974 int anssiz, int* terrno, int ns, int* v_circuit, int* gotsomewhere, time_t* at, in send_dg() argument
987 nsap = get_nsaddr(statp, (size_t) ns); in send_dg()
989 if (statp->_u._ext.nssocks[ns] == -1) { in send_dg()
990 statp->_u._ext.nssocks[ns] = socket(nsap->sa_family, SOCK_DGRAM | SOCK_CLOEXEC, 0); in send_dg()
991 if (statp->_u._ext.nssocks[ns] < 0) { in send_dg()
1005 fchown(statp->_u._ext.nssocks[ns], AID_DNS, -1); in send_dg()
1007 if (setsockopt(statp->_u._ext.nssocks[ns], SOL_SOCKET, SO_MARK, &(statp->_mark), in send_dg()
1025 if (random_bind(statp->_u._ext.nssocks[ns], nsap->sa_family) < 0) { in send_dg()
1030 if (connect(statp->_u._ext.nssocks[ns], nsap, (socklen_t) nsaplen) < 0) { in send_dg()
1038 s = statp->_u._ext.nssocks[ns]; in send_dg()
1054 timeout = get_timeout(statp, params, ns); in send_dg()