Reach the configuration through a pointer

conf is now a pointer to the current configuration rather than the
structure itself: at first confboot, which exists before main() runs, as
plugins and the standalone services use it too; later configurations
will start from confdefaults. Both are made from confinit.h, the one list
of initial values. The timeouts are an array of the configuration
instead of a pointer to a global one. Nothing behaves differently yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-13 19:12:54 +03:00
1 parent 8bd5c0f0fa
commit 737bdc7d24
19 files changed
+398 -389

No files matched your search

+6 -6
View File
@@ -145,17 +145,17 @@ void * dnsprchild(struct clientparam* param) {
}
else ip = 0;
}
if(!ip && conf.numservers){
if((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&conf.nservers[0].addr), conf.nservers[0].usetcp? SOCK_STREAM:SOCK_DGRAM, conf.nservers[0].usetcp?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {
if(!ip && conf->numservers){
if((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&conf->nservers[0].addr), conf->nservers[0].usetcp? SOCK_STREAM:SOCK_DGRAM, conf->nservers[0].usetcp?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {
RETURN(818);
}
memset(&param->sinsl, 0, sizeof(param->sinsl));
*SAFAMILY(&param->sinsl) = *SAFAMILY(&conf.nservers[0].addr);
*SAFAMILY(&param->sinsl) = *SAFAMILY(&conf->nservers[0].addr);
if(bindwithrange(param, param->remsock, &param->sinsl, param->extport)) {
RETURN(819);
}
param->sinsr = conf.nservers[0].addr;
if(conf.nservers[0].usetcp) {
param->sinsr = conf->nservers[0].addr;
if(conf->nservers[0].usetcp) {
if(connectwithpoll(param, param->remsock,(struct sockaddr *)&param->sinsr,SASIZE(&param->sinsr),param->srv->timeouts[CONNECT_TO])) RETURN(830);
buf-=2;
*(unsigned short*)buf = htons(i);
@@ -180,7 +180,7 @@ void * dnsprchild(struct clientparam* param) {
}
param->statssrv64 += len;
param->nreads++;
if(conf.nservers[0].usetcp) {
if(conf->nservers[0].usetcp) {
unsigned short us;
us = ntohs(*(unsigned short *)buf);
if(us > 4096) RETURN(833);