Added TCP/IP trafic limits
This commit is contained in:
parent
8ffd82f9f2
commit
4462d9febb
@ -4604,6 +4604,9 @@ v0.33.20 10-Feb-2002
|
||||
Added support for ext3 filesystem in diskspace check.
|
||||
Fixed lharc archives return code to LHA.
|
||||
|
||||
clcomm.a
|
||||
Added counter for mailer TCP/IP sessions.
|
||||
|
||||
mbsetup:
|
||||
In message groups added default settings for auto area
|
||||
creation.
|
||||
@ -4691,6 +4694,10 @@ v0.33.20 10-Feb-2002
|
||||
mbcico gets the tty to use as option on the commandline.
|
||||
Keeps track of the number of mailers running.
|
||||
Added default path for arealists.
|
||||
Keeps track of total mailer TCP/IP sessions and will not start
|
||||
new sessions if the limit from the setup is reached. This will
|
||||
hopefully prevent that mbcico will use too much bandwidth on
|
||||
TCP/IP trafic.
|
||||
|
||||
mbcico:
|
||||
Fixed binkp driver to accept incoming unprotected sessions.
|
||||
@ -4702,6 +4709,7 @@ v0.33.20 10-Feb-2002
|
||||
Disabled creation of .spl files dusing mail sessions for test.
|
||||
Added experimental support for binkp GET command frame, under
|
||||
test now.
|
||||
Registers TCP/IP sessions with mbtask.
|
||||
|
||||
mbout:
|
||||
The status display has now 9 digits for the outbound size.
|
||||
|
@ -336,6 +336,13 @@ void IsDoing(const char *format, ...)
|
||||
|
||||
|
||||
|
||||
void RegTCP(void)
|
||||
{
|
||||
SockS("ATCP:1,%d;", mypid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetTTY(char *tty)
|
||||
{
|
||||
SockS("ATTY:2,%d,%s;", mypid, tty);
|
||||
|
@ -65,6 +65,7 @@ char *SockR(const char *, ...);
|
||||
void WriteError(const char *, ...);
|
||||
void Syslog(int, const char *, ...);
|
||||
void Syslogp(int, char *);
|
||||
void RegTCP(void);
|
||||
void IsDoing(const char *, ...);
|
||||
void SetTTY(char *);
|
||||
void UserCity(pid_t, char *, char *);
|
||||
|
@ -185,6 +185,7 @@ int call(faddr *addr)
|
||||
* If we have an internet address, set protocol
|
||||
*/
|
||||
if (inetaddr) {
|
||||
RegTCP();
|
||||
Syslog('d', "TCP/IP node \"%s\"", MBSE_SS(inetaddr));
|
||||
|
||||
if (tcp_mode == TCPMODE_NONE) {
|
||||
@ -207,8 +208,11 @@ int call(faddr *addr)
|
||||
Syslog('d', "TCP mode set to %d", tcp_mode);
|
||||
}
|
||||
} else {
|
||||
Syslog('d', "No IP address, fallback to dial");
|
||||
tcp_mode = TCPMODE_NONE;
|
||||
WriteError("No IP address, abort call");
|
||||
rc = ST_NOCALL8;
|
||||
putstatus(addr, 10, rc);
|
||||
nodeulock(addr);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,6 +256,7 @@ int main(int argc, char *argv[])
|
||||
die(101);
|
||||
}
|
||||
free(p);
|
||||
RegTCP();
|
||||
break;
|
||||
|
||||
case 'a': inetaddr = optarg;
|
||||
|
@ -101,6 +101,7 @@ extern int isdn_lines; /* ISDN lines available */
|
||||
extern int pots_free; /* POTS lines free */
|
||||
extern int isdn_free; /* ISDN lines free */
|
||||
extern pp_list *pl; /* List of tty ports */
|
||||
extern int ipmailers; /* TCP/IP mail sessions */
|
||||
|
||||
|
||||
|
||||
@ -1157,7 +1158,7 @@ void scheduler(void)
|
||||
*/
|
||||
if (calllist[call_entry].addr.zone && !calllist[call_entry].calling &&
|
||||
(calllist[call_entry].cst.trytime < now)) {
|
||||
if ((calllist[call_entry].callmode == CM_INET) && (runtasktype(CM_INET) < TCFG.max_tcp) && internet) {
|
||||
if ((calllist[call_entry].callmode == CM_INET) && (ipmailers < TCFG.max_tcp) && internet) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -143,6 +143,20 @@ char *exe_cmd(char *in)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ATCP:1,pid;
|
||||
* 100:0;
|
||||
* 200:1,Syntax Error;
|
||||
*/
|
||||
if (strncmp(cmd, "ATCP", 4) == 0) {
|
||||
if (reg_ip(token) == 0)
|
||||
return obuf;
|
||||
else {
|
||||
stat_inc_serr();
|
||||
return ebuf;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ATTY:2,pid,tty;
|
||||
* 100:0;
|
||||
|
@ -37,6 +37,7 @@
|
||||
extern reg_info reginfo[MAXCLIENT]; /* Array with clients */
|
||||
static int entrypos = 0; /* Status pointer */
|
||||
static int mailers = 0; /* Registered mailers */
|
||||
int ipmailers = 0; /* TCP/IP mail sessions */
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@ -104,7 +105,8 @@ int reg_newcon(char *data)
|
||||
stat_inc_clients();
|
||||
if (strcmp(prg, (char *)"mbcico") == 0)
|
||||
mailers++;
|
||||
tasklog('-', "Registered client pgm \"%s\", pid %s, slot %d, mailers %d", prg, pid, retval, mailers);
|
||||
tasklog('-', "Registered client pgm \"%s\", pid %s, slot %d, mailers %d, TCP/IP %d",
|
||||
prg, pid, retval, mailers, ipmailers);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -122,7 +124,10 @@ int reg_closecon(char *data)
|
||||
|
||||
if (strcmp(reginfo[rec].prg, (char *)"mbcico") == 0)
|
||||
mailers--;
|
||||
tasklog('-', "Unregistered client pgm \"%s\", pid %s, slot %d, mailers %d", reginfo[rec].prg, pid, rec, mailers);
|
||||
if (reginfo[rec].istcp)
|
||||
ipmailers--;
|
||||
tasklog('-', "Unregistered client pgm \"%s\", pid %s, slot %d, mailers %d, TCP/IP %d",
|
||||
reginfo[rec].prg, pid, rec, mailers, ipmailers);
|
||||
memset(®info[rec], 0, sizeof(reg_info));
|
||||
stat_dec_clients();
|
||||
return 0;
|
||||
@ -145,8 +150,10 @@ void reg_check(void)
|
||||
if (errno == ESRCH) {
|
||||
if (strcmp(reginfo[i].prg, (char *)"mbcico") == 0)
|
||||
mailers--;
|
||||
tasklog('?', "Stale registration found for pid %d (%s), mailers now %d",
|
||||
reginfo[i].pid, reginfo[i].prg, mailers);
|
||||
if (reginfo[i].istcp)
|
||||
ipmailers--;
|
||||
tasklog('?', "Stale registration found for pid %d (%s), mailers now %d, TCP/IP now %d",
|
||||
reginfo[i].pid, reginfo[i].prg, mailers, ipmailers);
|
||||
memset(®info[i], 0, sizeof(reg_info));
|
||||
stat_dec_clients();
|
||||
}
|
||||
@ -197,6 +204,29 @@ int reg_doing(char *data)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Registrate connection as TCP/IP connection
|
||||
*/
|
||||
int reg_ip(char *data)
|
||||
{
|
||||
char *cnt, *pid;
|
||||
int rec;
|
||||
|
||||
cnt = strtok(data, ",");
|
||||
pid = strtok(NULL, ";");
|
||||
|
||||
if ((rec = reg_find(pid)) == -1)
|
||||
return -1;
|
||||
|
||||
reginfo[rec].istcp = TRUE;
|
||||
reginfo[rec].lastcon = time(NULL);
|
||||
ipmailers++;
|
||||
tasklog('?', "TCP/IP session registered, now %d sessions", ipmailers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Update timer using NOP
|
||||
*/
|
||||
|
@ -22,6 +22,7 @@ typedef struct _reg_info {
|
||||
unsigned silent : 1; /* Do not disturb */
|
||||
unsigned chatting : 1; /* User is chatting */
|
||||
unsigned ismsg : 1; /* Message waiting */
|
||||
unsigned istcp : 1; /* Is a TCP/IP session */
|
||||
int channel; /* Chat channel */
|
||||
int ptr_in; /* Input buffer pointer */
|
||||
int ptr_out; /* Output buffer ptr */
|
||||
@ -30,11 +31,13 @@ typedef struct _reg_info {
|
||||
} reg_info;
|
||||
|
||||
|
||||
|
||||
void reg_init(void);
|
||||
int reg_newcon(char *);
|
||||
int reg_closecon(char *);
|
||||
void reg_check(void);
|
||||
int reg_doing(char *);
|
||||
int reg_ip(char *);
|
||||
int reg_nop(char *);
|
||||
int reg_timer(int, char *);
|
||||
int reg_tty(char *);
|
||||
|
Reference in New Issue
Block a user