This commit is contained in:
Matthias Urlichs 1996-02-10 17:30:05 +01:00 committed by Harald Welte
parent 673bb12c8f
commit f2119ac17e
40 changed files with 408 additions and 314 deletions

59
DOKU
View File

@ -101,10 +101,12 @@ Die Konfigurationsdatei ist manchmal etwas undurchsichtig.
_Ich_ werde das nicht ändern, keine Zeit; wenn jemand ein Frontend
schreiben will -- nur zu!
Login über ISDN macht noch leichte Probleme.
Die Doku liegt nur auf deutsch vor.
Bei manchen Leuten hängt sich der Treiber bzw. der ganze Rechner bei
ankommenden (Voice-)anrufen kommentarlos auf. Ich konnte das leider bisher
nicht nachvollziehen...
Fragen? Probleme? (Gleich am Anfang, damit es keiner übersieht...)
=================
@ -424,6 +426,9 @@ AT/L Karte
up Verbindung steht
->down
->up Verbindung wird gerade ab- bzw. aufgebaut.
Zusätzlich kann hinter <Modus> erscheinen:
.N Nter Anwahlversuch
-N ... nachdem N Serien fehlgeschlagen sind.
<UnitNow> Einheiten in der aktuellen Verbindung.
<UnitAll> Einheiten insgesamt seit Start des Prozesses.
<Flags> interner Zustand der Verbindung, komma remote-Nummer,
@ -667,6 +672,12 @@ Alle anderen Zeilen werden von oben nach unten durchsucht; die erste
passende Zeile wird verwendet. (Beim Scannen der P-Zeilen werden Daten aus
passenden Folgezeilen ebenfalls berücksichtigt -- siehe unten.)
Bei Problemen (Ggeenstelle besetzt...) wird bei permanenten Verbindungen
ein paarmal probiert, dann werden anstehende Daten weggeworfen und die
Verbindung eine bestimmte (exponentiell wachsende (ja, das muß sein) Zeit
auf Eis gelegt. Ein ankommender Anruf weckt diese Verbindung
selbstverständlich wieder auf.
Konfigurationsdatei: Details
-------------------
@ -685,13 +696,11 @@ Alle Zeilentypen:
"ab" "cd" -> leere Menge
"ab" "xay" -> "a"
"ab" "+x" -> leere Menge
"ab" "+bx" -> "ab+bx"
"ab" "+bx" "a" -> leere Menge
Damit läßt sich sehr flexibel einstellen, wer auf welcher Leitung /
Nummer mit welchen Parametern anrufen kann.
Das Ganze ist noch optimierbar, aber ich bin zu faul...
insbesondere ist das obige "ab+bx" zu "ab" reduzierbar
(weil nur einer der hinter dem + angegebenen Flags gesetzt ist).
"ab" "+bx" -> "ab+bx" (oder "ab+b", aber _nicht_ "ab" oder "b")
"ab" "+bx" "a" -> leere Menge
"ab" "+bx" "+a" -> "ab+bx+a" (oder so ähnlich)
Damit läßt sich sehr flexibel einstellen, wer wann auf welcher
Leitung / Nummer mit welchen Parametern anrufen kann.
<Karte> ist der vierstellige Name der ISDN-Karte, der dieser beim Laden
des Treibers verpaßt wurde; üblich ist eine dreistellike Kennung
des Kartentyps und eine fortlaufende Numerierung.
@ -743,6 +752,10 @@ Parameter:
:fX Ankommende Anrufe, die (zB wegen besetzt) abgewiesen werden, werden
"schnell" abgelehnt. (Andere Geräte am Bus können nicht abheben, da die
Vermittlung nicht abwartet, ob sich noch jemand meldet.)
Dieses Flag ist bei aktivem Callback meistens notwendig, wenn der
andere B-Kanal anderweitig beschäftig ist, weil die Vermittlung den
ankommenden Ruf noch hält und den abgehenden wegen Kanalmangel abweist.
:-(
:fr Abgehende Anrufe, die nicht durchkommen, werden "sofort" und "oft"
wiederholt.
:ib Wenn ankommend kein B-Kanal mitgeliefert wird, wird die Verbindung
@ -936,12 +949,15 @@ Form:
TM <Key> <Zeitangabe>
Beispiel:
TM abcde SaSu,Am-Fr18-08
TM abcde SaSu,Mo-Fr18-08
Schlüssel für Zeiten. Zu der angegebenen Zeit werden nur Verbindungen
zugelassen, deren <Key>-Parameter mit dem angegebenen Key kompatibel ist.
Achtung: es wird immer der erste gefundene TM-Eintrag verwendet!
Die gefundenen Schlüsselwerte werden geODERt, d.h.
TM ab Wk
TM cd 08-10
wird, wenn am Montag um neun Uhr aufgerufen, zu "abcd" aufgelöst.
DL-Zeile ("Dial Local")
@ -1074,14 +1090,17 @@ Definition von Nummernpr
Das erste Präfix ist für abgehende, das zweite (das weggelassen werden kann)
für ankommende Verbindungen; 1TR6-Nebenstellenanlagen wollen beim Wählen
typischerweise eine vorgestellte Null o.ä. sehen, die aber bei ankommenden
Gesprächen nicht mit angezeigt wird.
Gesprächen nicht mit angezeigt wird. (Ich habe keine Ahnung, wie Gespräche
innerhalb einer Anlage signalisiert werden; zum Glück stirbt 1TR6 langsam
aber sicher aus.)
Die Zeichen sind _immer_ "+" für internationale Verbindungen, "=" für
nationale Verbindungen, "-" für Ortsverbindungen, "." für Nummern an einer
Nebenstellenanlage und "/" für EAZs/MSNs etc. Der Unterschied zwischen "."
und "/" ist, daß Nummern einer Nebenstellenanlage direkt angerufen werden
können, während man für eine Verbindung zu einer anderen MSN am gleichen
Basisanschluß die Teilnehmernummer mitwählen muß.
Basisanschluß die Teilnehmernummer mitwählen muß. In der DP-Zeile erscheint
folglich niemals ein "/".
Beispiel: Eine Konfiguration
D ... -1234/[456]
@ -1783,3 +1802,17 @@ aber nur eine Version korrekt um.
Workaround: Keiner.
Bugfix: Hersteller kräftig treten.
(2)
Manche Anlagen treiben es noch schlimmer und übergeben ankommende Anrufe
mit "unbekannter Nummerntyp" aber _ohne_ führende Null. Sorry, leider
daneben -- evtl. hilft :b1 in der DL-Zeile.
Noch schlimmer treibt es zB die Ackerman Euracom 181, Firmware 1.05, die
ankommend die Nebenstellennummer als "örtliche Nummer" kennzeichnet.
Workaround: Auch :b1. Abgesehen davon: Hersteller _kräftig_ treten, sowas
ist einfach Unsinn.
(3)
Die Niederländer übergeben die Einheiten nicht im dafür vorgesehenen
Format, sondern als DISPLAY-String. Grummel. :b2 in die DL-Zeile.

View File

@ -8,7 +8,7 @@ SUBDIRS = config include compat streams support isdn_3 isdn_4 tools \
all:: .diddepend
config::
make -C config
$(MAKE) -C config
dep: depend

13
README
View File

@ -4,6 +4,19 @@ Die Anleitung und der ganze Kram findet sich in der Datei DOKU, oder
README.isdn in den Kernelsourcen.
*** 1996-02-08
Update 35. Problem mit Euro-ISDN-Nebenstellenanlagen behoben.
Achtung: +000=00-0. in die DP-Zeile, der Punkt am Ende ist nicht ganz
unwichtig.
*** 1996-01-05
Update 34. Weitere Crashprobleme (hoffentlich) beseitigt.
Achtung: Alle zutreffenden Keys in TM-Zeilen werden nun geODERt.
*** 1996-01-03
Update 33. Timer wieder umgestellt. Testcode für automatische Anpassung des

View File

@ -808,7 +808,7 @@ prot (struct _isdn1_card * card, short channel, mblk_t * mp, int flags)
int err = -ERESTART;
hdlc_buf chan = &bp->chan[channel];
DEBUG(info) printf("%sBintecProt chan %d flags 0%o\n",KERN_DEBUG,channel,flags);
if(0)DEBUG(info) printf("%sBintecProt chan %d flags 0%o\n",KERN_DEBUG,channel,flags);
if(!(flags & ~CHP_FROMSTACK)) { /* Nothing else set? */
if ((err = m_getid (mp, &id)) != 0)
@ -895,9 +895,13 @@ static int
candata (struct _isdn1_card * card, short channel)
{
struct _bintec * bp = (struct _bintec *)card;
int ret;
DEBUG(info) if(channel == 0)printk("%sBintec: candata finds %d on chan %d polled %d\n",KERN_DEBUG,bp->chan[channel].q_out.nblocks,channel,bp->polled);
if(bp->waitmsg)
return 0;
return (bp->chan[channel].q_out.nblocks < 8);
ret = (bp->chan[channel].q_out.nblocks < 8);
DEBUG(info)if(bp->polled) bp->polled--;
return ret;
}
/*
@ -907,6 +911,7 @@ static int
data (struct _isdn1_card * card, short channel, mblk_t * data)
{
struct _bintec * bp = (struct _bintec *)card;
DEBUG(info) if(channel == 0)printk("%sBintec: data finds %d on chan %d polled %d\n",KERN_DEBUG,bp->chan[channel].q_out.nblocks,channel,bp->polled);
if(bp->waitmsg)
return -ENXIO;
S_enqueue(&bp->chan[channel].q_out, data);
@ -1112,13 +1117,16 @@ postproc(struct _bintec *bp, mblk_t *mb, int ch)
switch(capi->PRIM_type) {
case CAPI_ALIVE_IND:
err = 0;
#if 0
if((bp->chan[0].q_out.nblocks > 10) || !isdn2_canrecv(&bp->card,0)) {
DEBUG(info)printf("%sBINTEC: keepalive on upqueue\n",KERN_INFO);
goto def;
}
#endif
capi->PRIM_type = CAPI_ALIVE_RESP;
S_enqueue(&bp->chan[0].q_out,mb);
sendone(bp,0);
if(0)DEBUG(info)printf(".L.");
break;
case CAPI_DATAB3_IND:
{
@ -1451,31 +1459,23 @@ void NAME(REALNAME,intr)(int x)
#ifdef linux
void NAME(REALNAME,poll)(struct _bintec *bp)
#else
void NAME(REALNAME,poll)(void *nix)
#endif
{
#ifndef linux
struct _bintec *bp;
for(i=bintec_num-1;i>=0;--i)
long s;
s = splstr();
if(!bp->polled++) {
do {
splx(s);
DoIRQ(bp);
splstr();
} while(--bp->polled);
#if 0
if(bp->info.irq != 0)
unblock_irq(bp->info.irq);
#endif
{
#ifndef linux
bp = &bintecdata[i];
#endif
if(!bp->polled++) {
do {
DoIRQ(bp);
} while(--bp->polled);
#if 0 /* def linux */
if(bp->info.irq != 0)
unblock_irq(bp->info.irq);
#endif
} else
bp->polled--;
}
} else
bp->polled--;
splx(s);
}
@ -1530,6 +1530,7 @@ int NAME(REALNAME,init)(struct cardinfo *inf)
return -EIO;
}
#endif
if((err = isdn2_register(&bp->card, bp->info.ID)) != 0) {
printf("not installed (ISDN_2), err %d\n",err);
kfree(bp);
@ -1538,12 +1539,10 @@ int NAME(REALNAME,init)(struct cardinfo *inf)
bp->polled = 0;
bp->registered = 1;
#ifdef linux
if(bp->info.irq == 0) {
printf("polling; ");
}
bintectimer(bp);
#endif
bp->next = bintecmap[bp->info.irq];
bintecmap[bp->info.irq] = bp;
printf("installed at ");

Binary file not shown.

Binary file not shown.

View File

@ -1,55 +0,0 @@
#include "f_module.h"
#include "isdn_limits.h"
#include <stddef.h>
#ifdef linux
#include <linux/sched.h>
#endif
#include "bintec.h"
#ifndef REALNAME
#error "You have to define REALNAME for this to work."
#endif
#define xxappxx(a,b) a##b
#define NAME(a,b) xxappxx(a,b) /* isn't C wonderful */
#define xxstrxx(a) #a
#define STRING(a) xxstrxx(a) /* ditto */
extern int NAME(REALNAME,init)(struct _bintec *bp);
extern void NAME(REALNAME,exit)(struct _bintec *bp);
struct _bintec bintec;
int irq = 0;
int mem = 0;
int io = 0;
int name = 0;
int debug = 0;
#ifdef MODULE
static int do_init_module(void)
{
if(name == 0) {
printf("You must name this card: insmod xxx.o name=$(cardname Foo0)\n");
return -EINVAL;
}
bintec.irq = irq;
bintec.ipl = 5;
bintec.ioaddr = io;
bintec.memaddr = mem;
bintec.ID = name;
bintec.debug = debug;
return NAME(REALNAME,init)(&bintec);
}
static int do_exit_module(void)
{
NAME(REALNAME,exit)(&bintec);
return 0;
}
#else
#error "This can only be used as a module!"
#endif

View File

@ -11,7 +11,7 @@
extern int NAME(CARDTYPE,init)(struct cardinfo *inf);
extern void NAME(CARDTYPE,exit)(struct cardinfo *inf);
struct cardinfo inf;
struct cardinfo inf = {0,};
int irq = 0;
int mem = 0;

View File

@ -28,7 +28,6 @@
#include "compat.h"
unsigned long block_mask = 0;
const char *xdeb_file; unsigned int xdeb_line;
/*
* Standard Unix-kernel timeout code. Two versions -- the new version
@ -54,12 +53,14 @@ static void dotimer(void *arg)
struct timing *tim = (struct timing *)arg;
(*tim->proc)(tim->arg);
sti();
#ifdef CONFIG_MALLOC_NAMES
deb_kfree(tim,__FILE__,__LINE__);
#else
kfree_s(tim,sizeof(struct timing));
kfree(tim);
#endif
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
@ -85,7 +86,7 @@ static void droptimer_old(void (*func)(void *), void *arg, char del)
#ifdef CONFIG_MALLOC_NAMES
deb_kfree(tim,__FILE__,__LINE__);
#else
kfree_s(tim,sizeof(struct timing_old));
kfree(tim);
#endif
}
#ifdef MODULE
@ -94,6 +95,7 @@ static void droptimer_old(void (*func)(void *), void *arg, char del)
return;
}
}
restore_flags(flags);
printk("Timer %p:%p not found\n", func,arg);
}
@ -109,8 +111,9 @@ static void dotimer_old(void *arg)
#ifdef CONFIG_MALLOC_NAMES
deb_kfree(tim,__FILE__,__LINE__);
#else
kfree_s(tim,sizeof(*tim));
kfree(tim);
#endif
}
#ifdef CONFIG_MALLOC_NAMES
@ -145,6 +148,7 @@ int timeout(void (*func)(void *), void *arg, int expire)
MOD_INC_USE_COUNT;
#endif
add_timer(&timer->tim);
return (int)timer;
}
@ -188,6 +192,7 @@ void timeout_old(void (*func)(void *), void *arg, int expire)
MOD_INC_USE_COUNT;
#endif
add_timer(&timer->tim.tim);
}
#ifdef CONFIG_MALLOC_NAMES
@ -196,12 +201,17 @@ void deb_untimeout(const char *deb_file, unsigned int deb_line, int timer)
void untimeout(int timer)
#endif
{
del_timer(&((struct timing *)timer)->tim);
if(!del_timer(&((struct timing *)timer)->tim)) {
#ifdef CONFIG_MALLOC_NAMES
printf("del_timer called freed from %s:%d\n",deb_file,deb_line);
#endif
}
#ifdef CONFIG_MALLOC_NAMES
deb_kfree((void *)timer,deb_file,deb_line);
#else
kfree_s((void *)timer,sizeof(struct timing));
kfree((void *)timer);
#endif
#ifdef MODULE
MOD_DEC_USE_COUNT;
#endif
@ -378,6 +388,7 @@ void *deb_kmalloc(size_t sz, int prio, const char *deb_file, unsigned int deb_li
foo++;
if(!mack) printk("%s[M:A %d %p %s:%d]\n",KERN_DEBUG,sz,foo,deb_file,deb_line);
*(long *)(sz + (char *)(foo)) = MAGIC_TAIL;
return foo;
}
@ -394,6 +405,7 @@ int deb_kcheck(void *fo, const char *deb_file, unsigned int deb_line)
return 1;
}
foo->file = deb_file; foo->line = deb_line;
return 0;
}

View File

@ -1 +0,0 @@
compat.h

View File

@ -442,7 +442,7 @@ fakeh_rsrv (queue_t * q)
}
mq = pullupm(mp,4);
if(mq == NULL) {
putbq (q, mp);
putbqf (q, mp);
return;
}
mp = mq;

View File

@ -102,6 +102,7 @@ extern int log_34;
*/
#define ARG_PREFOUT CHAR2('x','i') /* drop an incoming call if we're also calling out */
#define ARG_FORCEOUT CHAR2('y','i') /* always call back instead of accepting */
#define ARG_FORCEIN CHAR2('z','i') /* always expect a callback */
#define ARG_BACKCALL CHAR2('b','i') /* call back if incoming call rejected because busy */
#define ARG_NOREJECT CHAR2('n','j') /* don't send REJ code */
#define ARG_FASTDROP CHAR2('f','X')

View File

@ -64,7 +64,7 @@ struct _ip_mon {
#define ENCAP_NONE 0
#define ENCAP_ETHER 1
#define ENCAP_PPP 2
} ip_mon;
} ip_mon = {NULL};
static mblk_t *ip_info[NIP_INFO];

View File

@ -988,9 +988,13 @@ D_send (isdn2_state state, char cmd, mblk_t * mb)
/*
* If there's room in front, don't bother with a new mblk.
*/
if(crd->modes & CHM_INTELLIGENT)
if(crd->modes & CHM_INTELLIGENT) {
if(isdn2_log & 0x10) {
printf ("%s*** %d", KERN_DEBUG,state->card->nr);
log_printmsg (NULL, " Send", mb, KERN_DEBUG);
}
err = (*crd->send)(crd,0,mb);
else if (DATA_START(mb) + 2 <= mb->b_rptr && DATA_REFS(mb) == 1) {
} else if (DATA_START(mb) + 2 <= mb->b_rptr && DATA_REFS(mb) == 1) {
*--mb->b_rptr = (((cmd & 2) ? TEI_BROADCAST : state->card->TEI[ch]) << 1) | 1;
*--mb->b_rptr = (state->SAPI << 2) | ((cmd & 1) ? 0 : 2);
if(isdn2_log & 0x20) {
@ -1022,6 +1026,10 @@ D_send (isdn2_state state, char cmd, mblk_t * mb)
freemsg(m1);
}
}
if(isdn2_log & 0x10) {
printf ("%s*** %d", KERN_DEBUG,state->card->nr);
log_printmsg (NULL, " Send", mb, KERN_DEBUG);
}
if ((err = (*crd->send) (crd, 0, mb)) != 0)
mb->b_rptr += 2;
} else {
@ -1064,6 +1072,10 @@ D_send (isdn2_state state, char cmd, mblk_t * mb)
freemsg(m1);
}
}
if(isdn2_log & 0x10) {
printf ("%s*** %d", KERN_DEBUG,state->card->nr);
log_printmsg (NULL, " Send", mb2, KERN_DEBUG);
}
if ((err = (*crd->send) (crd, 0, mb2)) != 0)
freeb (mb2);
}
@ -1075,6 +1087,7 @@ D_send (isdn2_state state, char cmd, mblk_t * mb)
/*
* Check if there's room on the downstream queue. Called from X75.
* (Or directly, for intelligent cards.)
*/
static int
D_cansend (isdn2_state state)
@ -1082,18 +1095,20 @@ D_cansend (isdn2_state state)
struct _isdn1_card *crd;
if (isdn2_debug & 0x40)
printf ("%sD_cansend %d %d\n", KERN_DEBUG,state->card->nr, state->card->status);
printf ("%sD_cansend %d %d", KERN_DEBUG,state->card->nr, state->card->status);
if ((crd = state->card->card) == NULL) {
if (isdn2_debug & 0x10)
printf ("%s -- card NULL\n",KERN_DEBUG);
printf ("\n%s -- card NULL\n",KERN_DEBUG);
return 0;
}
if (isdn2_debug & 0x40)
printf ("cs %p\n", crd->cansend);
if(!(state->card->card->modes & CHM_INTELLIGENT)) {
if (state->card->status != C_up && state->card->status != C_lock_up) {
if (isdn2_debug & 0x10)
printf ("%s -- card down 2\n",KERN_DEBUG);
(void) D_L1_up (state->card);
return 0; /* Yet. */
return 0; /* Not yet. */
}
}
if (!(*crd->cansend) (crd, 0)) {
@ -1148,6 +1163,7 @@ isdn2_register (struct _isdn1_card *card, long id)
if (isdn2_debug & 0x10)
printf ("%sisdn2_register %p %lx\n",KERN_DEBUG, card, id);
nr = 1;
do {
nr++;
found_nr = 0;
@ -1391,7 +1407,7 @@ do_chprot (isdn2_card ctl, short channel, mblk_t * proto, int flags)
{
int err = 0;
if (isdn2_debug & 0x10)
if (isdn2_debug & 0x4)
printf ("%sdo_chprot %d %d 0%o\n",KERN_DEBUG, ctl ? ctl->nr : -1, channel, flags);
if (ctl == NULL || (channel == 0 && isdn_chan.qptr == NULL))
return -ENXIO;
@ -1419,7 +1435,7 @@ do_chprot (isdn2_card ctl, short channel, mblk_t * proto, int flags)
mb = allocb (sizeof (struct _isdn23_hdr), BPRI_HI);
if (mb == NULL) {
if (isdn2_debug & 0x10)
if (isdn2_debug & 0x14)
printf ("%sisdn2_chprot for %d: No rawhdr mem\n",KERN_DEBUG, ctl->nr);
return -ENOMEM;
}
@ -1455,7 +1471,7 @@ do_chprot (isdn2_card ctl, short channel, mblk_t * proto, int flags)
isdn2_chan ch = ctl->chan[channel];
if (ch == NULL || ch->qptr == NULL) {
if(isdn2_debug & 0x10)printf ("%sisdn2_chprot for %d: No qptr\n",KERN_DEBUG, ctl->nr);
if(isdn2_debug & 0x14)printf ("%sisdn2_chprot for %d: No qptr\n",KERN_DEBUG, ctl->nr);
return -ENXIO;
}
DATA_TYPE(proto) = MSG_PROTO;
@ -1788,6 +1804,8 @@ isdn2_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
#endif
ch = malloc(sizeof(*ch));
if (ch == NULL) {
if (isdn2_debug & 0x10)
printf ("%sisdn2_open: no memory\n",KERN_DEBUG);
ERR_RETURN(-ENOMEM);
}
memset(ch,0,sizeof(*ch));
@ -2173,22 +2191,24 @@ pushlist (queue_t * q, mblk_t * mp, char flags)
}
}
for (fm = fmod_sw; fm < &fmod_sw[fmodcnt]; fm++) {
if (fm->f_str == NULL)
continue;
if(!strcmp(ch1,fm->f_name))
goto found;
}
printf ("%sQ_Push: %s -- not found\n", KERN_ERR,ch1);
*ch2 = chx;
return -ENOENT;
found:
if(isdn2_debug & 0x20)printf (" %s", fm->f_name);
if ((err = c_qattach (fm->f_str, xq, 0)) < 0) {
if(strcmp(ch1,"-")) {
for (fm = fmod_sw; fm < &fmod_sw[fmodcnt]; fm++) {
if (fm->f_str == NULL)
continue;
if(!strcmp(ch1,fm->f_name))
goto found;
}
printf ("%sQ_Push: %s -- not found\n", KERN_ERR,ch1);
*ch2 = chx;
splx (ms);
printf ("%sQ_Push: %s -- can't attach\n", KERN_WARNING,fm->f_name);
return err;
return -ENOENT;
found:
if(isdn2_debug & 0x20)printf (" %s", fm->f_name);
if ((err = c_qattach (fm->f_str, xq, 0)) < 0) {
*ch2 = chx;
splx (ms);
printf ("%sQ_Push: %s -- can't attach\n", KERN_WARNING,fm->f_name);
return err;
}
}
nx:
*ch2 = chx;
@ -2326,8 +2346,11 @@ h_reply (queue_t * q, isdn23_hdr hdr, short err)
if (isdn2_debug & 0x100)
printf ("%sh_reply %p %p %d\n",KERN_DEBUG, q, hdr, err);
if ((mb = allocb (2 * sizeof (struct _isdn23_hdr), BPRI_HI)) == NULL)
if ((mb = allocb (2 * sizeof (struct _isdn23_hdr), BPRI_HI)) == NULL) {
if (isdn2_debug & 0x10)
printf ("%sh_reply: no memory\n",KERN_DEBUG);
return -ENOMEM;
}
hd = ((isdn23_hdr) mb->b_wptr)++;
hd->key = HDR_INVAL;
@ -2641,6 +2664,8 @@ isdn2_wsrv (queue_t *q)
if (!((crd->card->modes & CHM_INTELLIGENT)
? D_cansend(state)
: x75_cansend (&state->state, 1))) {
if (isdn2_debug & 0x10)
printf ("%shdr_uidata: cannot send\n",KERN_DEBUG);
h_reply (q, &hdr, (crd->status == C_wont_up) ? EIO : ENOMEM);
break;
}
@ -2671,6 +2696,8 @@ isdn2_wsrv (queue_t *q)
if (!((crd->card->modes & CHM_INTELLIGENT)
? D_cansend(state)
: x75_cansend (&state->state, 0))) {
if (isdn2_debug & 0x10)
printf ("%shdr_data: cannot send\n",KERN_DEBUG);
h_reply (q, &hdr, (crd->status == C_wont_up) ? EIO : ENOMEM);
break;
}

View File

@ -1165,8 +1165,10 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
}
if(c2->info != 0) {
printf("CAPI error: DISCONNECTB3_CONF returns %04x\n",c2->info);
#if 0
send_disconnect(conn,0,N1_OutOfOrder);
break;
#endif
}
if(conn->waitflags & (1<<WF_DISCONNECTB3_CONF)) {
conn->waitflags &=~ (1<<WF_DISCONNECTB3_CONF);
@ -1218,7 +1220,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
if(m3 == NULL)
err3 = -ENOMEM;
if(err3 == 0) {
c3 = ((typeof(c3))data->b_wptr)++;
c3 = ((typeof(c3))m3->b_wptr)++;
bzero(c3,sizeof(*c3));
c3->ncci = c2->ncci;
printf(">DISCONNECTB3_RESP ");
@ -1252,6 +1254,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
}
} else if((conn->state != 0) && (conn->state != 99) && ((c2->info != 0) || (conn->state >= 21))) {
conn->waitflags &=~ (1<<WF_DISCONNECT_IND);
setstate(conn,99);
isdn3_setup_conn (conn, EST_DISCONNECT);
report_terminate(conn,c2->info,0);
} else if(conn->state != 0 && conn->state != 99) {
@ -1265,7 +1268,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
if(m3 == NULL)
err3 = -ENOMEM;
if(err3 == 0) {
c3 = ((typeof(c3))data->b_wptr)++;
c3 = ((typeof(c3))m3->b_wptr)++;
bzero(c3,sizeof(*c3));
c3->plci = c2->plci;
printf(">DISCONNECT_RESP ");
@ -1421,7 +1424,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
if(m3 == NULL)
err3 = -ENOMEM;
if(err3 == 0) {
c3 = ((typeof(c3))data->b_wptr)++;
c3 = ((typeof(c3))m3->b_wptr)++;
bzero(c3,sizeof(*c3));
c3->plci = c2->plci;
printf(">CONNECTACTIVE_RESP ");
@ -1550,7 +1553,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
if(m3 == NULL)
err3 = -ENOMEM;
if(err3 == 0) {
c3 = ((typeof(c3))data->b_wptr)++;
c3 = ((typeof(c3))m3->b_wptr)++;
bzero(c3,sizeof(*c3));
c3->ncci = c2->ncci;
printf(">CONNECTB3ACTIVE_RESP ");

View File

@ -225,19 +225,6 @@ isdn3_killconn (isdn3_conn conn, char force)
if(force)
conn->id = 0;
if ((conn->delay > 0) && (conn->minorstate & MS_DELAYING)) {
#ifdef NEW_TIMEOUT
untimeout (conn->later_timer);
#else
untimeout (later_conn, conn);
#endif
} else if (conn->delay == 0 && force == 0 && (conn->minorstate & MS_DELAYING)) {
splx (ms);
return;
}
conn->delay = 0;
conn->minorstate |= MS_DELAYING;
if (conn->minorstate & MS_CONNDELAY_TIMER) {
conn->minorstate &= ~MS_CONNDELAY_TIMER;
#ifdef NEW_TIMEOUT
@ -255,6 +242,19 @@ isdn3_killconn (isdn3_conn conn, char force)
untimeout (timeout_conn, conn);
#endif
}
if ((conn->delay > 0) && (conn->minorstate & MS_DELAYING)) {
#ifdef NEW_TIMEOUT
untimeout (conn->later_timer);
#else
untimeout (later_conn, conn);
#endif
} else if (conn->delay == 0 && force == 0 && (conn->minorstate & MS_DELAYING)) {
splx (ms);
return;
}
conn->delay = 0;
conn->minorstate |= MS_DELAYING;
if (conn->hupdelay
&& ((minorflags[conn->minor] & MINOR_STATE_MASK) == MINOR_CONN_SENT
|| (minorflags[conn->minor] & MINOR_STATE_MASK) == MINOR_LISTEN_SENT)

View File

@ -478,6 +478,7 @@ report_adddate (mblk_t * mb, uchar_t * data, int len)
m_puts (mb, qd_data, qd_len);
}
#if 0
static int
get_state(isdn3_conn conn, uchar_t *data, int len, uchar_t *state)
{
@ -492,6 +493,7 @@ get_state(isdn3_conn conn, uchar_t *data, int len, uchar_t *state)
*state = *qd_data;
return 1;
}
#endif
static int
@ -545,6 +547,15 @@ get_nr (isdn3_conn conn, uchar_t * data, int len, uchar_t *nrpos, uchar_t what)
case 0x30: /* network specific */
break;
case 0x40: /* subscriber */
/* There is at least one _really_ broken box out there */
if((qd_len < 4) && (what == PT_E0_destAddr)) {
long flags = isdn3_flags(conn->card->info,-1,-1);
if(flags & FL_BUG1) {
*nrpos++='.';
break;
}
}
*nrpos++='-';
break;
case 0x60: /* abbreviated */

View File

@ -390,7 +390,7 @@ char **fileargs;
void
read_args (void *nix)
{
int nexttime = 0;
int nexttime;
#ifdef NEW_TIMEOUT
static long classtimer;
#endif
@ -416,7 +416,6 @@ read_args (void *nix)
seqnum = 0;
for(conn=isdn4_conn; conn != NULL; conn = conn->next) {
char *fp;
if((cg = conn->cg) == NULL)
continue;
cg->dl = NULL;
@ -440,33 +439,50 @@ read_args (void *nix)
untimeout(read_args_run,NULL);
#endif
}
theclass = "*";
theclass = ""; nexttime = 32767/HZ;
for(cft = cf_TM; cft != NULL; cft = cft->next) {
if((nexttime = isintime(cft->arg)) > 0) {
theclass = cft->cclass;
break;
int newnexttime;
if((newnexttime = isintime(cft->arg)) > 0) {
char tmstr[100], *tmptr, elm;
if((newnexttime > 0) && (newnexttime < nexttime))
nexttime = newnexttime;
strcpy(tmstr,cft->cclass);
tmptr = tmstr + strlen(tmstr);
while((elm = *theclass++) != '\0') {
if(strchr(cft->cclass,elm) == NULL) {
*tmptr++ = elm;
*tmptr = '\0';
}
}
theclass = str_enter(tmstr);
}
}
do_run_now++;
run_now(NULL);
if(*theclass == '\0')
theclass = "*";
if((nexttime == 0) || (nexttime > 32767/HZ))
nexttime = 32767/HZ;
if((nexttime == 0) || (nexttime > 32767/HZ/60))
nexttime = 32767/HZ/60;
#ifdef NEW_TIMEOUT
classtimer =
#endif
timeout(read_args_run,NULL,nexttime * 60 * HZ);
timeout(read_args_run,NULL,nexttime * HZ);
conn = xmalloc(sizeof(*conn));
if(conn != NULL) {
char causeInfo[100];
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
conn->causeInfo = "config files read";
sprintf(causeInfo,"config read, next %d", nexttime/60);
conn->causeInfo = str_enter(causeInfo);
conn->cause = ID_priv_Print;
conn->classname = theclass;
conn->next = isdn4_conn; isdn4_conn = conn;
dropconn(conn);
}
do_run_now++;
run_now(NULL);
}
/* Read all the files and kick off the programs. */

View File

@ -131,9 +131,10 @@ ReportOneConn(conninfo conn, int minor)
spf += sprintf(spf,"%s%d:%d %s %s %s %d %s%s/%s %ld %ld %s",
conn->ignore?"!":"", conn->minor,
conn->seqnum, conn->cg ? conn->cg->site : "-",
conn->cg ? conn->cg->protocol : "-", conn->cg ? conn->cg->cclass : "-",
conn->cg ? conn->cg->protocol : "-",
conn->classname ? conn->classname : (conn->cg ? conn->cg->cclass : "-"),
conn->pid, state2str(conn->state), is1,
conn->cg ? conn->cg->card : (conn->cardname ? conn->cardname : "-"),
conn->cardname ? conn->cardname : (conn->cg ? conn->cg->card : "-"),
conn->charge, conn->ccharge, FlagInfo(conn->flags));
if(conn->cg != NULL && (conn->cg->flags ^ conn->flags) != 0) {
int foo = strlen(FlagInfo(conn->cg->flags ^ conn->flags));
@ -159,14 +160,15 @@ static inline int retimeout(conninfo conn)
{
int tim = 0;
/* Exponential backoff. Sorry but this is necessary. */
conn->retiming++;
if(conn->charge != 0)
tim = 5*60*(1<<++conn->retiming);
tim = 5*60*(1<<conn->retiming);
else if (conn->cause == ID_priv_Busy)
tim = 5*(1<<(++conn->retiming/6));
tim = 5*(1<<(conn->retiming/6));
else if(conn->flags & F_FASTREDIAL)
tim = 2+(1<<(++conn->retiming/4));
tim = 2+(1<<(conn->retiming/4));
else
tim = 5+(1<<(++conn->retiming/2));
tim = 5+(1<<(conn->retiming/2));
if((tim <= 0) || (tim > 60*60*2))
tim = 60*60*2;
return tim;
@ -196,8 +198,10 @@ Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState
conn->timer_reconn = 1;
if(conn->flags & F_FASTREDIAL)
timeout(time_reconn,conn,HZ);
else if(conn->flags & F_FORCEIN)
timeout(time_reconn,conn,30*HZ);
else
timeout(time_reconn,conn,5*HZ);
timeout(time_reconn,conn,6*HZ);
}
}
@ -298,7 +302,7 @@ Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState
kill_rp(conn,'u');
run_rp(conn,'f');
}
if(conn->state != c_forceoff && state == c_forceoff && conn->pid != 0) {
if(conn->state > c_forceoff && state <= c_forceoff && conn->pid != 0) {
struct conninfo *xconn;
xconn = xmalloc(sizeof(*xconn));
if(xconn != NULL) {
@ -361,7 +365,7 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
if(log_34 & 2)printf ("DropConn %s:%d: %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref);
if(!conn->ignore) {
conn->ignore=1;
setconnstate(conn,c_forceoff);
setconnstate(conn,c_unknown);
#if 0
if(conn->state > c_off)
setconnstate(conn, c_off);
@ -371,10 +375,10 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
timeout(rdropconn,conn,HZ*60*5); /* Drop the record after five minutes */
return;
} else if(conn->ignore == 1) { /* already going to drop it */
setconnstate(conn,c_forceoff);
setconnstate(conn,c_unknown);
return;
} else
setconnstate(conn,c_forceoff);
setconnstate(conn,c_unknown);
{ /* unchain the conn from the list */
/* Could use a doubly-linked list here, but what the ... */
@ -402,6 +406,7 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
sprintf(xs,"-%d",conn->seqnum);
connreport(xs,conn->cg ? conn->cg->card : "*",0);
}
printf("Drop %p %s:%d\n",conn,deb_file,deb_line);
dropgrab(conn->cg);
if(conn->lastMsg != NULL)
free(conn->lastMsg);

View File

@ -340,7 +340,19 @@ init_vars (void)
void do_updown(CState state)
{
if(conn->charge > 0 || (++conn->retries > ((conn->cg && conn->cg->retries) ? conn->cg->retries : (conn->retiming ? 5 : ((conn->flags & F_FASTREDIAL) ? 20 : 10))))) {
int lim;
if(conn->cg && conn->cg->retries)
lim = conn->cg->retries;
else if(conn->flags & F_FORCEIN)
lim = 2;
else if(conn->retiming) /* we had a problem earlier */
lim = 5;
else if(conn->flags & F_FASTREDIAL)
lim = 20;
else
lim = 10;
if((conn->charge > 0) || (++conn->retries > lim)) {
if(conn->cg != NULL)
syslog(LOG_ERR,"OFF %s:%s %s",conn->cg->site,conn->cg->protocol,CauseInfo(conn->cause, conn->causeInfo));
else
@ -383,6 +395,8 @@ do_card(void)
return ret;
if ((ret = m_getx (&xx, &cardcap)) != 0)
return ret;
if(in_boot < 0)
in_boot = 0;
for(ld = isdn4_loader; ld != NULL; ld = ld->next) {
if (!strcmp(ld->name, crd))
return -EEXIST;
@ -415,6 +429,7 @@ do_card(void)
card->name = str_enter("NULL");
ld->card = card;
in_boot++;
} else {
struct iovec io[3];
int len;
@ -733,10 +748,6 @@ do_incoming(void)
resp = "SHUTTING DOWN";
goto inc_err;
}
if (in_boot) {
resp = "STARTING UP";
goto inc_err;
}
{
char *sit = NULL,*pro = NULL,*car = NULL,*cla = NULL; /* GCC */
long flg;
@ -767,7 +778,7 @@ do_incoming(void)
if(((conn = startconn(cg,fminor,connref,&resp, NULL)) != NULL) && (resp != NULL)) {
/* An existing connection feels responsible for this. */
mblk_t *mz;
if(conn->state == c_forceoff) {
if(conn->state <= c_forceoff) {
goto cont;
} else if ((conn->connref == connref || conn->connref == 0)) {
if(*resp != '=')
@ -1234,7 +1245,9 @@ do_close(void)
}
}
{
for(conn = isdn4_conn; conn != NULL; conn = conn->next) {
struct conninfo *nconn;
for(conn = isdn4_conn; conn != NULL; conn = nconn) {
nconn = conn->next;
if(conn->minor == minor && conn->ignore >= 3) {
dropconn(conn);
continue;
@ -1379,6 +1392,38 @@ do_open(void)
return 0;
}
/* Disconnecting.. */
int
do_disconnect(void)
{
#if 1
if (conn != NULL) {
switch(conn->state) {
case c_going_up:
do_updown(c_going_down);
break;
case c_up:
do_down(c_going_down);
break;
default:;
}
}
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(log_34 & 2)printf("Dis5 ");
*xx.b_wptr++ = PREF_NOERR;
m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor);
xlen = xx.b_wptr - xx.b_rptr;
DUMPW (xx.b_rptr, xlen);
(void) strwrite (xs_mon, (uchar_t *) xx.b_rptr, xlen, 1);
#endif
resp = NULL;
return 0;
}
/* A connection has been fully established. */
int
do_hasconnected(void)
@ -1386,6 +1431,12 @@ do_hasconnected(void)
if (conn != NULL) {
syncflags(conn,1);
setconnstate(conn,c_up);
if(conn->flags & F_FORCEIN) {
setconnstate(conn,c_forceoff);
do_disconnect();
resp = "NO CARRIER";
return 1;
}
}
resp = "CONNECT";
@ -1427,38 +1478,6 @@ do_hasconnected(void)
(void) strwrite (xs_mon, (uchar_t *) xx.b_rptr, xlen, 1);
return 0;
}
/* Disconnecting.. */
int
do_disconnect(void)
{
#if 1
if (conn != NULL) {
switch(conn->state) {
case c_going_up:
do_updown(c_going_down);
break;
case c_up:
do_down(c_going_down);
break;
default:;
}
}
xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans;
db.db_lim = ans + sizeof (ans);
if(log_34 & 2)printf("Dis5 ");
*xx.b_wptr++ = PREF_NOERR;
m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor);
xlen = xx.b_wptr - xx.b_rptr;
DUMPW (xx.b_rptr, xlen);
(void) strwrite (xs_mon, (uchar_t *) xx.b_rptr, xlen, 1);
#endif
resp = NULL;
return 0;
}
/* ... disconnect complete. */
int
@ -1756,7 +1775,7 @@ do_atcmd(void)
continue;
ReportOneConn(fconn,minor);
}
sprintf(buf,"# Waiting%s %s...",in_boot?"/blocked":"", conn->cardname);
sprintf(buf,"# Waiting %s...", conn->cardname);
resp = str_enter(buf);
return 1;
@ -1965,12 +1984,6 @@ do_atcmd(void)
resp = "SHUTTING DOWN";
return 1;
}
if(in_boot) {
freemsg(md);
dropgrab(cg);
resp = "STARTING UP";
return 1;
}
if(fminor != 0) {
m_putid (md, CMD_NOPROT);
m_putsx (md, ARG_FMINOR);

View File

@ -142,13 +142,13 @@ isintime (char *ztime)
if (afday[tm->tm_wday]) {
if (istart < iend) {
if ((istart < now) && (iend > now))
if ((istart <= now) && (iend > now))
return (iend - now) * 60;
} else { /* Wrap around midnight */
if (iend > now)
if (istart <= now)
return (24*60-now) * 60;
if (istart > now)
return (istart - now) * 60;
if (iend > now)
return (iend - now) * 60;
}
}
}

View File

@ -50,6 +50,8 @@ card_load_close(struct loader *ld, char success)
}
}
free(ld);
if(in_boot > 0)
in_boot--;
do_run_now++;
timeout(run_now,NULL,HZ/3);
}

View File

@ -292,3 +292,4 @@ main (int argc, char *argv[])
unlockdev(0);
return 0; /* -> exit(0) */
}

View File

@ -228,7 +228,8 @@ typedef struct proginfo {
/* States of a connection */
typedef enum connstate {
c_forceoff, /* Unknown */
c_unknown, /* Unknown */
c_forceoff, /* forced inactive due to a serious error */
c_offdown, /* Being turned off */
c_off, /* Turned off, unavailable */
c_down, /* Inactive */
@ -300,28 +301,29 @@ typedef struct conninfo {
} *conninfo;
/* Special flags. Ordered for improved readability when debugging. */
#define F_DIALUP 0x1 /* dialup connection */
#define F_MULTIDIALUP 0x2 /* dialup connection, independent */
#define F_PERMANENT 0x4 /* dialup connection which doesn't really die */
#define F_LEASED 0x8 /* connection on leased line */
#define F_INCOMING 0x10 /* incoming call */
#define F_OUTGOING 0x20 /* outgoing call */
#define F_SETINITIAL 0x40 /* initial connection setup */
#define F_SETLATER 0x80 /* later re-setup */
#define F_NRCOMPLETE 0x100 /* remote number is complete */
#define F_LNRCOMPLETE 0x200 /* local number is complete */
#define F_OUTCOMPLETE 0x400 /* outgoing call info complete */
#define F_INTERRUPT 0x800 /* interrupt, don't disconnect */
#define F_PREFOUT 0x1000 /* drop incoming connection on call collision */
#define F_FORCEOUT 0x2000 /* always drop incoming connection */
#define F_IGNORELIMIT 0x4000 /* override connection limit */
#define F_FASTDROP 0x8000 /* immediate connection reject */
#define F_DIALUP 0x1 /* dialup connection */
#define F_MULTIDIALUP 0x2 /* dialup connection, independent */
#define F_PERMANENT 0x4 /* dialup connection which doesn't really die */
#define F_LEASED 0x8 /* connection on leased line */
#define F_INCOMING 0x10 /* incoming call */
#define F_OUTGOING 0x20 /* outgoing call */
#define F_SETINITIAL 0x40 /* initial connection setup */
#define F_SETLATER 0x80 /* later re-setup */
#define F_NRCOMPLETE 0x100 /* remote number is complete */
#define F_LNRCOMPLETE 0x200 /* local number is complete */
#define F_OUTCOMPLETE 0x400 /* outgoing call info complete */
#define F_INTERRUPT 0x800 /* interrupt, don't disconnect */
#define F_PREFOUT 0x1000 /* drop incoming connection on call collision */
#define F_FORCEOUT 0x2000 /* always drop incoming connection */
#define F_FORCEIN 0x4000 /* always drop incoming connection */
#define F_FASTDROP 0x8000 /* immediate connection reject */
#define F_FASTREDIAL 0x10000 /* don't delay much when a dial attempt fails */
#define F_CHANBUSY 0x20000 /* busy if no free channel */
#define F_NOREJECT 0x40000 /* don't cause "temp unavailable" messages */
#define F_BACKCALL 0x80000 /* callback on B if incoming call on A busy */
#define F_NOSTART 0x100000 /* Do not start the call */
#define F_FOOBAR 0x200000 /* dummy flag to return non-FALSE passing flags */
#define F_NOSTART 0x100000 /* Do not start the call */
#define F_IGNORELIMIT 0x200000 /* override connection limit */
#define F_FOOBAR 0x400000 /* dummy, to return non-FALSE for zeroed flags */
#define F_MASKFLAGS (F_LEASED|F_PERMANENT|F_DIALUP|F_MULTIDIALUP)
#define F_DIALFLAGS (F_MULTIDIALUP|F_DIALUP|F_PERMANENT)

View File

@ -414,6 +414,7 @@ pmatch1 (cf prot, conngrab *cgm)
case ARG_FASTDROP: cgc->flags |= F_FASTDROP; break;
case ARG_IGNORELIMIT:cgc->flags |= F_IGNORELIMIT;goto argdup;
case ARG_FORCEOUT: cgc->flags |= F_FORCEOUT; goto argdup;
case ARG_FORCEIN: cgc->flags |= F_FORCEIN; goto argdup;
case ARG_BACKCALL: cgc->flags |= F_BACKCALL; goto argdup;
case ARG_NOREJECT: cgc->flags |= F_NOREJECT; goto argdup;
case ARG_PREFOUT: cgc->flags |= F_PREFOUT; goto argdup;
@ -791,10 +792,16 @@ findit (conngrab *foo, int ignbusy)
}
break;
case ARG_CARD:
m_getstr (p, st, 4);
if((cg->card = wildmatch(str_enter(st),cg->card)) == NULL) {
dropgrab(cg);
return "0CARD MISMATCH";
{
char *foo;
m_getstr (p, st, 4);
if((foo = wildmatch(str_enter(st),cg->card)) == NULL) {
char buf[80];
sprintf(buf,"0CARD MISMATCH %s %s",st,cg->card);
dropgrab(cg);
return str_enter(buf);
}
cg->card = foo;
}
break;
case ARG_SUBCARD:

View File

@ -162,8 +162,10 @@ char *build_nr (char *extnr, char *locnr, char *locpref, int islocal)
char *xextpos = strchr(extnr,'.');
char *xlocpos = strchr(locnr,'.');
if(xextpos != NULL && xlocpos != NULL &&
(!strcmp(xextpos,xlocpos) || (wildmatch(xextpos+1,xlocpos+1) != NULL)))
(!strcmp(xextpos,xlocpos) || (wildmatch(xextpos+1,xlocpos+1) != NULL))) {
lastprefpos=".";
islocal &=~ 2;
}
}
locpos=strchr(locnr,*lastprefpos);

View File

@ -17,7 +17,8 @@ char *state2str(CState state) {
case c_off: return "off";
case c_down: return "down";
case c_offdown: return ">off";
case c_forceoff: return "XXX";
case c_unknown: return "XXX";
case c_forceoff: return "error";
case c_going_up: return ">up";
case c_going_down: return ">down";
default: return "unknown";
@ -66,6 +67,7 @@ char *FlagInfo(int flag)
if (flag & F_INTERRUPT) strcat(fbuf, ":is");
if (flag & F_PREFOUT) strcat(fbuf, ":xi");
if (flag & F_FORCEOUT) strcat(fbuf, ":yi");
if (flag & F_FORCEIN) strcat(fbuf, ":zi");
if (flag & F_BACKCALL) strcat(fbuf, ":bi");
if (flag & F_IGNORELIMIT) strcat(fbuf, ":il");
if (flag & F_FASTDROP) strcat(fbuf, ":fX");

View File

@ -168,30 +168,34 @@ classmatch(char *a, char *b)
strcat(classpat,b);
return str_enter(classpat);
} else {
char classpat[50], *classend = classpat;
char *aorig,*bplus;
if(*a != '+') {
char *tmp = a; a = b; b = tmp;
}
if((bplus=strchr(b,'+')) != NULL) *bplus='\0';
strcpy(classpat,b); classend = classpat+strlen(b);
aorig = a;
do {
char *thisa = a;
while(*++a != '\0' && *a != '+') {
if(strchr(b,*a) != NULL)
break;
}
if(*a == '\0' || *a == '+') {
if(bplus != NULL) *bplus='+';
return NULL;
if(strchr(b,*a) != NULL) {
while(thisa < a) {
if(strchr(b,*thisa) != NULL)
*classend++ = *thisa;
thisa++;
}
goto cont;
}
}
if(bplus != NULL) *bplus='+';
return NULL;
cont:;
} while((a = strchr(a,'+')) != NULL);
{
char classpat[50];
strcpy(classpat,b);
if(bplus != NULL)
*bplus='+';
strcat(classpat,pluscat(aorig,bplus));
return str_enter(classpat);
}
if(bplus != NULL) *bplus='+';
*classend = '\0';
strcat(classpat,pluscat(aorig,bplus));
return str_enter(classpat);
}
} else {
char classpat[30];

View File

@ -62,8 +62,6 @@ deadkid (void)
}
}
if(has_dead) {
in_boot = 1;
connreport("# Blocking connections","*",0);
do_run_now++;
timeout(run_now,NULL,3*HZ);
}
@ -348,9 +346,11 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
if(conn->cg != cg) {
if(conn->state == c_going_down) {
if((cg->flags & (F_PREFOUT|F_FORCEOUT)) && (cg->flags & F_INCOMING))
*ret = "-Callout delayed?";
*ret = "-Hmmm, callout delayed?";
else if(cg->flags & F_INCOMING)
*ret = "+Incoming while old call isn't really down?";
else
*ret = "+Hmmm, something's not quite right";
*ret = "+Hmmm, something's not quite right...";
dropgrab(cg);
return conn;
}
@ -606,7 +606,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo, char what)
char *err;
if((err = findit (foo,!!(cg->flags & F_PERMANENT))) != NULL) {
if(conn != NULL)
if(conn != NULL && rconn != NULL && conn != *rconn)
free(conn);
return err;
}
@ -1198,7 +1198,7 @@ run_now(void *nix)
}
if(signal(SIGHUP,SIG_IGN) != SIG_IGN)
signal (SIGHUP, SIG_DFL);
if(quitnow)
if((in_boot < 0)|| quitnow)
return;
for(what = cf_R; what != NULL; what = what->next) {
@ -1286,8 +1286,7 @@ run_now(void *nix)
printf("exist %s:%s\n",conn->cg->site,conn->cg->protocol);
if(conn->cg != NULL && conn->minor != 0 && conn->pid != 0) {
if(conn->cg->cclass != NULL) {
char *newclass = classmatch(conn->cg->cclass, theclass);
if((newclass == NULL) && (conn->state >= c_going_up)) {
if((classmatch(conn->cg->cclass, theclass) == NULL) && (conn->state >= c_going_up)) {
mblk_t *mb = allocb(80,BPRI_MED);
setconnstate(conn, c_down);
@ -1316,10 +1315,6 @@ run_now(void *nix)
}
}
}
if(in_boot) {
connreport("# Accepting connections","*",0);
in_boot = 0;
}
if(signal(SIGHUP,SIG_IGN) != SIG_IGN)
signal (SIGHUP, (sigfunc__t) read_args_run);
progidx = 0;
@ -1350,10 +1345,6 @@ void
kill_progs(struct conninfo *xconn)
{
struct conninfo *conn, *nconn;
if(!quitnow) {
in_boot = 1;
connreport("# Blocking connections","*",0);
}
for(conn = isdn4_conn; conn != NULL; conn = nconn) {
nconn = conn->next;
if(conn->ignore)

View File

@ -266,7 +266,9 @@ putbqf (queue_t * q, mblk_t * mp)
qflag = q->q_flag;
q->q_flag |= QENAB;
#ifdef CONFIG_DEBUG_STREAMS
if(0)printf("%sPutBQF %p:%p at %s:%d\n",KERN_DEBUG,q,mp,deb_file,deb_line);
/* This is KERN_EMERG message because it just shouldn't happen --
putbqf is for emergencies, putbq is for normal scheduling. */
printf("%sPutBQF %p:%p at %s:%d\n",KERN_EMERG,q,mp,deb_file,deb_line);
deb_putbq (deb_file,deb_line, q, mp);
#else
putbq (q, mp);

View File

@ -444,7 +444,7 @@ x75_T1 (x75 state)
state->RC++;
start_T (1, err2);
} else {
printf("%sERR_I 1\n",KERN_INFO);
printf("%sERR_I 1 %d\n",KERN_INFO,state->RC);
msg_up (state, MDL_ERROR_IND, ERR_I);
establish (state);
state->L3_req = 0;
@ -1663,7 +1663,7 @@ x75_cansend (x75 state, char isUI)
if(state->cansend != NULL)
(void)(*state->cansend) (state->ref); /* Trigger bringing L1 up */
if (isUI)
return (state->I.nblocks < 3); /* arbitrary maximum */
return (state->UI.nblocks < 3); /* arbitrary maximum */
else /* This allows us to enqueue one additional
* frame, which is a Good Thing. */
return (state->I.nblocks <= state->k);

View File

@ -213,7 +213,7 @@ xstreams_open (struct inode *inode, struct file *file, struct stream_header **pp
/*
* Allocate a Streams header. We just grab one from kernel memory.
*/
if ((p_stream = (struct stream_header *) kmalloc (sizeof (struct stream_header), GFP_KERNEL)) == NULL) {
if ((p_stream = (struct stream_header *) kmalloc (sizeof (struct stream_header), GFP_ATOMIC)) == NULL) {
printk("XOpen RetNoMem2\n");
freeq (p_queue);
return -ENOMEM;

View File

@ -260,14 +260,16 @@ freeb(mblk_t *p_msg)
if(p_msg->b_datap->deb_magic != DEB_DMAGIC)
panic("Bad_Magicd of %p at %s:%d!\n",p_msg,deb_file,deb_line);
#endif
(void)deb_msgdsize(deb_file,deb_line, p_msg);
if(p_msg->deb_queue != NULL) {
#ifdef CONFIG_MALLOC_NAMES
deb_kcheck(p_msg, deb_file, deb_line);
deb_kcheck(p_msg, deb_file, deb_line);
#ifndef SK_STREAM
deb_kcheck(p_msg->b_datap, deb_file, deb_line);
deb_kcheck(p_msg->b_datap, deb_file, deb_line);
#endif
#endif
if(p_msg->deb_queue != NULL) {
printf("%s:%d freed_msg %p:%p from queue %p, put by %s:%d\n",
deb_file,deb_line,p_msg,
#ifdef SK_STREAM
@ -941,7 +943,7 @@ xmsgsize(mblk_t *p_msg)
if((n = p_msg->b_wptr - p_msg->b_rptr) > 0)
bytes += n;
#ifdef CONFIG_DEBUG_STREAMS
if(segs++ > 100)
if(segs++ > 1000)
panic("Msg_Loop of %p at %s:%d!\n",p_msg,deb_file,deb_line);
#endif
if ((p_msg = p_msg->b_cont) == NULL)
@ -997,7 +999,7 @@ msgsize(mblk_t *p_msg)
if((n = p_msg->b_wptr - p_msg->b_rptr) > 0)
bytes += n;
#ifdef CONFIG_DEBUG_STREAMS
if(segs++ > 100)
if(segs++ > 1000)
panic("Msg=Loop of %p at %s:%d!\n",p_msg,deb_file,deb_line);
#endif
if ((p_msg = p_msg->b_cont) == NULL)
@ -1074,7 +1076,7 @@ msgdsize(mblk_t *p_msg)
}
p_msg = p_msg->b_cont;
#ifdef CONFIG_DEBUG_STREAMS
if(segs++ > 100)
if(segs++ > 1000)
panic("Msg.Loop of %p at %s:%d!\n",p_msg,deb_file,deb_line);
#endif
}
@ -2347,7 +2349,7 @@ do_runqueues(void *dummy)
{
queue_t *p_queue;
unsigned long s;
int cnt = 100;
int cnt = 1000;
static int looping = 0;
#ifdef CONFIG_DEBUG_STREAMS
static int reenter = 0;
@ -2390,19 +2392,20 @@ do_runqueues(void *dummy)
#if 0 /* def CONFIG_DEBUG_STREAMS */
printf("%c:%s ",(p_queue->q_flag & QREADR ? 'R':'W'), p_queue->q_qinfo->qi_minfo->mi_idname);
#endif
if (p_queue->q_qinfo->qi_srvp)
(*p_queue->q_qinfo->qi_srvp)(p_queue);
(void)splstr();
if(!--cnt) {
if(!looping)
printf("%sStreams loop?\n",KERN_WARNING);
printf("%sStreams loop %c %s?\n",KERN_EMERG,(p_queue->q_flag & QREADR ? 'R':'W'), p_queue->q_qinfo->qi_minfo->mi_idname);
looping++; looping++;
break;
}
}
if(looping) looping--;
#if 0 /* def CONFIG_DEBUG_STREAMS */
if(cnt < 100)
if(cnt < 1000)
printf("\n");
#endif
#ifdef CONFIG_DEBUG_STREAMS

View File

@ -302,7 +302,7 @@ slip_rsrv (queue_t * q)
timeout((void *)qenable,q,HZ/10);
out:
(uchar_t *) mp->b_rptr = cp;
putbq (q, mp);
putbqf (q, mp);
return;
}
putnext (q, mp2);

View File

@ -413,7 +413,7 @@ strread (struct xstream *xp, streamchar *data, int len, int usehq)
* else free msg and return 0.
*/
if (nlen)
putbq (q, bp);
putbqf (q, bp);
else
freemsg (bp);
return nlen;

View File

@ -417,7 +417,7 @@ timer_rsrv (queue_t * q)
timer_proto (q, mp, 0);
break;
default:
if((DATA_TYPE(mp) > QPCTL) || canput (q->q_next)) {
if((DATA_TYPE(mp) > QPCTL) || canput (q->q_next)) {
putnext (q, mp);
continue;
} else {

View File

@ -101,10 +101,13 @@ DL * Tel0 +49=911-919402/ :pr 0 :sp 65 :pr 63
# Use _after_ :pr 0.
#
# Dialout prefixes.
# Use the second line if you're using a PBX which doesn't prefix external
# numbers with the PBX' dialout prefix.
# Use the first line (numbers end with "/") for basic ISDN service.
# Use the second line (numbers end with ".") if you're behind a PBX.
# Use the third line (numbers have to end with "/", sorry) for German 1TR6
# PBXes which don't prefix a zero for incoming calls.
DP * +00=0-
#DP * +000=00-0 +00=0-
#DP * +000=00-0.
#DP * +000=00-0 +00=0-
# Limit how many B channel connections may be opened.
# Override the limit with :il in the P line.
@ -206,19 +209,17 @@ MP * * +I * - timer :tr 4 :tw 4 :ti 2 :to 3 :lo
# Grmbl. Innerdeutsch 9 Uhr, ausserhalb 8 Uhr, USA 14 Uhr.
# a-e: deutsch; fg: Euro1, hi: USA
TM +dgi Wk0500-0800
TM +dfi Wk0800-0900
TM +afi Wk0900-1200
TM +bfi Wk1200-1400
TM +bfh Wk1400-1800
TM +cgh Wk1800-2100
TM +dgh Wk2100-0200
TM +egh Wk0200-0300
TM +egi Wk0300-0500
TM +cgi SaSu0500-1400
TM +cgh SaSu1400-2100
TM +dgh SaSu2100-0200
TM +dgh SaSu0200-0300
TM +dgi SaSu0300-0500
# END
TM ABCDEFGHIJKLMNOP Any
TM c Wk0500-0900
TM a Wk0900-1200
TM b Wk1200-1800
TM c Wk1800-2100,SaSu0500-2100
TM d Wk2100-0200,SaSu2100-0500
TM e Wk0200-0500
TM f Wk0800-1800
TM g Wk1800-0800,SaSu
TM h any1400-0300
TM i any0300-1400
# END

View File

@ -309,7 +309,7 @@ v110_wsrv (queue_t * q)
}
if (mp != NULL) {
log_printmsg (NULL, "Back", mrs, KERN_DEBUG);
putbq (q, mp);
putbqf (q, mp);
return;
}
}
@ -385,7 +385,7 @@ v110_rsrv (queue_t * q)
putbq (q, mp);
#ifdef FORCE
if (m_off != NULL)
putbq (q, m_off);
putbqf (q, m_off);
#endif
return;
}
@ -595,7 +595,7 @@ v110_rsrv (queue_t * q)
#ifdef FORCE
if (m_off != NULL) {
q->q_flag &= ~QWANTR;
putbq (q, m_off);
putbqf (q, m_off);
q->q_flag |= QWANTR;
}
#endif

View File

@ -383,7 +383,7 @@ van_j_rsrv (queue_t * q)
if (van_j->flags & VAN_J_PPP) {
mq = pullupm (mp, 2);
if (mq == NULL) {
putbq (q, mp);
putbqf (q, mp);
return;
}
protocol = *(ushort_t *) mq->b_rptr;

View File

@ -633,13 +633,13 @@ x75_wsrv (queue_t * q)
* Not connecting? Forget it...
*/
if (!(x_75->flags & X75_CONNECT)) {
putbq (q, mp);
putbqf (q, mp);
return;
}
if (x_75->x75.status == S_down && ((x_75->connmode & (X75CONN_DATA)) == X75CONN_DATA))
x75_changestate (&x_75->x75, DL_ESTABLISH_REQ, 0);
if (!x75_cansend (&x_75->x75, isUI)) {
putbq (q, mp);/* assume backenable gets called */
putbqf (q, mp);/* assume backenable gets called */
return;
} else if ((err = x75_send (&x_75->x75, isUI, mp)) == 0)
break;