Fix: wheezy warning compilation

This commit is contained in:
fendo 2013-09-16 15:01:04 +02:00
parent 959cce2660
commit 26a2025a1b
7 changed files with 128 additions and 120 deletions

180
cli.c
View file

@ -74,60 +74,60 @@ static char *debug_levels[] = {
#endif #endif
static int cmd_show_session(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_session(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_tunnels(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_tunnels(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_users(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_users(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_radius(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_radius(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_version(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_version(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_pool(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_pool(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_run(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_run(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_banana(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_banana(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_plugins(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_plugins(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_throttle(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_throttle(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_write_memory(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_write_memory(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_drop_user(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_drop_user(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_drop_tunnel(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_drop_tunnel(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_drop_session(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_drop_session(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_snoop(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_snoop(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_no_snoop(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_throttle(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_throttle(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_no_throttle(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_no_throttle(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_debug(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_debug(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_no_debug(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_no_debug(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_set(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_set(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_load_plugin(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_remove_plugin(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_remove_plugin(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_uptime(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_shutdown(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_shutdown(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_reload(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_reload(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_setforward(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_setforward(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_rmtlnsconf(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_rmtlnsconf(struct cli_def *cli, const char *command, char **argv, int argc);
static int regular_stuff(struct cli_def *cli); static int regular_stuff(struct cli_def *cli);
#ifdef STATISTICS #ifdef STATISTICS
static int cmd_show_counters(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_counters(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_clear_counters(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_clear_counters(struct cli_def *cli, const char *command, char **argv, int argc);
#endif /* STATISTICS */ #endif /* STATISTICS */
#ifdef BGP #ifdef BGP
#define MODE_CONFIG_BGP 8 #define MODE_CONFIG_BGP 8
static int cmd_router_bgp(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_router_bgp(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_router_bgp_neighbour(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_router_bgp_neighbour(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_router_bgp_no_neighbour(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_router_bgp_no_neighbour(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_bgp(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_bgp(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_suspend_bgp(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_suspend_bgp(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_no_suspend_bgp(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_no_suspend_bgp(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_restart_bgp(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_restart_bgp(struct cli_def *cli, const char *command, char **argv, int argc);
#endif /* BGP */ #endif /* BGP */
#define MODE_CONFIG_NACL 9 #define MODE_CONFIG_NACL 9
static int cmd_ip_access_list(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_ip_access_list(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_no_ip_access_list(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_no_ip_access_list(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_ip_access_list_rule(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_ip_access_list_rule(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_filter(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_filter(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_no_filter(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_no_filter(struct cli_def *cli, const char *command, char **argv, int argc);
static int cmd_show_access_list(struct cli_def *cli, char *command, char **argv, int argc); static int cmd_show_access_list(struct cli_def *cli, const char *command, char **argv, int argc);
/* match if b is a substr of a */ /* match if b is a substr of a */
#define MATCH(a,b) (!strncmp((a), (b), strlen(b))) #define MATCH(a,b) (!strncmp((a), (b), strlen(b)))
@ -354,7 +354,7 @@ void cli_do(int sockfd)
exit(0); exit(0);
} }
static void cli_print_log(struct cli_def *cli, char *string) static void cli_print_log(struct cli_def *cli, const char *string)
{ {
LOG(3, 0, 0, "%s\n", string); LOG(3, 0, 0, "%s\n", string);
} }
@ -403,7 +403,7 @@ int cli_arg_help(struct cli_def *cli, int cr_ok, char *entry, ...)
return CLI_OK; return CLI_OK;
} }
static int cmd_show_session(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_session(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -582,7 +582,7 @@ static int cmd_show_session(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_show_tunnels(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_tunnels(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i, x, show_all = 0; int i, x, show_all = 0;
char *states[] = { char *states[] = {
@ -673,7 +673,7 @@ static int cmd_show_tunnels(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_show_users(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_users(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
char sid[32][8]; char sid[32][8];
char *sargv[32]; char *sargv[32];
@ -715,7 +715,7 @@ static int cmd_show_users(struct cli_def *cli, char *command, char **argv, int a
} }
#ifdef STATISTICS #ifdef STATISTICS
static int cmd_show_counters(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_counters(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
if (CLI_HELP_REQUESTED) if (CLI_HELP_REQUESTED)
return CLI_HELP_NO_ARGS; return CLI_HELP_NO_ARGS;
@ -815,7 +815,7 @@ static int cmd_show_counters(struct cli_def *cli, char *command, char **argv, in
return CLI_OK; return CLI_OK;
} }
static int cmd_clear_counters(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_clear_counters(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
if (CLI_HELP_REQUESTED) if (CLI_HELP_REQUESTED)
return CLI_HELP_NO_ARGS; return CLI_HELP_NO_ARGS;
@ -828,7 +828,7 @@ static int cmd_clear_counters(struct cli_def *cli, char *command, char **argv, i
} }
#endif /* STATISTICS */ #endif /* STATISTICS */
static int cmd_show_version(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_version(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
if (CLI_HELP_REQUESTED) if (CLI_HELP_REQUESTED)
return CLI_HELP_NO_ARGS; return CLI_HELP_NO_ARGS;
@ -837,7 +837,7 @@ static int cmd_show_version(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_show_pool(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_pool(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
int used = 0, free = 0, show_all = 0; int used = 0, free = 0, show_all = 0;
@ -899,13 +899,13 @@ static int cmd_show_pool(struct cli_def *cli, char *command, char **argv, int ar
} }
static FILE *save_config_fh = 0; static FILE *save_config_fh = 0;
static void print_save_config(struct cli_def *cli, char *string) static void print_save_config(struct cli_def *cli, const char *string)
{ {
if (save_config_fh) if (save_config_fh)
fprintf(save_config_fh, "%s\n", string); fprintf(save_config_fh, "%s\n", string);
} }
static int cmd_write_memory(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_write_memory(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
if (CLI_HELP_REQUESTED) if (CLI_HELP_REQUESTED)
return CLI_HELP_NO_ARGS; return CLI_HELP_NO_ARGS;
@ -928,7 +928,7 @@ static int cmd_write_memory(struct cli_def *cli, char *command, char **argv, int
static char const *show_access_list_rule(int extended, ip_filter_rulet *rule); static char const *show_access_list_rule(int extended, ip_filter_rulet *rule);
static int cmd_show_run(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_run(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
char ipv6addr[INET6_ADDRSTRLEN]; char ipv6addr[INET6_ADDRSTRLEN];
@ -1025,7 +1025,7 @@ static int cmd_show_run(struct cli_def *cli, char *command, char **argv, int arg
return CLI_OK; return CLI_OK;
} }
static int cmd_show_radius(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_radius(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i, free = 0, used = 0, show_all = 0; int i, free = 0, used = 0, show_all = 0;
char *states[] = { char *states[] = {
@ -1080,7 +1080,7 @@ static int cmd_show_radius(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_show_plugins(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_plugins(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -1095,7 +1095,7 @@ static int cmd_show_plugins(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_show_throttle(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_throttle(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -1127,7 +1127,7 @@ static int cmd_show_throttle(struct cli_def *cli, char *command, char **argv, in
return CLI_OK; return CLI_OK;
} }
static int cmd_show_banana(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_banana(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
if (CLI_HELP_REQUESTED) if (CLI_HELP_REQUESTED)
return CLI_HELP_NO_ARGS; return CLI_HELP_NO_ARGS;
@ -1150,7 +1150,7 @@ static int cmd_show_banana(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_drop_user(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_drop_user(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
sessionidt s; sessionidt s;
@ -1191,7 +1191,7 @@ static int cmd_drop_user(struct cli_def *cli, char *command, char **argv, int ar
return CLI_OK; return CLI_OK;
} }
static int cmd_drop_tunnel(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_drop_tunnel(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
tunnelidt t; tunnelidt t;
@ -1241,7 +1241,7 @@ static int cmd_drop_tunnel(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_drop_session(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_drop_session(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
sessionidt s; sessionidt s;
@ -1291,7 +1291,7 @@ static int cmd_drop_session(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_snoop(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_snoop(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
in_addr_t ip; in_addr_t ip;
uint16_t port; uint16_t port;
@ -1364,7 +1364,7 @@ static int cmd_snoop(struct cli_def *cli, char *command, char **argv, int argc)
return CLI_OK; return CLI_OK;
} }
static int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_no_snoop(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
sessionidt s; sessionidt s;
@ -1402,7 +1402,7 @@ static int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int arg
return CLI_OK; return CLI_OK;
} }
static int cmd_throttle(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_throttle(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int rate_in = 0; int rate_in = 0;
int rate_out = 0; int rate_out = 0;
@ -1530,7 +1530,7 @@ static int cmd_throttle(struct cli_def *cli, char *command, char **argv, int arg
return CLI_OK; return CLI_OK;
} }
static int cmd_no_throttle(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_no_throttle(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
sessionidt s; sessionidt s;
@ -1575,7 +1575,7 @@ static int cmd_no_throttle(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_debug(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_debug(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -1639,7 +1639,7 @@ static int cmd_debug(struct cli_def *cli, char *command, char **argv, int argc)
return CLI_OK; return CLI_OK;
} }
static int cmd_no_debug(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_no_debug(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -1685,7 +1685,7 @@ static int cmd_no_debug(struct cli_def *cli, char *command, char **argv, int arg
return CLI_OK; return CLI_OK;
} }
static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_load_plugin(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i, firstfree = 0; int i, firstfree = 0;
@ -1720,7 +1720,7 @@ static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_remove_plugin(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_remove_plugin(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -1781,7 +1781,7 @@ static char *duration(time_t secs)
return buf; return buf;
} }
static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_uptime(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
FILE *fh; FILE *fh;
char buf[100], *p = buf, *loads[3]; char buf[100], *p = buf, *loads[3];
@ -1817,7 +1817,7 @@ static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc)
return CLI_OK; return CLI_OK;
} }
static int cmd_set(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_set(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -1946,7 +1946,7 @@ int regular_stuff(struct cli_def *cli)
} }
#ifdef BGP #ifdef BGP
static int cmd_router_bgp(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_router_bgp(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int as; int as;
@ -2012,7 +2012,7 @@ static int find_bgp_neighbour(char const *name)
return new; return new;
} }
static int cmd_router_bgp_neighbour(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_router_bgp_neighbour(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
int keepalive; int keepalive;
@ -2156,7 +2156,7 @@ static int cmd_router_bgp_neighbour(struct cli_def *cli, char *command, char **a
return CLI_OK; return CLI_OK;
} }
static int cmd_router_bgp_no_neighbour(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_router_bgp_no_neighbour(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -2188,7 +2188,7 @@ static int cmd_router_bgp_no_neighbour(struct cli_def *cli, char *command, char
return CLI_OK; return CLI_OK;
} }
static int cmd_show_bgp(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_bgp(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
int hdr = 0; int hdr = 0;
@ -2243,7 +2243,7 @@ static int cmd_show_bgp(struct cli_def *cli, char *command, char **argv, int arg
return CLI_OK; return CLI_OK;
} }
static int cmd_suspend_bgp(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_suspend_bgp(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
char *addr; char *addr;
@ -2276,7 +2276,7 @@ static int cmd_suspend_bgp(struct cli_def *cli, char *command, char **argv, int
return CLI_OK; return CLI_OK;
} }
static int cmd_no_suspend_bgp(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_no_suspend_bgp(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
char *addr; char *addr;
@ -2310,7 +2310,7 @@ static int cmd_no_suspend_bgp(struct cli_def *cli, char *command, char **argv, i
return CLI_OK; return CLI_OK;
} }
static int cmd_restart_bgp(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_restart_bgp(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
char *addr; char *addr;
@ -2438,12 +2438,12 @@ static int access_list(struct cli_def *cli, char **argv, int argc, int add)
return CLI_OK; return CLI_OK;
} }
static int cmd_ip_access_list(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_ip_access_list(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
return access_list(cli, argv, argc, 1); return access_list(cli, argv, argc, 1);
} }
static int cmd_no_ip_access_list(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_no_ip_access_list(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
return access_list(cli, argv, argc, 0); return access_list(cli, argv, argc, 0);
} }
@ -2529,7 +2529,7 @@ static char const *show_access_list_rule(int extended, ip_filter_rulet *rule)
return buf; return buf;
} }
static ip_filter_rulet *access_list_rule_ext(struct cli_def *cli, char *command, char **argv, int argc) static ip_filter_rulet *access_list_rule_ext(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
static ip_filter_rulet rule; static ip_filter_rulet rule;
struct in_addr addr; struct in_addr addr;
@ -2764,7 +2764,7 @@ static ip_filter_rulet *access_list_rule_ext(struct cli_def *cli, char *command,
return &rule; return &rule;
} }
static ip_filter_rulet *access_list_rule_std(struct cli_def *cli, char *command, char **argv, int argc) static ip_filter_rulet *access_list_rule_std(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
static ip_filter_rulet rule; static ip_filter_rulet rule;
struct in_addr addr; struct in_addr addr;
@ -2880,7 +2880,7 @@ static ip_filter_rulet *access_list_rule_std(struct cli_def *cli, char *command,
return &rule; return &rule;
} }
static int cmd_ip_access_list_rule(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_ip_access_list_rule(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
ip_filter_rulet *rule = ip_filters[filt].extended ip_filter_rulet *rule = ip_filters[filt].extended
@ -2906,7 +2906,7 @@ static int cmd_ip_access_list_rule(struct cli_def *cli, char *command, char **ar
return CLI_OK; return CLI_OK;
} }
static int cmd_filter(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_filter(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
sessionidt s; sessionidt s;
int i; int i;
@ -3002,7 +3002,7 @@ static int cmd_filter(struct cli_def *cli, char *command, char **argv, int argc)
return CLI_OK; return CLI_OK;
} }
static int cmd_no_filter(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_no_filter(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
sessionidt s; sessionidt s;
@ -3047,7 +3047,7 @@ static int cmd_no_filter(struct cli_def *cli, char *command, char **argv, int ar
return CLI_OK; return CLI_OK;
} }
static int cmd_show_access_list(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_access_list(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
@ -3092,7 +3092,7 @@ static int cmd_show_access_list(struct cli_def *cli, char *command, char **argv,
return CLI_OK; return CLI_OK;
} }
static int cmd_shutdown(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_shutdown(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
if (CLI_HELP_REQUESTED) if (CLI_HELP_REQUESTED)
return CLI_HELP_NO_ARGS; return CLI_HELP_NO_ARGS;
@ -3101,7 +3101,7 @@ static int cmd_shutdown(struct cli_def *cli, char *command, char **argv, int arg
return CLI_OK; return CLI_OK;
} }
static int cmd_reload(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_reload(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
if (CLI_HELP_REQUESTED) if (CLI_HELP_REQUESTED)
return CLI_HELP_NO_ARGS; return CLI_HELP_NO_ARGS;
@ -3110,7 +3110,7 @@ static int cmd_reload(struct cli_def *cli, char *command, char **argv, int argc)
return CLI_OK; return CLI_OK;
} }
static int cmd_setforward(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_setforward(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int ret; int ret;
@ -3160,7 +3160,7 @@ static int cmd_setforward(struct cli_def *cli, char *command, char **argv, int a
return CLI_OK; return CLI_OK;
} }
static int cmd_show_rmtlnsconf(struct cli_def *cli, char *command, char **argv, int argc) static int cmd_show_rmtlnsconf(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
confrlnsidt idrlns; confrlnsidt idrlns;
char strdisp[1024]; char strdisp[1024];

View file

@ -1954,7 +1954,7 @@ shortpacket:
//==================================================================================================== //====================================================================================================
int cmd_show_cluster(struct cli_def *cli, char *command, char **argv, int argc) int cmd_show_cluster(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;

View file

@ -92,7 +92,7 @@ void cluster_send_ping(time_t basetime);
void cluster_heartbeat(void); void cluster_heartbeat(void);
void cluster_check_master(void); void cluster_check_master(void);
void cluster_check_slaves(void); void cluster_check_slaves(void);
int cmd_show_cluster(struct cli_def *cli, char *command, char **argv, int argc); int cmd_show_cluster(struct cli_def *cli, const char *command, char **argv, int argc);
int master_forward_pppoe_packet(uint8_t *data, int size, uint8_t codepad); int master_forward_pppoe_packet(uint8_t *data, int size, uint8_t codepad);
#endif /* __CLUSTER_H__ */ #endif /* __CLUSTER_H__ */

View file

@ -1013,8 +1013,10 @@ sessionidt sessionbyipv6(struct in6_addr ip)
ip.s6_addr[1] == 0x80 && ip.s6_addr[1] == 0x80 &&
ip.s6_addr16[1] == 0 && ip.s6_addr16[1] == 0 &&
ip.s6_addr16[2] == 0 && ip.s6_addr16[2] == 0 &&
ip.s6_addr16[3] == 0)) { ip.s6_addr16[3] == 0))
s = lookup_ipmap(*(in_addr_t *) &ip.s6_addr[8]); {
in_addr_t *pipv4 = (in_addr_t *) &ip.s6_addr[8];
s = lookup_ipmap(*pipv4);
} else { } else {
s = lookup_ipv6map(ip); s = lookup_ipv6map(ip);
} }
@ -1100,7 +1102,7 @@ static void cache_ipv6map(struct in6_addr ip, int prefixlen, sessionidt s)
// //
// CLI list to dump current ipcache. // CLI list to dump current ipcache.
// //
int cmd_show_ipcache(struct cli_def *cli, char *command, char **argv, int argc) int cmd_show_ipcache(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
union iphash *d = ip_hash, *e, *f, *g; union iphash *d = ip_hash, *e, *f, *g;
int i, j, k, l; int i, j, k, l;
@ -1844,10 +1846,11 @@ static void send_ipout(sessionidt s, uint8_t *buf, int len)
static void control16(controlt * c, uint16_t avp, uint16_t val, uint8_t m) static void control16(controlt * c, uint16_t avp, uint16_t val, uint8_t m)
{ {
uint16_t l = (m ? 0x8008 : 0x0008); uint16_t l = (m ? 0x8008 : 0x0008);
*(uint16_t *) (c->buf + c->length + 0) = htons(l); uint16_t *pint16 = (uint16_t *) (c->buf + c->length + 0);
*(uint16_t *) (c->buf + c->length + 2) = htons(0); pint16[0] = htons(l);
*(uint16_t *) (c->buf + c->length + 4) = htons(avp); pint16[1] = htons(0);
*(uint16_t *) (c->buf + c->length + 6) = htons(val); pint16[2] = htons(avp);
pint16[3] = htons(val);
c->length += 8; c->length += 8;
} }
@ -1855,10 +1858,12 @@ static void control16(controlt * c, uint16_t avp, uint16_t val, uint8_t m)
static void control32(controlt * c, uint16_t avp, uint32_t val, uint8_t m) static void control32(controlt * c, uint16_t avp, uint32_t val, uint8_t m)
{ {
uint16_t l = (m ? 0x800A : 0x000A); uint16_t l = (m ? 0x800A : 0x000A);
*(uint16_t *) (c->buf + c->length + 0) = htons(l); uint16_t *pint16 = (uint16_t *) (c->buf + c->length + 0);
*(uint16_t *) (c->buf + c->length + 2) = htons(0); uint32_t *pint32 = (uint32_t *) (c->buf + c->length + 6);
*(uint16_t *) (c->buf + c->length + 4) = htons(avp); pint16[0] = htons(l);
*(uint32_t *) (c->buf + c->length + 6) = htonl(val); pint16[1] = htons(0);
pint16[2] = htons(avp);
pint32[0] = htonl(val);
c->length += 10; c->length += 10;
} }
@ -1866,9 +1871,10 @@ static void control32(controlt * c, uint16_t avp, uint32_t val, uint8_t m)
static void controls(controlt * c, uint16_t avp, char *val, uint8_t m) static void controls(controlt * c, uint16_t avp, char *val, uint8_t m)
{ {
uint16_t l = ((m ? 0x8000 : 0) + strlen(val) + 6); uint16_t l = ((m ? 0x8000 : 0) + strlen(val) + 6);
*(uint16_t *) (c->buf + c->length + 0) = htons(l); uint16_t *pint16 = (uint16_t *) (c->buf + c->length + 0);
*(uint16_t *) (c->buf + c->length + 2) = htons(0); pint16[0] = htons(l);
*(uint16_t *) (c->buf + c->length + 4) = htons(avp); pint16[1] = htons(0);
pint16[2] = htons(avp);
memcpy(c->buf + c->length + 6, val, strlen(val)); memcpy(c->buf + c->length + 6, val, strlen(val));
c->length += 6 + strlen(val); c->length += 6 + strlen(val);
} }
@ -1877,9 +1883,10 @@ static void controls(controlt * c, uint16_t avp, char *val, uint8_t m)
static void controlb(controlt * c, uint16_t avp, uint8_t *val, unsigned int len, uint8_t m) static void controlb(controlt * c, uint16_t avp, uint8_t *val, unsigned int len, uint8_t m)
{ {
uint16_t l = ((m ? 0x8000 : 0) + len + 6); uint16_t l = ((m ? 0x8000 : 0) + len + 6);
*(uint16_t *) (c->buf + c->length + 0) = htons(l); uint16_t *pint16 = (uint16_t *) (c->buf + c->length + 0);
*(uint16_t *) (c->buf + c->length + 2) = htons(0); pint16[0] = htons(l);
*(uint16_t *) (c->buf + c->length + 4) = htons(avp); pint16[1] = htons(0);
pint16[2] = htons(avp);
memcpy(c->buf + c->length + 6, val, len); memcpy(c->buf + c->length + 6, val, len);
c->length += 6 + len; c->length += 6 + len;
} }
@ -1924,10 +1931,11 @@ static void controlnull(tunnelidt t)
// add a control message to a tunnel, and send if within window // add a control message to a tunnel, and send if within window
static void controladd(controlt *c, sessionidt far, tunnelidt t) static void controladd(controlt *c, sessionidt far, tunnelidt t)
{ {
*(uint16_t *) (c->buf + 2) = htons(c->length); // length uint16_t *pint16 = (uint16_t *) (c->buf + 2);
*(uint16_t *) (c->buf + 4) = htons(tunnel[t].far); // tunnel pint16[0] = htons(c->length); // length
*(uint16_t *) (c->buf + 6) = htons(far); // session pint16[1] = htons(tunnel[t].far); // tunnel
*(uint16_t *) (c->buf + 8) = htons(tunnel[t].ns); // sequence pint16[2] = htons(far); // session
pint16[3] = htons(tunnel[t].ns); // sequence
tunnel[t].ns++; // advance sequence tunnel[t].ns++; // advance sequence
// link in message in to queue // link in message in to queue
if (tunnel[t].controlc) if (tunnel[t].controlc)
@ -6275,7 +6283,7 @@ void become_master(void)
} }
} }
int cmd_show_hist_idle(struct cli_def *cli, char *command, char **argv, int argc) int cmd_show_hist_idle(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int s, i; int s, i;
int count = 0; int count = 0;
@ -6313,7 +6321,7 @@ int cmd_show_hist_idle(struct cli_def *cli, char *command, char **argv, int argc
return CLI_OK; return CLI_OK;
} }
int cmd_show_hist_open(struct cli_def *cli, char *command, char **argv, int argc) int cmd_show_hist_open(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int s, i; int s, i;
int count = 0; int count = 0;

View file

@ -948,9 +948,9 @@ void processipout(uint8_t *buf, int len);
void snoop_send_packet(uint8_t *packet, uint16_t size, in_addr_t destination, uint16_t port); void snoop_send_packet(uint8_t *packet, uint16_t size, in_addr_t destination, uint16_t port);
int find_filter(char const *name, size_t len); int find_filter(char const *name, size_t len);
int ip_filter(uint8_t *buf, int len, uint8_t filter); int ip_filter(uint8_t *buf, int len, uint8_t filter);
int cmd_show_ipcache(struct cli_def *cli, char *command, char **argv, int argc); int cmd_show_ipcache(struct cli_def *cli, const char *command, char **argv, int argc);
int cmd_show_hist_idle(struct cli_def *cli, char *command, char **argv, int argc); int cmd_show_hist_idle(struct cli_def *cli, const char *command, char **argv, int argc);
int cmd_show_hist_open(struct cli_def *cli, char *command, char **argv, int argc); int cmd_show_hist_open(struct cli_def *cli, const char *command, char **argv, int argc);
tunnelidt lac_new_tunnel(); tunnelidt lac_new_tunnel();
void lac_tunnelclear(tunnelidt t); void lac_tunnelclear(tunnelidt t);
void lac_send_SCCRQ(tunnelidt t, uint8_t * auth, unsigned int auth_len); void lac_send_SCCRQ(tunnelidt t, uint8_t * auth, unsigned int auth_len);

2
tbf.c
View file

@ -307,7 +307,7 @@ int tbf_run_timer(void)
return 1; return 1;
} }
int cmd_show_tbf(struct cli_def *cli, char *command, char **argv, int argc) int cmd_show_tbf(struct cli_def *cli, const char *command, char **argv, int argc)
{ {
int i; int i;
int count = 0; int count = 0;

2
tbf.h
View file

@ -40,6 +40,6 @@ int new_tbf(int sid, int max_credit, int rate, void (*f)(sessionidt, uint8_t *,
int free_tbf(int tid); int free_tbf(int tid);
void fsck_tbfs(void); void fsck_tbfs(void);
int cmd_show_tbf(struct cli_def *cli, char *command, char **argv, int argc); int cmd_show_tbf(struct cli_def *cli, const char *command, char **argv, int argc);
#endif /* __TBF_H__ */ #endif /* __TBF_H__ */