// vim: sw=8 ts=8
char const *cvs_name = "$Name: $";
-char const *cvs_id_cli = "$Id: cli.c,v 1.74 2006-06-11 12:46:18 bodea Exp $";
+char const *cvs_id_cli = "$Id: cli.c,v 1.75 2006-08-02 13:35:39 bodea Exp $";
#include <stdio.h>
#include <stddef.h>
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)
- cli_print(cli, "\tSess Timeout:\t%u seconds", session[s].session_timeout - (session[s].opened ? abs(time_now - session[s].opened) : 0));
+ {
+ 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);
- if (session[s].timeout)
- {
- cli_print(cli, "\tRemaing time:\t%u",
- (session[s].bundle && bundle[session[s].bundle].num_of_links > 1)
- ? (unsigned) (session[s].timeout - bundle[session[s].bundle].online_time)
- : (unsigned) (session[s].timeout - (time_now - session[s].opened)));
- }
-
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);
cli_print(cli, "\tRx Speed:\t%u", session[s].rx_connect_speed);
}
// Show Summary
- cli_print(cli, "%5s %4s %-32s %-15s %s %s %s %s %10s %10s %10s %4s %10s %-15s %s",
+ cli_print(cli, "%5s %4s %-32s %-15s %s %s %s %s %10s %10s %10s %4s %-15s %s",
"SID",
"TID",
"Username",
"downloaded",
"uploaded",
"idle",
- "Rem.Time",
"LAC",
"CLI");
for (i = 1; i < MAXSESSION; i++)
{
- uint32_t rem_time;
if (!session[i].opened) continue;
- if (session[i].bundle && bundle[session[i].bundle].num_of_links > 1)
- rem_time = session[i].timeout ? (session[i].timeout - bundle[session[i].bundle].online_time) : 0;
- else
- rem_time = session[i].timeout ? (session[i].timeout - (time_now-session[i].opened)) : 0;
-
- cli_print(cli, "%5d %4d %-32s %-15s %s %s %s %s %10u %10lu %10lu %4u %10lu %-15s %s",
+ cli_print(cli, "%5d %4d %-32s %-15s %s %s %s %s %10u %10lu %10lu %4u %-15s %s",
i,
session[i].tunnel,
session[i].user[0] ? session[i].user : "*",
(unsigned long)session[i].cout,
(unsigned long)session[i].cin,
abs(time_now - (session[i].last_packet ? session[i].last_packet : time_now)),
- (unsigned long)(rem_time),
fmtaddr(htonl(tunnel[ session[i].tunnel ].ip), 1),
session[i].calling[0] ? session[i].calling : "*");
}
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
// vim: sw=8 ts=8
-char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.170 2006-07-01 14:07:35 bodea Exp $";
+char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.171 2006-08-02 13:35:39 bodea Exp $";
#include <arpa/inet.h>
#include <assert.h>
continue;
}
- // check for timed out sessions
- if (session[s].timeout)
- {
- bundleidt bid = session[s].bundle;
- if (bid)
- {
- clockt curr_time = time_now;
- if (curr_time - bundle[bid].last_check >= 1)
- {
- bundle[bid].online_time += (curr_time-bundle[bid].last_check)*bundle[bid].num_of_links;
- bundle[bid].last_check = curr_time;
- if (bundle[bid].online_time >= session[s].timeout)
- {
- int ses;
- for (ses = bundle[bid].num_of_links - 1; ses >= 0; ses--)
- {
- sessionshutdown(bundle[bid].members[ses], "Session timeout", CDN_ADMIN_DISC, TERM_SESSION_TIMEOUT);
- s_actions++;
- continue;
- }
- }
- }
- }
- else if (session[s].timeout <= time_now - session[s].opened)
- {
- sessionshutdown(s, "Session timeout", CDN_ADMIN_DISC, TERM_SESSION_TIMEOUT);
- s_actions++;
- continue;
- }
- }
-
// PPP timeouts
if (sess_local[s].lcp.restart <= time_now)
{
}
// Drop sessions who have reached session_timeout seconds
- if (session[s].session_timeout && (time_now - session[s].opened >= session[s].session_timeout))
+ if (session[s].session_timeout)
{
- sessionshutdown(s, "Session Timeout Reached", CDN_ADMIN_DISC, TERM_SESSION_TIMEOUT);
- STAT(session_timeout);
- s_actions++;
- continue;
+ bundleidt bid = session[s].bundle;
+ if (bid)
+ {
+ if (time_now - bundle[bid].last_check >= 1)
+ {
+ bundle[bid].online_time += (time_now - bundle[bid].last_check) * bundle[bid].num_of_links;
+ bundle[bid].last_check = time_now;
+ if (bundle[bid].online_time >= session[s].session_timeout)
+ {
+ int ses;
+ for (ses = bundle[bid].num_of_links - 1; ses >= 0; ses--)
+ {
+ sessionshutdown(bundle[bid].members[ses], "Session timeout", CDN_ADMIN_DISC, TERM_SESSION_TIMEOUT);
+ s_actions++;
+ continue;
+ }
+ }
+ }
+ }
+ else if (time_now - session[s].opened >= session[s].session_timeout)
+ {
+ sessionshutdown(s, "Session timeout", CDN_ADMIN_DISC, TERM_SESSION_TIMEOUT);
+ s_actions++;
+ continue;
+ }
}
// Drop sessions who have reached idle_timeout seconds
// L2TPNS Global Stuff
-// $Id: l2tpns.h,v 1.118 2006-07-01 12:40:17 bodea Exp $
+// $Id: l2tpns.h,v 1.119 2006-08-02 13:35:39 bodea Exp $
#ifndef __L2TPNS_H__
#define __L2TPNS_H__
char calling[MAXTEL]; // calling number
uint32_t tx_connect_speed;
uint32_t rx_connect_speed;
- clockt timeout; // Session timeout
uint32_t mrru; // Multilink Max-Receive-Reconstructed-Unit
uint8_t mssf; // Multilink Short Sequence Number Header Format
epdist epdis; // Multilink Endpoint Discriminator
// L2TPNS PPP Stuff
-char const *cvs_id_ppp = "$Id: ppp.c,v 1.101 2006-06-03 08:16:46 bodea Exp $";
+char const *cvs_id_ppp = "$Id: ppp.c,v 1.102 2006-08-02 13:35:39 bodea Exp $";
#include <stdio.h>
#include <string.h>
session[s].ip = session[first_ses].ip;
session[s].dns1 = session[first_ses].dns1;
session[s].dns2 = session[first_ses].dns2;
- session[s].timeout = session[first_ses].timeout;
+ session[s].session_timeout = session[first_ses].session_timeout;
ipcp_open(s, t);
}
else
// L2TPNS Radius Stuff
-char const *cvs_id_radius = "$Id: radius.c,v 1.53 2006-08-02 12:54:45 bodea Exp $";
+char const *cvs_id_radius = "$Id: radius.c,v 1.54 2006-08-02 13:35:39 bodea Exp $";
#include <time.h>
#include <stdio.h>
LOG(3, s, session[s].tunnel, " Radius reply contains primary DNS address %s\n",
fmtaddr(htonl(session[s].dns1), 0));
}
- else if (*p == 27)
- {
- // Session timeout
- if (p[1] < 6) {
- LOG(2, s, session[s].tunnel, "Error: Received Session timeout with length %d < 6\n", p[1]);
- continue;
- }
-
- session[s].timeout = ntohl(*(uint32_t *) (p + 2));
- LOG(3, s, session[s].tunnel, " Radius reply contains Session timeout %d\n", session[s].timeout);
- if (!session[s].timeout)
- sessionshutdown(s, "Session timeout is zero", CDN_ADMIN_DISC, TERM_SESSION_TIMEOUT);
- }
else if (*p == 136)
{
// DNS address
else if (*p == 27)
{
// Session-Timeout
- uint32_t to = ntohl(*(uint32_t *)(p + 2));
-
- LOG(3, s, session[s].tunnel, " Radius reply contains Session-Timeout = %u\n", to);
- if (to > 0)
- {
- session[s].session_timeout = to;
- }
+ if (p[1] < 6) continue;
+ session[s].session_timeout = ntohl(*(uint32_t *)(p + 2));
+ LOG(3, s, session[s].tunnel, " Radius reply contains Session-Timeout = %u\n", session[s].session_timeout);
}
else if (*p == 28)
{
// Idle-Timeout
- uint32_t to = ntohl(*(uint32_t *)(p + 2));
-
- LOG(3, s, session[s].tunnel, " Radius reply contains Idle-Timeout = %u\n", to);
- if (to > 0)
- {
- session[s].idle_timeout = to;
- }
+ if (p[1] < 6) continue;
+ session[s].idle_timeout = ntohl(*(uint32_t *)(p + 2));
+ LOG(3, s, session[s].tunnel, " Radius reply contains Idle-Timeout = %u\n", session[s].idle_timeout);
}
else if (*p == 26 && p[1] >= 7)
{