Merge from Master
[l2tpns.git] / cli.c
diff --git a/cli.c b/cli.c
index fc150d7..fee9319 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -21,7 +21,9 @@
 #include <dlfcn.h>
 #include <netdb.h>
 #include <libcli.h>
+#include <linux/rtnetlink.h>
 
+#include "dhcp6.h"
 #include "l2tpns.h"
 #include "constants.h"
 #include "util.h"
@@ -74,60 +76,61 @@ static char *debug_levels[] = {
 
 #endif
 
-static int cmd_show_session(struct cli_def *cli, 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_users(struct cli_def *cli, 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_version(struct cli_def *cli, 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_run(struct cli_def *cli, 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_plugins(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_show_throttle(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_write_memory(struct cli_def *cli, 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_tunnel(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_drop_session(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_snoop(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_throttle(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_no_throttle(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_debug(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_no_debug(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_set(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_remove_plugin(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_shutdown(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_reload(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_setforward(struct cli_def *cli, 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_session(struct cli_def *cli, const char *command, char **argv, int argc);
+static int cmd_show_group(struct cli_def *cli, const 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, const 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, const 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, const 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, const 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, const 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, const 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, const 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, const 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, const 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, const 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, const 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, const 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, const 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);
 
 #ifdef STATISTICS
-static int cmd_show_counters(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_clear_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, const char *command, char **argv, int argc);
 #endif /* STATISTICS */
 
 #ifdef BGP
 #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_neighbour(struct cli_def *cli, 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_show_bgp(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_suspend_bgp(struct cli_def *cli, 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_restart_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, const 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, const 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, const char *command, char **argv, int argc);
+static int cmd_restart_bgp(struct cli_def *cli, const char *command, char **argv, int argc);
 #endif /* BGP */
 
 #define MODE_CONFIG_NACL 9
-static int cmd_ip_access_list(struct cli_def *cli, 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_ip_access_list_rule(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_filter(struct cli_def *cli, char *command, char **argv, int argc);
-static int cmd_no_filter(struct cli_def *cli, 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_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, const 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, const 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, const char *command, char **argv, int argc);
 
 /* match if b is a substr of a */
 #define MATCH(a,b) (!strncmp((a), (b), strlen(b)))
@@ -154,6 +157,7 @@ void init_cli()
        cli_register_command(cli, c, "running-config", cmd_show_run, PRIVILEGE_PRIVILEGED, MODE_EXEC, "Show the currently running configuration");
        cli_register_command(cli, c, "remotelns-conf", cmd_show_rmtlnsconf, PRIVILEGE_PRIVILEGED, MODE_EXEC, "Show a list of remote LNS configuration");
        cli_register_command(cli, c, "session", cmd_show_session, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, "Show a list of sessions or details for a single session");
+       cli_register_command(cli, c, "group", cmd_show_group, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, "Show a list of groups or details for a single group");
        cli_register_command(cli, c, "tbf", cmd_show_tbf, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, "List all token bucket filters in use");
        cli_register_command(cli, c, "throttle", cmd_show_throttle, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, "List all throttled sessions and associated TBFs");
        cli_register_command(cli, c, "tunnels", cmd_show_tunnels, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, "Show a list of tunnels or details for a single tunnel");
@@ -354,7 +358,7 @@ void cli_do(int sockfd)
        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);
 }
@@ -403,7 +407,7 @@ int cli_arg_help(struct cli_def *cli, int cr_ok, char *entry, ...)
        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;
 
@@ -582,7 +586,7 @@ static int cmd_show_session(struct cli_def *cli, char *command, char **argv, int
        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;
        char *states[] = {
@@ -673,7 +677,7 @@ static int cmd_show_tunnels(struct cli_def *cli, char *command, char **argv, int
        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 *sargv[32];
@@ -715,7 +719,7 @@ static int cmd_show_users(struct cli_def *cli, char *command, char **argv, int a
 }
 
 #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)
                return CLI_HELP_NO_ARGS;
@@ -730,7 +734,7 @@ static int cmd_show_counters(struct cli_def *cli, char *command, char **argv, in
                        GET_STAT(tun_tx_bytes),
                        GET_STAT(tun_tx_packets),
                        GET_STAT(tun_tx_errors));
-       cli_print(cli, "");
+       cli_print(cli, " ");
 
        cli_print(cli, "%-10s %10s %10s %10s %10s", "Tunnel", "Bytes", "Packets", "Errors", "Retries");
        cli_print(cli, "%-10s %10u %10u %10u", "RX",
@@ -742,7 +746,7 @@ static int cmd_show_counters(struct cli_def *cli, char *command, char **argv, in
                        GET_STAT(tunnel_tx_packets),
                        GET_STAT(tunnel_tx_errors),
                        GET_STAT(tunnel_retries));
-       cli_print(cli, "");
+       cli_print(cli, " ");
 
        cli_print(cli, "%-30s%-10s", "Counter", "Value");
        cli_print(cli, "-----------------------------------------");
@@ -808,14 +812,14 @@ static int cmd_show_counters(struct cli_def *cli, char *command, char **argv, in
                char *p = strchr(t, '\n');
                if (p) *p = 0;
 
-               cli_print(cli, "");
+               cli_print(cli, " ");
                cli_print(cli, "Last counter reset %s", t);
        }
 
        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)
                return CLI_HELP_NO_ARGS;
@@ -828,7 +832,7 @@ static int cmd_clear_counters(struct cli_def *cli, char *command, char **argv, i
 }
 #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)
                return CLI_HELP_NO_ARGS;
@@ -837,7 +841,7 @@ static int cmd_show_version(struct cli_def *cli, char *command, char **argv, int
        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 used = 0, free = 0, show_all = 0;
@@ -899,13 +903,13 @@ static int cmd_show_pool(struct cli_def *cli, char *command, char **argv, int ar
 }
 
 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)
                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)
                return CLI_HELP_NO_ARGS;
@@ -928,7 +932,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 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;
        char ipv6addr[INET6_ADDRSTRLEN];
@@ -1025,7 +1029,7 @@ static int cmd_show_run(struct cli_def *cli, char *command, char **argv, int arg
        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;
        char *states[] = {
@@ -1080,7 +1084,7 @@ static int cmd_show_radius(struct cli_def *cli, char *command, char **argv, int
        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;
 
@@ -1095,7 +1099,7 @@ static int cmd_show_plugins(struct cli_def *cli, char *command, char **argv, int
        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;
 
@@ -1127,7 +1131,7 @@ static int cmd_show_throttle(struct cli_def *cli, char *command, char **argv, in
        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)
                return CLI_HELP_NO_ARGS;
@@ -1150,7 +1154,7 @@ static int cmd_show_banana(struct cli_def *cli, char *command, char **argv, int
        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;
        sessionidt s;
@@ -1191,7 +1195,7 @@ static int cmd_drop_user(struct cli_def *cli, char *command, char **argv, int ar
        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;
        tunnelidt t;
@@ -1241,7 +1245,7 @@ static int cmd_drop_tunnel(struct cli_def *cli, char *command, char **argv, int
        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;
        sessionidt s;
@@ -1291,7 +1295,7 @@ static int cmd_drop_session(struct cli_def *cli, char *command, char **argv, int
        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;
        uint16_t port;
@@ -1364,7 +1368,7 @@ static int cmd_snoop(struct cli_def *cli, char *command, char **argv, int argc)
        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;
        sessionidt s;
@@ -1402,7 +1406,7 @@ static int cmd_no_snoop(struct cli_def *cli, char *command, char **argv, int arg
        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_out = 0;
@@ -1530,7 +1534,7 @@ static int cmd_throttle(struct cli_def *cli, char *command, char **argv, int arg
        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;
        sessionidt s;
@@ -1575,7 +1579,7 @@ static int cmd_no_throttle(struct cli_def *cli, char *command, char **argv, int
        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;
 
@@ -1639,7 +1643,7 @@ static int cmd_debug(struct cli_def *cli, char *command, char **argv, int argc)
        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;
 
@@ -1685,7 +1689,7 @@ static int cmd_no_debug(struct cli_def *cli, char *command, char **argv, int arg
        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;
 
@@ -1720,7 +1724,7 @@ static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int
        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;
 
@@ -1781,7 +1785,7 @@ static char *duration(time_t secs)
        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;
        char buf[100], *p = buf, *loads[3];
@@ -1791,7 +1795,7 @@ static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc)
                return CLI_HELP_NO_ARGS;
 
        fh = fopen("/proc/loadavg", "r");
-       fgets(buf, 100, fh);
+       p = fgets(buf, 100, fh);
        fclose(fh);
 
        for (i = 0; i < 3; i++)
@@ -1817,7 +1821,7 @@ static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc)
        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;
 
@@ -1946,7 +1950,7 @@ int regular_stuff(struct cli_def *cli)
 }
 
 #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;
 
@@ -2012,7 +2016,7 @@ static int find_bgp_neighbour(char const *name)
        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 keepalive;
@@ -2156,7 +2160,7 @@ static int cmd_router_bgp_neighbour(struct cli_def *cli, char *command, char **a
        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;
 
@@ -2188,7 +2192,7 @@ static int cmd_router_bgp_no_neighbour(struct cli_def *cli, char *command, char
        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 hdr = 0;
@@ -2220,7 +2224,7 @@ static int cmd_show_bgp(struct cli_def *cli, char *command, char **argv, int arg
 
                if (!hdr++)
                {
-                       cli_print(cli, "");
+                       cli_print(cli, " ");
                        cli_print(cli, "Peer                  AS         Address "
                            "State       Retries Retry in Route Pend    Timers");
                        cli_print(cli, "------------------ ----- --------------- "
@@ -2243,7 +2247,7 @@ static int cmd_show_bgp(struct cli_def *cli, char *command, char **argv, int arg
        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;
        char *addr;
@@ -2276,7 +2280,7 @@ static int cmd_suspend_bgp(struct cli_def *cli, char *command, char **argv, int
        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;
        char *addr;
@@ -2310,7 +2314,7 @@ static int cmd_no_suspend_bgp(struct cli_def *cli, char *command, char **argv, i
        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;
        char *addr;
@@ -2438,12 +2442,12 @@ static int access_list(struct cli_def *cli, char **argv, int argc, int add)
        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);
 }
 
-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);
 }
@@ -2529,7 +2533,7 @@ static char const *show_access_list_rule(int extended, ip_filter_rulet *rule)
        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;
        struct in_addr addr;
@@ -2764,7 +2768,7 @@ static ip_filter_rulet *access_list_rule_ext(struct cli_def *cli, char *command,
        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;
        struct in_addr addr;
@@ -2880,7 +2884,7 @@ static ip_filter_rulet *access_list_rule_std(struct cli_def *cli, char *command,
        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;
        ip_filter_rulet *rule = ip_filters[filt].extended
@@ -2906,7 +2910,7 @@ static int cmd_ip_access_list_rule(struct cli_def *cli, char *command, char **ar
        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;
        int i;
@@ -3002,7 +3006,7 @@ static int cmd_filter(struct cli_def *cli, char *command, char **argv, int argc)
        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;
        sessionidt s;
@@ -3047,7 +3051,7 @@ static int cmd_no_filter(struct cli_def *cli, char *command, char **argv, int ar
        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;
 
@@ -3092,7 +3096,7 @@ static int cmd_show_access_list(struct cli_def *cli, char *command, char **argv,
        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)
                return CLI_HELP_NO_ARGS;
@@ -3101,7 +3105,7 @@ static int cmd_shutdown(struct cli_def *cli, char *command, char **argv, int arg
        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)
                return CLI_HELP_NO_ARGS;
@@ -3110,7 +3114,78 @@ static int cmd_reload(struct cli_def *cli, char *command, char **argv, int argc)
        return CLI_OK;
 }
 
-static int cmd_setforward(struct cli_def *cli, char *command, char **argv, int argc)
+static int cmd_show_group(struct cli_def *cli, const char *command, char **argv, int argc)
+{
+       int i;
+       groupidt g;
+
+       if (CLI_HELP_REQUESTED)
+               return cli_arg_help(cli, 1,
+                       "<1-%d>", MAXGROUPE-1, "Show specific group by id",
+                       NULL);
+
+       time(&time_now);
+       if (argc > 0)
+       {
+               // Show individual group
+               for (i = 0; i < argc; i++)
+               {
+                       sessionidt s;
+
+                       g = atoi(argv[i]);
+                       if (g <= 0 || g >= MAXGROUPE)
+                       {
+                               cli_print(cli, "Invalid group id \"%s\"", argv[i]);
+                               continue;
+                       }
+
+                       cli_print(cli, "\r\nGroup %d:", g);
+                       cli_print(cli, "\tNb Session:\t\t%d", grpsession[g].nbsession);
+                       cli_print(cli, "\tNb Routes:\t\t%d", grpsession[g].nbroutesgrp);
+                       cli_print(cli, "\ttime_changed:\t\t%d\n", grpsession[g].time_changed);
+
+                       for (i = 0; i < grpsession[g].nbsession; i++)
+                       {
+                               if ((s = grpsession[g].sesslist[i].sid))
+                               {
+                                       cli_print(cli, "\tSession:\t%d\tTx Rate:%d Kbps\t\t\tweight:\t%d",
+                                                               s,
+                                                               grpsession[g].sesslist[i].tx_rate/(1024/8),
+                                                               grpsession[g].sesslist[i].weight);
+                               }
+                       }
+
+                       for (i = 0; i < grpsession[g].nbroutesgrp; i++)
+                       {
+                               if (grpsession[g].route[i].ip != 0)
+                               {
+                                       cli_print(cli, "\tRoute:\t%s/%d", fmtaddr(htonl(grpsession[g].route[i].ip), 0), grpsession[g].route[i].prefixlen);
+                               }
+                       }
+               }
+               return CLI_OK;
+       }
+
+       // Show Summary
+       cli_print(cli, "%5s %7s %9s %12s",
+                       "GID",
+                       "Nb Sess",
+                       "Nb Routes",
+                       "Time changed");
+
+       for (g = gnextgrpid; g != 0; g = grpsession[g].prev)
+       {
+               cli_print(cli, "%5d %7d %9d %12d",
+                                       g,
+                                       grpsession[g].nbsession,
+                                       grpsession[g].nbroutesgrp,
+                                       grpsession[g].time_changed);
+       }
+
+       return CLI_OK;
+}
+
+static int cmd_setforward(struct cli_def *cli, const char *command, char **argv, int argc)
 {
        int ret;
 
@@ -3160,7 +3235,7 @@ static int cmd_setforward(struct cli_def *cli, char *command, char **argv, int a
        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;
        char strdisp[1024];