summaryrefslogtreecommitdiffstats
path: root/usr.sbin/i4b
diff options
context:
space:
mode:
authorhm <hm@FreeBSD.org>2001-07-21 11:29:40 +0000
committerhm <hm@FreeBSD.org>2001-07-21 11:29:40 +0000
commit5276a48c0f55b5d7d43ee87dd77c16aa33f49e14 (patch)
tree3583165b1bf1a5fe357b3e0ec9a13e8bb2dd3f7e /usr.sbin/i4b
parenta67f578d2b31873dd3b9906157d4998436a6b327 (diff)
downloadFreeBSD-src-5276a48c0f55b5d7d43ee87dd77c16aa33f49e14.zip
FreeBSD-src-5276a48c0f55b5d7d43ee87dd77c16aa33f49e14.tar.gz
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.
Diffstat (limited to 'usr.sbin/i4b')
-rw-r--r--usr.sbin/i4b/isdnd/isdnd.h4
-rw-r--r--usr.sbin/i4b/isdnd/isdnd.rc.513
-rw-r--r--usr.sbin/i4b/isdnd/rc_config.c7
-rw-r--r--usr.sbin/i4b/isdnd/rc_parse.y4
-rw-r--r--usr.sbin/i4b/isdnd/rc_scan.l3
-rw-r--r--usr.sbin/i4b/isdnd/timer.c20
6 files changed, 41 insertions, 10 deletions
diff --git a/usr.sbin/i4b/isdnd/isdnd.h b/usr.sbin/i4b/isdnd/isdnd.h
index fb88546..863bf7c 100644
--- a/usr.sbin/i4b/isdnd/isdnd.h
+++ b/usr.sbin/i4b/isdnd/isdnd.h
@@ -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 ==========================*/
diff --git a/usr.sbin/i4b/isdnd/isdnd.rc.5 b/usr.sbin/i4b/isdnd/isdnd.rc.5
index ee5be5c..1bcfff9 100644
--- a/usr.sbin/i4b/isdnd/isdnd.rc.5
+++ b/usr.sbin/i4b/isdnd/isdnd.rc.5
@@ -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 ,
diff --git a/usr.sbin/i4b/isdnd/rc_config.c b/usr.sbin/i4b/isdnd/rc_config.c
index 0b63a09..3c6a4cf 100644
--- a/usr.sbin/i4b/isdnd/rc_config.c
+++ b/usr.sbin/i4b/isdnd/rc_config.c
@@ -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)));
diff --git a/usr.sbin/i4b/isdnd/rc_parse.y b/usr.sbin/i4b/isdnd/rc_parse.y
index 2147325..529a6a8 100644
--- a/usr.sbin/i4b/isdnd/rc_parse.y
+++ b/usr.sbin/i4b/isdnd/rc_parse.y
@@ -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; }
diff --git a/usr.sbin/i4b/isdnd/rc_scan.l b/usr.sbin/i4b/isdnd/rc_scan.l
index c9bfce4..34a55dc 100644
--- a/usr.sbin/i4b/isdnd/rc_scan.l
+++ b/usr.sbin/i4b/isdnd/rc_scan.l
@@ -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; }
diff --git a/usr.sbin/i4b/isdnd/timer.c b/usr.sbin/i4b/isdnd/timer.c
index b2b7630..2632137 100644
--- a/usr.sbin/i4b/isdnd/timer.c
+++ b/usr.sbin/i4b/isdnd/timer.c
@@ -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
OpenPOWER on IntegriCloud