[server] add --dump-serv-err-codes for test coverage
This commit is contained in:
parent
11f3e9b8d3
commit
5f24fc8c5f
@ -125,6 +125,7 @@ enum {
|
||||
ENABLE_PCAP_ANY_DIRECTION,
|
||||
ROTATE_DIGEST_CACHE,
|
||||
SYSLOG_ENABLE,
|
||||
DUMP_SERVER_ERR_CODES,
|
||||
NOOP /* Just to be a marker for the end */
|
||||
};
|
||||
|
||||
@ -141,6 +142,7 @@ static struct option cmd_opts[] =
|
||||
{"packet-limit", 1, NULL, 'C'},
|
||||
{"digest-file", 1, NULL, 'd'},
|
||||
{"dump-config", 0, NULL, 'D'},
|
||||
{"dump-serv-err-codes", 0, NULL, DUMP_SERVER_ERR_CODES },
|
||||
{"syslog-enable", 0, NULL, SYSLOG_ENABLE },
|
||||
{"foreground", 0, NULL, 'f'},
|
||||
{"help", 0, NULL, 'h'},
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
#include "fwknopd_common.h"
|
||||
#include "fwknopd_errors.h"
|
||||
#include "config_init.h"
|
||||
#include "access.h"
|
||||
#include "cmd_opts.h"
|
||||
@ -883,6 +884,9 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
|
||||
case 'D':
|
||||
opts->dump_config = 1;
|
||||
break;
|
||||
case DUMP_SERVER_ERR_CODES:
|
||||
dump_server_errors();
|
||||
clean_exit(opts, NO_FW_CLEANUP, EXIT_SUCCESS);
|
||||
case 'f':
|
||||
opts->foreground = 1;
|
||||
break;
|
||||
|
||||
@ -106,4 +106,24 @@ get_errstr(const int err_code)
|
||||
return(fwknopd_errstr(err_code));
|
||||
}
|
||||
|
||||
/* print all server errors (from server/fwknopd_errors.c) to stdout
|
||||
*/
|
||||
void
|
||||
dump_server_errors(void)
|
||||
{
|
||||
int i;
|
||||
for (i=SPA_MSG_BAD_DATA; i<=SPA_MSG_ERROR; i++)
|
||||
{
|
||||
fprintf(stdout, "err code: %d, err string: '%s'\n",
|
||||
i, fwknopd_errstr(i));
|
||||
}
|
||||
for (i=FW_RULE_ADD_ERROR; i<=FW_RULE_UNKNOWN_ERROR; i++)
|
||||
{
|
||||
fprintf(stdout, "err code: %d, err string: '%s'\n",
|
||||
i, fwknopd_errstr(i));
|
||||
}
|
||||
fflush(stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
/***EOF***/
|
||||
|
||||
@ -17,6 +17,16 @@
|
||||
'cmdline' => "$fwknopdCmd $default_server_conf_args " .
|
||||
"-O $conf_dir/override_fwknopd.conf --dump-config",
|
||||
},
|
||||
{
|
||||
'category' => 'basic operations',
|
||||
'subcategory' => 'server',
|
||||
'detail' => 'dump error codes ',
|
||||
'function' => \&generic_exec,
|
||||
'exec_err' => $NO,
|
||||
'cmdline' => "$fwknopdCmd $default_server_conf_args " .
|
||||
"--dump-serv-err-codes",
|
||||
},
|
||||
|
||||
{
|
||||
'category' => 'basic operations',
|
||||
'subcategory' => 'client',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user