After being port- and addressscanned continously from several sources where

my line stayed open for more than eight hours i decided to implement a
maximum connection time; see keyword maxconnecttime in the manual page.
This commit is contained in:
Hellmuth Michaelis 2001-07-21 11:29:40 +00:00
parent bfae45aa43
commit f7055f1626
6 changed files with 41 additions and 10 deletions

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Wed May 2 09:34:44 2001]
* last edit-date: [Fri Jul 20 19:17:29 2001]
*
*---------------------------------------------------------------------------*/
@ -380,6 +380,8 @@ typedef struct cfg_entry {
int frommin;
int tohr;
int tomin;
time_t maxconnecttime; /* maximum connection time */
/*===========================================================================*/
/*============ filled in after start, then dynamic ==========================*/

View File

@ -24,9 +24,9 @@
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon May 21 11:20:26 2001]
.\" last edit-date: [Sat Jul 21 13:27:41 2001]
.\"
.Dd May 21, 2001
.Dd July 21, 2001
.Dt ISDND.RC 5
.Os
.Sh NAME
@ -597,6 +597,15 @@ Its purpose is to
use this name in the full-screen display for easy identification of a link
to a remote site and for accounting purposes.
(mandatory)
.It Li maxconnecttime
Specify a maximum connection time in seconds. Use this to define an absolute
upper limit for a connection on the B-channel to last.
.Em CAUTION:
This feature is used to limit the connection time, _not_ number of attempts
to establish a connection: when using this please take care to also enable
the use of budgets to limit the connection establish attempts (otherwise
the line will cycle thru an endless loop of connections and reconnections
which will have an undesired effect on your telco bill) !
.It Li ppp-auth-paranoid
If set to
.Em no ,

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Wed Jan 10 14:46:58 2001]
* last edit-date: [Fri Jul 20 19:16:27 2001]
*
*---------------------------------------------------------------------------*/
@ -790,6 +790,11 @@ cfg_setval(int keyword)
DBGL(DL_RCCF, (log(LL_DBG, "system: mailto = %s", yylval.str)));
break;
case MAXCONNECTTIME:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: maxconnecttime = %d", entrycount, yylval.num)));
cfg_entry_tab[entrycount].maxconnecttime = yylval.num;
break;
case MONITORPORT:
monitorport = yylval.num;
DBGL(DL_RCCF, (log(LL_DBG, "system: monitorport = %d", yylval.num)));

View File

@ -32,7 +32,7 @@
*
* $FreeBSD$
*
* last edit-date: [Mon May 21 11:22:21 2001]
* last edit-date: [Fri Jul 20 19:14:23 2001]
*
*---------------------------------------------------------------------------*/
@ -121,6 +121,7 @@ int controllercount = -1;
%token LOGEVENTS
%token MAILER
%token MAILTO
%token MAXCONNECTTIME
%token MONITOR
%token MONITORACCESS
%token MONITORPORT
@ -465,6 +466,7 @@ numkeyword: ALERT { $$ = ALERT; }
| USRDEVICEUNIT { $$ = USRDEVICEUNIT; }
| DOWNTIME { $$ = DOWNTIME; }
| DOWNTRIES { $$ = DOWNTRIES; }
| MAXCONNECTTIME { $$ = MAXCONNECTTIME; }
;
boolkeyword: BUDGETCALLBACKSFILEROTATE { $$ = BUDGETCALLBACKSFILEROTATE; }

View File

@ -32,7 +32,7 @@
*
* $FreeBSD$
*
* last edit-date: [Mon May 21 11:22:38 2001]
* last edit-date: [Fri Jul 20 19:14:55 2001]
*
*---------------------------------------------------------------------------*/
@ -131,6 +131,7 @@ local-phone-dialout { return LOCAL_PHONE_DIALOUT; }
local-phone-incoming { return LOCAL_PHONE_INCOMING; }
mailer { return MAILER; }
mailto { return MAILTO; }
maxconnecttime { return MAXCONNECTTIME; }
monitor-allowed { return MONITORSW; }
monitor-port { return MONITORPORT; }
monitor { return MONITOR; }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -27,11 +27,9 @@
* i4b daemon - timer/timing support routines
* ------------------------------------------
*
* $Id: timer.c,v 1.21 2000/05/03 09:32:38 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Tue May 2 15:58:31 2000]
* last edit-date: [Fri Jul 20 20:29:28 2001]
*
*---------------------------------------------------------------------------*/
@ -227,6 +225,20 @@ handle_active(cfg_entry_t *cep, time_t now)
next_state(cep, EV_DRQ);
}
/* check maximum connect time reached */
if(cep->maxconnecttime > 0 && cep->connect_time > 0)
{
int connecttime = (int)difftime(now, cep->connect_time);
if(connecttime > cep->maxconnecttime)
{
DBGL(DL_RCVRY, (log(LL_DBG,
"handle_active: entry %s, maxconnecttime %d reached!",
cep->name, cep->maxconnecttime)));
next_state(cep, EV_DRQ);
}
}
/*
* if shorthold mode is rates based, check if
* we entered a time with a new unit length