Skip to content
Snippets Groups Projects
Commit 12abc2e3 authored by dnsadmin's avatar dnsadmin
Browse files

Port beállíthatóság és némi manual javítás

parent 53fbe76c
No related branches found
No related tags found
No related merge requests found
......@@ -32,14 +32,14 @@ void print_help();
int main(int argc, char *argv[])
{
int cli_option;
int thread_num = 1;
int thread_num = 1, port = 53;
char working_dir[PATH_MAX] = { 0 };
getcwd(working_dir, PATH_MAX-1 );
bool run_as_daemon = false;
std::vector<command> command_list;
while((cli_option = getopt (argc, argv, "dkvt:w:h")) != -1)
while((cli_option = getopt (argc, argv, "dkvt:w:p:h")) != -1)
{
int ti = 0;
int tmp = 0;
switch(cli_option)
{
case 'd':
......@@ -52,13 +52,18 @@ int main(int argc, char *argv[])
verbose = true;
break;
case 't':
ti = atoi(optarg);
if(ti>0)
thread_num = ti;
tmp = atoi(optarg);
if(tmp > 0)
thread_num = tmp;
break;
case 'w':
strncpy(working_dir, optarg, PATH_MAX-1);
break;
case 'p':
tmp = atoi(optarg);
if(tmp > 1)
port = tmp;
break;
case 'h':
print_help();
exit(EXIT_SUCCESS);
......@@ -87,7 +92,7 @@ int main(int argc, char *argv[])
if(getuid() != 0)
{
log_on_demand(LOG_ERR, "You should run with root privileges!");
log_on_demand(LOG_ERR, "You should run it with root privileges!");
exit(EXIT_FAILURE);
}
......@@ -150,7 +155,7 @@ int main(int argc, char *argv[])
memset(&server_address, 0, sizeof(server_address));
server_address.sin6_family = AF_INET6;
server_address.sin6_addr = in6_addr_any;
server_address.sin6_port = htons(10053);
server_address.sin6_port = htons(port);
server.init(general_sockaddr_wp((sockaddr *) &server_address, sizeof(server_address)));
if(verbose)
......@@ -192,12 +197,18 @@ Therefore and some other reason the server must be run with root privileges.
In daemon mode, the working directory must contain the dns.db file.
There are some command line options with which you can make
modifications to the default attributes of the runtime.
See them below.
Options:
-d Run as daemon
-t threads Number of threads to start. Only makes sense with -d.
-k Kill daemon
-w workind_dir Set working directory. Absolute path needed.
-d Run as daemon.
-t THREAD_NUMBER Number of threads to start. Only makes sense with -d.
-k Kill daemon.
-w WORKING_DIR Set working directory. Absolute path needed.
If not set, the actual PWD will be used.
-p PORT Specifies the port for the server to bind to.
Only makes sense with -d
-v Verbose
-h help
)");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment