X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/ffb34a8a9891e625cccebd7ec3454567ed5d94cd..cb031e775d57da45299c8dfdfabe7240705338e7:/cli.c diff --git a/cli.c b/cli.c index 75bbe05..e590069 100644 --- a/cli.c +++ b/cli.c @@ -2,7 +2,7 @@ // vim: sw=8 ts=8 char const *cvs_name = "$Name: $"; -char const *cvs_id_cli = "$Id: cli.c,v 1.71 2005/12/06 09:43:42 bodea Exp $"; +char const *cvs_id_cli = "$Id: cli.c,v 1.75 2006/08/02 13:35:39 bodea Exp $"; #include #include @@ -36,6 +36,7 @@ char const *cvs_id_cli = "$Id: cli.c,v 1.71 2005/12/06 09:43:42 bodea Exp $"; #endif extern tunnelt *tunnel; +extern bundlet *bundle; extern sessiont *session; extern radiust *radius; extern ippoolt *ip_address_pool; @@ -268,7 +269,7 @@ void init_cli(char *hostname) } memset(&addr, 0, sizeof(addr)); - clifd = socket(PF_INET, SOCK_STREAM, 6); + clifd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); setsockopt(clifd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); { int flags; @@ -425,6 +426,18 @@ static int cmd_show_session(struct cli_def *cli, char *command, char **argv, int cli_print(cli, "\tUnique SID:\t%u", session[s].unique_id); cli_print(cli, "\tOpened:\t\t%u seconds", session[s].opened ? abs(time_now - session[s].opened) : 0); cli_print(cli, "\tIdle time:\t%u seconds", session[s].last_packet ? abs(time_now - session[s].last_packet) : 0); + if (session[s].session_timeout) + { + clockt opened = session[s].opened; + if (session[s].bundle && bundle[session[s].bundle].num_of_links > 1) + opened = bundle[session[s].bundle].online_time; + + cli_print(cli, "\tSess Timeout:\t%u seconds", session[s].session_timeout - (opened ? abs(time_now - opened) : 0)); + } + + if (session[s].idle_timeout) + cli_print(cli, "\tIdle Timeout:\t%u seconds", session[s].idle_timeout - (session[s].last_data ? abs(time_now - session[s].last_data) : 0)); + cli_print(cli, "\tBytes In/Out:\t%u/%u", session[s].cout, session[s].cin); cli_print(cli, "\tPkts In/Out:\t%u/%u", session[s].pout, session[s].pin); cli_print(cli, "\tMRU:\t\t%d", session[s].mru);