X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=secnet.c;h=e15ee8156f7f78e4b9ac25f63c36d7610bf55457;hb=adf2771c66938704ffa36834a0bd03132fd83fe8;hp=a00124f17706079f1074305ad25f830b0d57e9d5;hpb=03896be378f2295290f2d75cfec28f5b9b430136;p=secnet.git diff --git a/secnet.c b/secnet.c index a00124f..e15ee81 100644 --- a/secnet.c +++ b/secnet.c @@ -51,6 +51,32 @@ static char *pidfile=NULL; bool_t require_root_privileges=False; cstring_t require_root_privileges_explanation=NULL; +const char *const closure_type_names[] = { + [ CL_PURE ] = "PURE" , + [ CL_RESOLVER ] = "RESOLVER" , + [ CL_RANDOMSRC ] = "RANDOMSRC" , + [ CL_SIGPUBKEY ] = "SIGPUBKEY" , + [ CL_SIGPRIVKEY ] = "SIGPRIVKEY" , + [ CL_COMM ] = "COMM" , + [ CL_IPIF ] = "IPIF" , + [ CL_LOG ] = "LOG" , + [ CL_SITE ] = "SITE" , + [ CL_TRANSFORM ] = "TRANSFORM" , + [ CL_DH ] = "DH" , + [ CL_HASH ] = "HASH" , + [ CL_BUFFER ] = "BUFFER" , + [ CL_NETLINK ] = "NETLINK" , + [ CL_PRIVCACHE ] = "PRIVCACHE" , +}; + +const char *closure_type_name(uint32_t ty, char buf[]) { + if (ty < ARRAY_SIZE(closure_type_names)) + return closure_type_names[ty]; + sprintf(buf, "CL#%.6u", (unsigned)ty); + buf[9] = 0; + return buf; +} + static pid_t secnet_pid; /* Structures dealing with poll() call */ @@ -329,8 +355,6 @@ static void run(void) struct pollfd *fds=0; int allocdfds=0, shortfall=0; - Message(M_NOTICE,"%s [%d]: starting\n",version,secnet_pid); - do { if (gettimeofday(&tv_now_global, NULL)!=0) { fatal_perror("main loop: gettimeofday"); @@ -502,6 +526,7 @@ int main(int argc, char **argv) enter_phase(PHASE_GETOPTS); parse_options(argc,argv); + log_early_setlevel(); enter_phase(PHASE_READCONFIG); config=read_conffile(configfile); @@ -517,6 +542,7 @@ int main(int argc, char **argv) enter_phase(PHASE_DAEMONIZE); become_daemon(); + Message(M_NOTICE,"%s [%d]: starting\n",version,secnet_pid); enter_phase(PHASE_GETRESOURCES); /* Appropriate phase hooks will have been run */