This commit is contained in:
Matthias Urlichs 1995-11-08 19:17:48 +01:00 committed by Harald Welte
parent 31dd84ea4c
commit f68fc8e219
66 changed files with 711 additions and 554 deletions

136
DOKU
View File

@ -16,6 +16,11 @@ unter der GPL bzw. ihrem deutschen
Achtung: Achtung:
======= =======
Es gibt eine Mailingliste zum Thema: linux-isdn@uranus.central.de.
"Bitte trag mich ein"-Requests bitte _nicht_ drothin, sondern an
linux-isdn-request@uranus.central.de.
Version 14: Die CL- und DL-Zeilen haben sich geändert (erweitert um Version 14: Die CL- und DL-Zeilen haben sich geändert (erweitert um
<Key>-Parameter). Intelligente Karten funktionieren NOCH NICHT. <Key>-Parameter). Intelligente Karten funktionieren NOCH NICHT.
@ -140,14 +145,19 @@ wer kann und will, m
Kernelpatches Kernelpatches
============= =============
Die Patches basieren auf dem in der Versionsnummer bezeichneten Kernel. Die Patches basieren auf dem Kernel 1.2.11.
Frühere bzw. spätere Kernels auf eigene Gefahr bzw. Bastelei. Frühere bzw. spätere Kernels auf eigene Gefahr bzw. Bastelei.
Insbesondere sollten die Leute, die meckern, weil sie den Kram nicht unter
1.3.xx zum Laufen bekommen, sich ernsthaft fragen, wieso sie einen Kernel
einsetzen, der ausdrücklich für Leute gedacht ist, die selber nach Bugs
suchen können.
Was die einzelnen Patches machen und ob sie benötigt werden, Was die einzelnen Patches machen und ob sie benötigt werden,
steht in den einzelnen Dateien am Anfang. Lesen, bevor der Kernel verändert steht in den einzelnen Dateien am Anfang. Lesen, bevor der Kernel verändert
wird! wird!
Der Kernel sollte mit CONFIG_MODVERSIONS gebaut werden. Der Kernel sollte mit CONFIG_MODVERSIONS gebaut werden; das ist zwar nicht
unbedingt notwendig, aber sinnvoll.
Das modutils-1.2.8-Paket wird in jedem Fall benötigt, um Parameter an die Das modutils-1.2.8-Paket wird in jedem Fall benötigt, um Parameter an die
einzelnen Module zu übergeben. einzelnen Module zu übergeben.
@ -223,16 +233,24 @@ for i in biglog more_free setnoswap ; do
patch -p0 -d /usr/src/linux < $i patch -p0 -d /usr/src/linux < $i
done done
# Andere Patche in diesem Verzeichnis ansehen, evtl. ebenfalls installieren. # Andere Patche in diesem Verzeichnis ansehen, evtl. ebenfalls installieren.
# Vorsicht, die Patches beruhen auf Linux 1.2.11.
# #
# Kernel installieren und booten. # Kernel installieren und booten.
# (alten Kernel unbedingt zu Backupzwecken erhalten!) # (alten Kernel unbedingt zu Backupzwecken erhalten!)
# Danach: # Danach:
vi config/config.data
# Zeile "PROTOCOLS" und "SUBPROTOCOLS" ansehen. Siehe unten "DL-Zeile".
make.isdn make.isdn
# Als Superuser: # Wenn er nun über config.new und config.data meckert:
# Siehe unten Probleme.
# mv config/config.new config/config.data
# vi config/config.data
# # Insbesondere: Zeilen "PROTOCOLS" und "SUBPROTOCOLS" ansehen.
# # Siehe unten "DL-Zeile".
# Danach: Nochmal make.isdn starten.
#
# Nun als Superuser:
make.isdn make.isdn
# oder einfach "make install".
Editiere /lib/modules/modules.isdn: Editiere /lib/modules/modules.isdn:
-o Tel0 isdn/teles.o name=$(cardname Tel0) mem=0xD6000 irq=5 ipl=1 -o Tel0 isdn/teles.o name=$(cardname Tel0) mem=0xD6000 irq=5 ipl=1
anstatt anstatt
@ -245,6 +263,54 @@ vi /etc/isdn.conf # ISDN-Nummern, Dienste, etc. eintragen
Sämtliche Gerätedateien werden automatisch angelegt. Sämtliche Gerätedateien werden automatisch angelegt.
Probleme bei der Installation
--------
Als allererstes: Der obige Hinweis re Kernel installieren sollte ernst
genommen werden. Grund: Jeder modularisierte Treiber _braucht_ Zugriff auf
die korrekt konfigurierten Sourcen genau des Kernels, unter dem er später
laufen soll. Dies gilt ganz besonders, wenn der Kernel mit
CONFIG_MODVERSIONS gebaut wurde (das ist um einiges sicherer!).
Wenn sich die Module nicht laden lassen, weil insmod Sachen wie "kfree"
nicht findet, dann liegt das daran, daß die Version der Sourcen des
Kernels, des laufenden Kernels, und der ISDN-Treiber, nicht übereinstimmt.
Also: cd /wo/auch/immer/ist/src/linux; make config; make dep; make;
make modules; make modules_install; cp arch/i386/boot/zImage /boot/linux\
.versionsnummer; vi /etc/lilo.conf; lilo; reboot.
Disclaimer: So mache ich das.
config.new und config.dist und config.data. Das Problem ist, daß ich an der
config.data gelegentlich was ändern muß, aber der Benutzer daran auch
rumspielt (dazu ist die Datei da). Was tun?
Einfach: Mit den Parametern der alten config.data wird die neue config.dist
"geladen", und das Ergebnis liegt nun in config.new. Dasselbe passiert,
wenn es noch keine config.data gibt. In beiden Fällen tut man gut daran,
sich die Datei config.new näher anzusehen, evtl. mit der alten config.data
zu vergleichen, und dann "mv config.new config.data". Sicherheitshalber
weigert sich das Makefile in config/, ohne diesen Schritt weiterzuarbeiten.
Autoconfig und wieso nicht: Nein, ich weigere mich (momentan), automatisch
nach Karten, deren Interrupts, deren Konfigurationsregister etc.pp. zu
suchen. Bei einem laufenden Kernel ist das alles andere als einfach!
Stattdessen müssen die entsprechenden Daten in /lib/modules/modules.isdn
eingetragen werden. Wenn irgendwas nicht stimmt, wird im allgemeinen die
Karte nicht erkannt und das Treibermodul nicht geladen.
Ausnahme: IRQs, die werden momentan nicht überprüft. Das kann man manuell
machen: nach der installation der Treiber beim ISDN-Anschluß der Karte
anrufen. Dann "cat /proc/interrupts". Wenn neben dem Wort ISDN eine Zahl
kleiner drei steht, stimmt was nicht -- anderen Interrupt probieren,
BIOS-Konfiguration überprüfen: auch korrekt eingestellte Interrupts können
Probleme machen, wenn zB das BIOS eines PCI-Rechners den Interrupt zu einem
PCI- anstatt zu einem ISA-Slot routet. (Evtl müssen da trotz BIOS-
Konfiguration noch Jumper auf dem Mainboard umgesetzt werden. Doku des
Teils lesen!)
Treiberparameter: Treiberparameter:
----------------- -----------------
@ -284,8 +350,9 @@ Beispiel: insmod d_teles.o
rmmod Tel0 ; rmmod d_teles.o rmmod Tel0 ; rmmod d_teles.o
Alle Treiber können vor oder nach Start des Masterprogramms geladen oder Alle Kartentreiber können vor oder nach Start des Masterprogramms geladen
wieder entfernt werden. Aktive Verbindungen werden (unsauber) abgebrochen. oder wieder entfernt werden. Aktive Verbindungen werden (unsauber)
abgebrochen.
Testen: Testen:
@ -561,6 +628,10 @@ Alle Zeilentypen:
möglich (Beispiel: "Bin0/23".) möglich (Beispiel: "Bin0/23".)
<Mod> sind einzelne Buchstaben, die der betreffenden Zeile eine Sonder- <Mod> sind einzelne Buchstaben, die der betreffenden Zeile eine Sonder-
behandlung verpassen. Welche, ist jeweils beschrieben. behandlung verpassen. Welche, ist jeweils beschrieben.
Die Unterscheidung "mehrere gleichzeitig" oder "nur eine
gleichzeitig" bei Wählverbindungen bezieht sich jeweils auf eine
Art/Partner-Kombination; allgemeinere Einschränkungen werden mit
einer Extra-CL-Zeile realisiert.
<Parameter...> ist eine Folge von einem oder mehr Parameter-Wert-Angaben. <Parameter...> ist eine Folge von einem oder mehr Parameter-Wert-Angaben.
(Manche Parameter haben keine Wertangabe.) (Manche Parameter haben keine Wertangabe.)
Merke: Zeilen ohne Parameter sind nicht besonders sinnvoll. Merke: Zeilen ohne Parameter sind nicht besonders sinnvoll.
@ -592,7 +663,7 @@ Parameter:
kommende abgewiesen werden. (Default: Der abgehende Ruf wird kommende abgewiesen werden. (Default: Der abgehende Ruf wird
abgebrochen.) abgebrochen.)
:yi Bei einem ankommeden Ruf wird automatisch ein abgehender gestartet und :yi Bei einem ankommeden Ruf wird automatisch ein abgehender gestartet und
der ankommende wird abgewiesen. der ankommende wird abgewiesen (Callback).
:bi Bei einem ankommenden Ruf, der nicht angenommen werden kann (belegt?), :bi Bei einem ankommenden Ruf, der nicht angenommen werden kann (belegt?),
wird automatisch auf einer anderen Leitung zurückgerufen. wird automatisch auf einer anderen Leitung zurückgerufen.
:fr ebenfalls zu setzen ist meist sinnvoll. :fr ebenfalls zu setzen ist meist sinnvoll.
@ -651,8 +722,14 @@ X Wenn diese Zeile (oder eine dar
i für ankommende Verbindungen i für ankommende Verbindungen
o für abgehende Verbindungen o für abgehende Verbindungen
f für Festverbindungen f für Festverbindungen
d für Wählverbindungen d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf p für Verbindungsaufbau nach Bedarf
Ist keines der Zeichen 'd','p','f' vorhanden, wird 'd' angenommen, mit
dem Unterschied, daß die so bezeichnete Verbindung mehrmals unabhängig
voneinander aufgebaut werden kann (z.B. Login). 'd' bezeichnet eine
nur einmal herstellbare Verbindung (TCP, wenn das Interface nach
Verbindungsende verschwinden soll).
Der Suchalgorithmus findet zunächst eine zur Verbindung passende Zeile mit Der Suchalgorithmus findet zunächst eine zur Verbindung passende Zeile mit
R-Flag und hängt an deren Parameterliste alle ebenfalls passenden Zeilen R-Flag und hängt an deren Parameterliste alle ebenfalls passenden Zeilen
@ -686,7 +763,8 @@ Mod:
i für ankommende Verbindungen i für ankommende Verbindungen
o für abgehende Verbindungen o für abgehende Verbindungen
f für Festverbindungen f für Festverbindungen
d für Wählverbindungen d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf p für Verbindungsaufbau nach Bedarf
,# Verzögerung bei Verbindungsende, in Sekunden, für sauberes ,# Verzögerung bei Verbindungsende, in Sekunden, für sauberes
Herunterfahren des B-Kanalprotokolls. Herunterfahren des B-Kanalprotokolls.
@ -714,7 +792,8 @@ Mod:
i für ankommende Verbindungen i für ankommende Verbindungen
o für abgehende Verbindungen o für abgehende Verbindungen
f für Festverbindungen f für Festverbindungen
d für Wählverbindungen d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf p für Verbindungsaufbau nach Bedarf
u für Parameter, die nur beim Programmstart gesetzt werden (x75-Kram zB) u für Parameter, die nur beim Programmstart gesetzt werden (x75-Kram zB)
a für Parameter, die bei Neueinlesen der Konfigdaten gesetzt werden a für Parameter, die bei Neueinlesen der Konfigdaten gesetzt werden
@ -740,8 +819,11 @@ Mod:
i für ankommende Verbindungen i für ankommende Verbindungen
o für abgehende Verbindungen o für abgehende Verbindungen
f für Festverbindungen (der zu verwendende B-Kanal steht in der P-Zeile) f für Festverbindungen (der zu verwendende B-Kanal steht in der P-Zeile)
d für Wählverbindungen d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf p für Verbindungsaufbau nach Bedarf
B Backup-Nummer, wird nur verwendet, wenn das Wählen anderer Nummern
mindestens einmal fehlschlug.
TM-Zeile ("Time") TM-Zeile ("Time")
@ -864,8 +946,8 @@ Die Reihenfolge ist wichtig.
:lp X X X CAPI-Bitmasken für EAZ, Service, Infos. Hexadezimal. :lp X X X CAPI-Bitmasken für EAZ, Service, Infos. Hexadezimal.
Default: 03FF E7BF 003F. Default: 03FF E7BF 003F.
:st XXXXX Protokollstack XXXXX laden. Siehe Handbuch zur Karte. :st XXXXX Protokollstack XXXXX laden. Siehe Handbuch zur Karte.
Default ist u_1tr6_pmp (wenn "german" und nicht "euro" inn Default ist u_1tr6_pmp (wenn "german" und nicht "euro" in
config/config-data angegeben wurde) oder u_dss1_pmp (sonst). config/config.data angegeben wurde) oder u_dss1_pmp (sonst).
:ea N NNN EAZ N auf lokale Nummer (MSN) NNN mappen. :ea N NNN EAZ N auf lokale Nummer (MSN) NNN mappen.
Default ist die letzte Ziffer der Nummer. Default ist die letzte Ziffer der Nummer.
Nicht bei :pb verwenden. Nicht bei :pb verwenden.
@ -956,7 +1038,8 @@ B Die Verbindung wird beim Hochfahren des Managers automatisch aufgebaut.
i für ankommende Verbindungen i für ankommende Verbindungen
o für abgehende Verbindungen o für abgehende Verbindungen
f für Festverbindungen. "B" wird hier normalerweise ebenfalls angegeben. f für Festverbindungen. "B" wird hier normalerweise ebenfalls angegeben.
d für Wählverbindungen d für Wählverbindungen (nur eine gleichzeitig)
m für Wählverbindungen (mehrere gleichzeitig)
p für Verbindungsaufbau nach Bedarf ("reconn"-Modul nicht vergessen!); p für Verbindungsaufbau nach Bedarf ("reconn"-Modul nicht vergessen!);
wird beim Programmstart automatisch mitgestartet. Die eigentliche wird beim Programmstart automatisch mitgestartet. Die eigentliche
ISDN-Verbindung wird hierdurch _nicht_ aufgebaut, dafür ist "B" gedacht. ISDN-Verbindung wird hierdurch _nicht_ aufgebaut, dafür ist "B" gedacht.
@ -1343,14 +1426,16 @@ Steuerprogramm f
Hintergrund setzt. Hintergrund setzt.
-f dev Steuerdevice anstelle von /dev/isdnmon. -f dev Steuerdevice anstelle von /dev/isdnmon.
-I Debugbefehle werden von stdin gelesen. -I Debugbefehle werden von stdin gelesen.
-t Testflag. Nicht verwenden.
-l setzt ein strlog-Modul auf die Steuerverbindung. Debugging. -l setzt ein strlog-Modul auf die Steuerverbindung. Debugging.
-L setzt ein qinfo-Modul auf die Steuerverbindung. Debugging. -w setzt ein logh-Modul auf die programminterne Verbindung zwischen
-w setzt ein strlog-Modul auf die programminterne Verbindung zwischen dem Treiber im Kernel und dem Masterprozeß. Debugging.
dem eigentlichen Programm und dem ISDN-Level-3-Code. Debugging. -L, -W wie -l / -w, jedoch im Kernel-Log anstatt auf stderr.
-m schreibt die programminterne Verbindung zwischen Ebene 3 und 4
auf stderr mit. Sehr wichtig beim Debuggen.
-M schreibt diverse andere Debugginginfo nach stderr.
-x file Datei mit (internen) Steuerbefehlen, die nach dem vollständigen Start -x file Datei mit (internen) Steuerbefehlen, die nach dem vollständigen Start
des ISDN-Krams ausgeführt wird. Ungetestet. des ISDN-Krams ausgeführt wird. Ungetestet.
file... Steuerdateien. file... Konfigurationsdateien.
monitor monitor
@ -1416,13 +1501,12 @@ Hackers Corner
============== ==============
Debuggingoptionen: Debuggingoptionen:
Das Masterprogramm schickt Debugkram nach stdout. Umleiten nach /dev/null Das Masterprogramm schickt Debugkram nach stderr und manches andere nach
wenn's stört. stdout. Umleiten nach /dev/null wenn's stört; die Debugsachen werden
sukzessive abgestellt, wenn ich mal wieder ein wenig Zeit habe. :-/
In isdn/cards/dumb/Config.c stehen ein paar DEBUG_*-Flags. Das Debuggingverhalten des Haupttreibers im Kernel läßt sich durch die
isdn2_debug- und isdn2_log-Flags steuern; siehe isdn_2/isdn_2.c.
In isdn/config/config.data finden sich die Konstanten CONF_DEBUG und
CONF_MOD2, die das Verhalten von isdn_2/isdn_2.c kontrollieren.
Hinweis: Wenn alles funktioniert, kann man die Debuggerei getrost Hinweis: Wenn alles funktioniert, kann man die Debuggerei getrost
abschalten. Allerdings ist dann die Fehlersuche so gut wie unmöglich... abschalten. Allerdings ist dann die Fehlersuche so gut wie unmöglich...

View File

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

14
README
View File

@ -4,6 +4,20 @@ Die Anleitung und der ganze Kram findet sich in der Datei DOKU, oder
README.isdn in den Kernelsourcen. README.isdn in den Kernelsourcen.
*** 1995-11-06
Release 19. Kleinere Bugfixes, insbesondere funktioniert das Senden von
EAZ unter 1TR6 wieder...
Der Backoff-Algorithmus, wennn die Gegenstelle nicht antwortet, wurde von
"konstant oder linear" auf "exponentiell" umgestellt. Sorry, aber das muß
so sein -- sonst meckert die Telekomik.
Der Master spuckt jetzt seine ganzen Debugmeldungen auf stderr aus und
protokolliert Statusmeldungen (Gebühreneinheiten) auf stdout.
VORHER WAR DAS UMGEKEHRT, das hat manchen Benutzer durcheinandergebracht.
*** 1995-10-30 *** 1995-10-30
Release 17. Release 17.

View File

@ -16,7 +16,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
/* #include <sys/user.h> */ /* #include <sys/user.h> */
#include <sys/errno.h> #include <sys/errno.h>
#include "streamlib.h" #include "streamlib.h"

View File

@ -11,7 +11,7 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#ifdef linux #ifdef linux
#include <linux/syscompat.h> #include <compat.h>
#endif #endif
short mx[] = {16,32,64,128,256,512,1024,2048}; short mx[] = {16,32,64,128,256,512,1024,2048};

View File

@ -11,7 +11,7 @@
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#ifdef linux #ifdef linux
#include <linux/syscompat.h> #include <compat.h>
#endif #endif
short mult[] = {2,2,4,8,16,32,64,128}; short mult[] = {2,2,4,8,16,32,64,128};

View File

@ -6,7 +6,7 @@ REALSOURCE=loader.c
OBJS=$(addsuffix .o,$(CARDS)) OBJS=$(addsuffix .o,$(CARDS))
EXTRA_CFLAGS= -DCARDTYPE=$(basename $@ .o) EXTRA_CFLAGS= -DCARDTYPE=$(basename $@ .o)
SUBDIRS=capi dumb SUBDIRS=capi dumb arnet
include $(TOPDIR)/Make.rules include $(TOPDIR)/Make.rules

View File

@ -14,7 +14,7 @@
#include "f_malloc.h" #include "f_malloc.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
/* #ifdef DONT_ADDERROR */ /* #ifdef DONT_ADDERROR */
#include "f_user.h" #include "f_user.h"
/* #endif */ /* #endif */
@ -23,14 +23,16 @@
#include <fcntl.h> #include <fcntl.h>
#include <stddef.h> #include <stddef.h>
#include "streamlib.h" #include "streamlib.h"
#include "lap.h"
#include <sys/termios.h> #include <sys/termios.h>
#include "loader.h"
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/tqueue.h> #include <linux/tqueue.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h>
#include "loader.h"
extern void log_printmsg (void *log, const char *text, mblk_t * mp, const char*); extern void log_printmsg (void *log, const char *text, mblk_t * mp, const char*);
extern void logh_printmsg (void *log, const char *text, mblk_t * mp); extern void logh_printmsg (void *log, const char *text, mblk_t * mp);
@ -134,16 +136,21 @@ static unsigned short memsz[] = {
}; };
#define NRMEM (sizeof(memsz)/sizeof(memsz[0])) #define NRMEM (sizeof(memsz)/sizeof(memsz[0]))
struct arnet_info { unsigned char *membase; short irq; short ioaddr; struct arnet_info {
struct cardinfo info,*infoptr;
struct arnet_info *next;
unsigned short nports; short handshake; unsigned short nports; short handshake;
struct tq_struct queue; char usage; struct tq_struct queue; char usage;
unsigned char ena01; unsigned char ena23; unsigned char irqf; unsigned char ena01; unsigned char ena23; unsigned char irqf;
struct arnet_port port[4]; struct arnet_port port[4];
ARNET_ADDR memsize; ARNET_ADDR freemem[NRMEM]; ARNET_ADDR limmem; ARNET_ADDR memsize; ARNET_ADDR freemem[NRMEM]; ARNET_ADDR limmem;
ARNET_ADDR curpage; } ARNET_ADDR curpage; };
arnet_list[3] = {{NULL,}};
short arnet_ncards = 0; #define ARNET_NCARDS 4
#define ARNET_NPORTS 4
static struct arnet_info *arnet_map[NR_IRQS] = { NULL, };
static struct arnet_info *arnet_cards[ARNET_NCARDS];
const char *astr(char x) const char *astr(char x)
{ {
@ -163,7 +170,7 @@ ldprintf(".%d.",__LINE__);
} }
#define MEM(type,arn,offset) *(volatile unsigned type *)((void *)((arn)->membase + ((offset) & 0x3FFF))) #define MEM(type,arn,offset) *(volatile unsigned type *)((void *)((arn)->info.memaddr + ((offset) & 0x3FFF)))
#define ADDR_SCA0 0xe110babe #define ADDR_SCA0 0xe110babe
#define ADDR_SCA1 0xca11babe #define ADDR_SCA1 0xca11babe
@ -175,29 +182,29 @@ arnet_page(struct arnet_info *arn, ARNET_ADDR addr)
switch(addr) { switch(addr) {
case ADDR_NONE: case ADDR_NONE:
if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C-_"); } } if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C-_"); } }
outb_p(0x00,arn->ioaddr+8); outb_p(0x00,arn->info.ioaddr+8);
return NULL; return NULL;
case ADDR_SCA0: case ADDR_SCA0:
if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C0_"); } } if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C0_"); } }
outb_p(0xC0,arn->ioaddr+8); outb_p(0xC0,arn->info.ioaddr+8);
break; break;
case ADDR_SCA1: case ADDR_SCA1:
if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C1_"); } } if(dodebug) { if(arn->curpage != ADDR_NONE) { arn->curpage = ADDR_NONE; dprintf("C1_"); } }
outb_p(0xE0,arn->ioaddr+8); outb_p(0xE0,arn->info.ioaddr+8);
break; break;
default: default:
dprintf(" BadPage 0x%lx ",addr); dprintf(" BadPage 0x%lx ",addr);
return NULL; return NULL;
} }
SLOW_DOWN_IO; SLOW_DOWN_IO; SLOW_DOWN_IO; SLOW_DOWN_IO;
return arn->membase; return (void *)arn->info.memaddr;
} }
inline static void * inline static void *
arnet_mempage(struct arnet_info *arn, ARNET_ADDR addr) arnet_mempage(struct arnet_info *arn, ARNET_ADDR addr)
{ {
outb_p(((addr >> 14) & 0x0F) | 0x80, arn->ioaddr+8); outb_p(((addr >> 14) & 0x0F) | 0x80, arn->info.ioaddr+8);
if(dodebug) { if(arn->curpage != (addr & ~0x3FFF)) { arn->curpage = addr & ~0x3FFF; dprintf("P%lx_",0x0F&(addr >> 14)); } } if(dodebug) { if(arn->curpage != (addr & ~0x3FFF)) { arn->curpage = addr & ~0x3FFF; dprintf("P%lx_",0x0F&(addr >> 14)); } }
return arn->membase+(addr & 0x3FFF); return (void *)arn->info.memaddr+(addr & 0x3FFF);
} }
#define SEL_SCA(arp) arnet_page((arp)->inf,((arp)->portnr > 1) ? ADDR_SCA1 : ADDR_SCA0) #define SEL_SCA(arp) arnet_page((arp)->inf,((arp)->portnr > 1) ? ADDR_SCA1 : ADDR_SCA0)
@ -295,7 +302,7 @@ if(dodebug>1)ddprintf("v ");
} while(nszoff > 0); } while(nszoff > 0);
arn->limmem = (arn->limmem + nlsz) & ~0x3FFF; arn->limmem = (arn->limmem + nlsz) & ~0x3FFF;
printf("ARNET %d: mem limit at %ldk\n",arn-arnet_list, (arn->limmem+0x4000) >> 10); printf("ARNET %d: mem limit at %ldk\n",arn->info.ipl, (arn->limmem+0x4000) >> 10);
} }
thisaddr = arn->limmem; thisaddr = arn->limmem;
arn->limmem += lsz; arn->limmem += lsz;
@ -508,7 +515,7 @@ arnet_mode(struct arnet_port *arp, int mode)
unsigned char offset; unsigned char offset;
long flags; long flags;
int err; int err;
unsigned char inb3 = inb_p(arn->ioaddr+3); unsigned char inb3 = inb_p(arn->info.ioaddr+3);
dprintf("ARNET_MODE %d of %d: ",mode,arp->portnr); dprintf("ARNET_MODE %d of %d: ",mode,arp->portnr);
@ -520,22 +527,22 @@ dprintf("ARNET_MODE %d of %d: ",mode,arp->portnr);
case 0: case 0:
offset = 0x20; offset = 0x20;
arn->ena01 = arn->ena01 & ~0x15; arn->ena01 = arn->ena01 & ~0x15;
outb_p(arn->ena01,arn->ioaddr+0x09); break; outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break; break;
case 1: case 1:
offset = 0x40; offset = 0x40;
arn->ena01 = arn->ena01 & ~0x2A; arn->ena01 = arn->ena01 & ~0x2A;
outb_p(arn->ena01,arn->ioaddr+0x09); break; outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break; break;
case 2: case 2:
offset = 0x20; offset = 0x20;
arn->ena23 = arn->ena23 & ~0x15; arn->ena23 = arn->ena23 & ~0x15;
outb_p(arn->ena23,arn->ioaddr+0x0E); break; outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break; break;
case 3: case 3:
offset = 0x40; offset = 0x40;
arn->ena23 = arn->ena23 & ~0x2A; arn->ena23 = arn->ena23 & ~0x2A;
outb_p(arn->ena23,arn->ioaddr+0x0E); break; outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break; break;
default: default:
restore_flags(flags); restore_flags(flags);
@ -560,22 +567,22 @@ dprintf(" ... unknown portnr\n");
case 0: case 0:
offset = 0x20; offset = 0x20;
if(mode & 2) arn->ena01 &= ~0x10; if(mode & 2) arn->ena01 &= ~0x10;
outb_p(arn->ena01,arn->ioaddr+0x09); break; outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break; break;
case 1: case 1:
offset = 0x40; offset = 0x40;
if(mode & 2) arn->ena01 &= ~0x20; if(mode & 2) arn->ena01 &= ~0x20;
outb_p(arn->ena01,arn->ioaddr+0x09); break; outb_p(arn->ena01,arn->info.ioaddr+0x09); break;
break; break;
case 2: case 2:
offset = 0x20; offset = 0x20;
if(mode & 2) arn->ena23 &= ~0x10; if(mode & 2) arn->ena23 &= ~0x10;
outb_p(arn->ena23,arn->ioaddr+0x0E); break; outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break; break;
case 3: case 3:
offset = 0x40; offset = 0x40;
if(mode & 2) arn->ena23 &= ~0x20; if(mode & 2) arn->ena23 &= ~0x20;
outb_p(arn->ena23,arn->ioaddr+0x0E); break; outb_p(arn->ena23,arn->info.ioaddr+0x0E); break;
break; break;
default: default:
dprintf(" ... unknown portnr\n"); dprintf(" ... unknown portnr\n");
@ -634,25 +641,25 @@ dprintf(" ... mode unknown\n");
offset = 0x20; offset = 0x20;
arn->ena01 |= 0x05; arn->ena01 |= 0x05;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena01 |= 0x10; if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena01 |= 0x10;
outb_p(arn->ena01,arn->ioaddr+0x09); outb_p(arn->ena01,arn->info.ioaddr+0x09);
break; break;
case 1: case 1:
offset = 0x40; offset = 0x40;
arn->ena01 |= 0x0A; arn->ena01 |= 0x0A;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena01 |= 0x20; if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena01 |= 0x20;
outb_p(arn->ena01,arn->ioaddr+0x09); outb_p(arn->ena01,arn->info.ioaddr+0x09);
break; break;
case 2: case 2:
offset = 0x20; offset = 0x20;
arn->ena23 |= 0x05; arn->ena23 |= 0x05;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena23 |= 0x10; if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena23 |= 0x10;
outb_p(arn->ena23,arn->ioaddr+0x0E); outb_p(arn->ena23,arn->info.ioaddr+0x0E);
break; break;
case 3: case 3:
offset = 0x40; offset = 0x40;
arn->ena23 |= 0x0A; arn->ena23 |= 0x0A;
if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena23 |= 0x20; if(((inb3 >> 5) != 3) && !(mode & 2)) arn->ena23 |= 0x20;
outb_p(arn->ena23,arn->ioaddr+0x0E); outb_p(arn->ena23,arn->info.ioaddr+0x0E);
break; break;
} }
arp->mode = mode; arp->mode = mode;
@ -840,7 +847,7 @@ dprintf("G %d @ %d ",buf[arp->recvcur].buflen,arp->recvcur);
arp->recvend = (arp->recvend == arp->recvnum) ? 0 : (arp->recvend + 1); arp->recvend = (arp->recvend == arp->recvnum) ? 0 : (arp->recvend + 1);
thebuf = RBUFPTR(&buf[arp->recvend]); thebuf = RBUFPTR(&buf[arp->recvend]);
dprintf("F %d @ %ld:%x ",arp->recvlen,arp->recvend,thebuf); dprintf("F %d @ %d:%lx ",arp->recvlen,arp->recvend,thebuf);
SEL_SCA(arp); SEL_SCA(arp);
MEM(long ,arn,dmaoff+0x00) = thebuf; MEM(long ,arn,dmaoff+0x00) = thebuf;
MEM(short,arn,dmaoff+0x0E) = arp->recvlen; MEM(short,arn,dmaoff+0x0E) = arp->recvlen;
@ -1101,13 +1108,13 @@ ldprintf(".%d.",__LINE__);
} }
if(irq2 & 0x01) { if(irq2 & 0x01) {
unsigned char errs = MEM(char,arn,dmaoff+0x10); unsigned char errs = MEM(char,arn,dmaoff+0x10);
dprintf(":DMI err rcv, s%02x m%02x ", errs, dprintf(":DMI err rcv %d, s%02x m%02x ", errs,
MEM(char ,arn,dmaoff+0x14), MEM(char ,arn,dmaoff+0x14),
MEM(short,arn,dmaoff+0x0E)); MEM(short,arn,dmaoff+0x0E));
if(msk2 & 0x01) { if(msk2 & 0x01) {
errs &= MEM(char,arn,dmaoff+0x14); errs &= MEM(char,arn,dmaoff+0x14);
if(errs & 0x20) { /* buffer overrun receive -- fatal */ if(errs & 0x20) { /* buffer overrun receive -- fatal */
printf(" * ARNET %d.%d: buffer overrun\n",arp->inf-arnet_list,arp->portnr); printf(" * ARNET %d.%d: buffer overrun\n",arp->inf->info.ipl,arp->portnr);
if(!arp->recvsingle) { if(!arp->recvsingle) {
if(0) { if(0) {
struct dmabuf *buf = arnet_mempage(arn,arp->dmarecv); struct dmabuf *buf = arnet_mempage(arn,arp->dmarecv);
@ -1140,7 +1147,7 @@ ldprintf(".%d.",__LINE__);
} }
} }
else if(errs & 0x10) { /* counter overflow */ else if(errs & 0x10) { /* counter overflow */
printf(" * ARNET %d.%d: counter overrun\n",arp->inf-arnet_list,arp->portnr); printf(" * ARNET %d.%d: counter overrun\n",arp->inf->info.ipl,arp->portnr);
} }
} else } else
dprintf(" RE-masked-; "); dprintf(" RE-masked-; ");
@ -1167,7 +1174,7 @@ ldprintf(".%d.",__LINE__);
MEM(short,arn,dmaoff+0x2E)); MEM(short,arn,dmaoff+0x2E));
if(msk2 & 0x04) { if(msk2 & 0x04) {
if(errs & 0x20) { /* buffer over/underrun */ if(errs & 0x20) { /* buffer over/underrun */
if(dodebug>1)printf(" * ARNET %d.%d: buffer underrun\n",arp->inf-arnet_list,arp->portnr); if(dodebug>1)printf(" * ARNET %d.%d: buffer underrun\n",arp->inf->info.ipl,arp->portnr);
if(0)arnet_memdump(arn,"Buf Underrun"); if(0)arnet_memdump(arn,"Buf Underrun");
if(arp->sendoverflow > 1) { if(arp->sendoverflow > 1) {
} else { } else {
@ -1175,7 +1182,7 @@ ldprintf(".%d.",__LINE__);
} }
} }
if(errs & 0x10) { /* counter overflow */ if(errs & 0x10) { /* counter overflow */
printf(" * ARNET %d.%d: counter underrun\n",arp->inf-arnet_list,arp->portnr); printf(" * ARNET %d.%d: counter underrun\n",arp->inf->info.ipl,arp->portnr);
if(arp->sendsingle) { if(arp->sendsingle) {
} else { } else {
} }
@ -1256,66 +1263,79 @@ if(dodebug)dprintf("TxI Off; ");
} }
static void static void
arnet_intr(int irq, struct pt_regs *foo) arnet_intrx(struct arnet_info *arn)
{ {
int arc = arnet_ncards; unsigned long flags;
struct arnet_info *arn = arnet_list;
unsigned char irqf; unsigned char irqf;
ldprintf(".%d.",__LINE__);
while(arc > 0) { save_flags(flags); cli();
unsigned long flags; if(arn->usage++) {
if(dodebug>1)dprintf(".D.");
save_flags(flags); cli(); queue_task(&arn->queue,&tq_timer);
if(arn->usage++) {
if(irq != 0) {
if(dodebug>1)dprintf(".D.");
queue_task(&arn->queue,&tq_timer);
}
restore_flags(flags);
goto next;
}
restore_flags(flags); restore_flags(flags);
goto next;
if((irq != 0) && (arn->irq != irq))
goto next;
irqf = inb_p(arn->ioaddr+0x07);
if((irq != 0) && !(irqf & 1)) {
if(0)dprintf("stray interrupt! ");
goto next;
}
while(irqf & 0x01) {
if(dodebug>1)ddprintf("k ");
arnet_intr1(&arn->port[0]);
if(arn->nports > 1)
arnet_intr1(&arn->port[1]);
if(arn->nports > 2)
arnet_intr1(&arn->port[2]);
if(arn->nports > 3)
arnet_intr1(&arn->port[3]);
irqf = inb_p(arn->ioaddr+0x07);
}
if((irqf ^ arn->irqf) & 0x1E) {
dprintf("ARNET: DCD changed: from %02x to %02x\n",
irqf,arn->irqf);
/* TODO */
}
arn->irqf = irqf;
next:
arn->usage--;
arc--;
arn++;
} }
restore_flags(flags);
irqf = inb_p(arn->info.ioaddr+0x07);
while(irqf & 0x01) {
if(dodebug>1)ddprintf("k ");
arnet_intr1(&arn->port[0]);
if(arn->nports > 1)
arnet_intr1(&arn->port[1]);
if(arn->nports > 2)
arnet_intr1(&arn->port[2]);
if(arn->nports > 3)
arnet_intr1(&arn->port[3]);
irqf = inb_p(arn->info.ioaddr+0x07);
}
if((irqf ^ arn->irqf) & 0x1E) {
dprintf("ARNET: DCD changed: from %02x to %02x\n",
irqf,arn->irqf);
/* TODO */
}
arn->irqf = irqf;
next:
arn->usage--;
} }
static void static void
arnet_exit1(struct arnet_info *arn) arnet_intr(int irq, struct pt_regs *foo)
{ {
int cnt; struct arnet_info *arn;
struct arnet_port *arp = arn->port;
ldprintf(".%d.",__LINE__);
arn->usage = 99;
for(arn=arnet_map[irq];arn != NULL; arn = arn->next)
arnet_intrx(arn);
}
void NAME(REALNAME,exit)(struct cardinfo *inf)
{
struct arnet_info **parn, *arn = NULL;
int cnt;
struct arnet_port *arp;
ldprintf(".%d.",__LINE__);
parn = &arnet_map[inf->irq];
while(*parn != NULL) {
if((*parn)->infoptr == inf) {
arn = *parn;
*parn = arn->next;
break;
}
}
if(arn == NULL) {
printf("ARNET error: exit: info record not found!\n");
return;
}
if(arnet_cards[inf->ipl] != arn) {
printf("ARNET error: exit: info record not found!\n");
return;
}
arnet_cards[inf->ipl] = NULL;
arn->usage = 99;
arp = arn->port;
for(cnt=0;cnt < arn->nports; arp++,cnt++) { for(cnt=0;cnt < arn->nports; arp++,cnt++) {
dprintf("Port %d: ",cnt); dprintf("Port %d: ",cnt);
if(arp->inf != arn) { if(arp->inf != arn) {
@ -1328,42 +1348,65 @@ dprintf("Port %d: ",cnt);
MEM(char,arn, 0x14) = 0x00; /* IRQ off */ MEM(char,arn, 0x14) = 0x00; /* IRQ off */
MEM(char,arn, 0x15) = 0x00; /* IRQ off */ MEM(char,arn, 0x15) = 0x00; /* IRQ off */
MEM(char,arn, 0x16) = 0x00; /* IRQ off */ MEM(char,arn, 0x16) = 0x00; /* IRQ off */
if(arn->irq != 0)
free_irq(arn->irq); if((arnet_map[arn->info.irq] == NULL) && (arn->info.irq != 0))
release_region(arn->ioaddr,16); free_irq(arn->info.irq);
release_region(arn->info.ioaddr,16);
kfree(arn);
} }
static int int NAME(REALNAME,init)(struct cardinfo *inf)
arnet_init1(struct arnet_info *arn)
{ {
uchar_t inb3, inb4, inb5, inb6, inbc; uchar_t inb3, inb4, inb5, inb6, inbc;
unsigned short x; unsigned short x;
struct arnet_port *arp; struct arnet_port *arp;
struct arnet_info *arn;
printf("Arnet: "); printf("Arnet: ");
if(inf->ioaddr < 0x100) {
printf("IOADDR %d bad\n",inf->ioaddr);
return -EINVAL;
}
if(inf->ipl >= ARNET_NCARDS) {
printf("IPL %d bad, 0 <= ipl <= %d\n",inf->ipl,ARNET_NCARDS-1);
return -EINVAL;
}
if(arnet_cards[inf->ipl] != NULL) {
printf("IPL %d busy!\n",inf->ipl);
return -EBUSY;
}
arn = kmalloc(sizeof(*arn),GFP_KERNEL);
if(arn == NULL) {
printf("no memory!\n");
return -ENOMEM;
}
bzero(arn,sizeof(*arn));
arn->usage = 99; arn->usage = 99;
bzero(&arn->queue,sizeof(arn->queue)); arn->queue.routine = (void *)&arnet_intrx;
arn->queue.routine = (void *)&arnet_intr; arn->queue.data = (void *)arn;
arn->queue.data = (void *)(long)arn->irq; arn->infoptr = inf;
arn->info = *inf;
for(x=0;x<NRMEM;x++) for(x=0;x<NRMEM;x++)
arn->freemem[x] = 0; arn->freemem[x] = 0;
arn->limmem = 256; arn->limmem = 256;
inb3 = inb_p(arn->ioaddr+3); inb3 = inb_p(arn->info.ioaddr+3);
inb4 = inb_p(arn->ioaddr+4); inb4 = inb_p(arn->info.ioaddr+4);
inb5 = inb_p(arn->ioaddr+5); inb5 = inb_p(arn->info.ioaddr+5);
inb6 = inb_p(arn->ioaddr+6); inb6 = inb_p(arn->info.ioaddr+6);
if(check_region(arn->ioaddr,16)) { if(check_region(arn->info.ioaddr,16)) {
printf("*** region 0x%x..0x%x blocked\n",arn->ioaddr,arn->ioaddr+15); printf("*** region 0x%x..0x%x blocked\n",arn->info.ioaddr,arn->info.ioaddr+15);
return 0; kfree(arn);
return -EBUSY;
} }
arn->memsize = 1<<(((inb3&0x1C)>>2)+16); arn->memsize = 1<<(((inb3&0x1C)>>2)+16);
printf("cf %02x: %d kByte, memory at %p, bus %d, adapter %s; %d ports; rev %02x; ", inb3, arn->memsize>>10, arn->membase, inb3&3, astr(inb3>>5), inb5, inb4); printf("cf %02x: %ld kByte, memory at %lx, bus %d, adapter %s; %d ports; rev %02x; ", inb3, arn->memsize>>10, arn->info.memaddr, inb3&3, astr(inb3>>5), inb5, inb4);
if((unsigned long)arn->membase & 0xFF003FFF) { if(((unsigned long)arn->info.memaddr & 0xFF003FFF) || ((unsigned long)arn->info.memaddr < 0x80000)) {
printf("*** invalid membase: 0x%p\n",arn->membase); printf("*** invalid memaddr: 0x%lx\n",arn->info.memaddr);
return 0; kfree(arn);
return -EINVAL;
} }
{ {
unsigned long i; unsigned long i;
@ -1379,7 +1422,8 @@ arnet_init1(struct arnet_info *arn)
arn->nports = inb5; arn->nports = inb5;
if(arn->nports != 2 && arn->nports != 4) { if(arn->nports != 2 && arn->nports != 4) {
printf("huh? card with %d ports?\n",arn->nports); printf("huh? card with %d ports?\n",arn->nports);
return 0; kfree(arn);
return -EIO;
} }
arn->handshake = inb6; arn->handshake = inb6;
if(inb6 == 0) if(inb6 == 0)
@ -1404,14 +1448,14 @@ arnet_init1(struct arnet_info *arn)
arp->mode = -1; arp->mode = -1;
} }
outb_p(0x00,arn->ioaddr+0x09); outb_p(0x00,arn->info.ioaddr+0x09);
if(arn->nports > 2) if(arn->nports > 2)
outb_p(0x00,arn->ioaddr+0x0E); outb_p(0x00,arn->info.ioaddr+0x0E);
udelay(2); udelay(2);
outb_p(0x40,arn->ioaddr+0x09); outb_p(0x40,arn->info.ioaddr+0x09);
udelay(500); udelay(500);
arn->ena01 = arn->ena23 = 0x70; arn->ena01 = arn->ena23 = 0x70;
switch(arn->irq) { switch(arn->info.irq) {
case 0: inbc = 0; break; case 0: inbc = 0; break;
case 3: inbc = 1; break; case 3: inbc = 1; break;
case 5: inbc = 2; break; case 5: inbc = 2; break;
@ -1421,15 +1465,16 @@ arnet_init1(struct arnet_info *arn)
case 12: inbc = 6; break; case 12: inbc = 6; break;
case 15: inbc = 7; break; case 15: inbc = 7; break;
default: default:
printf("*** unknown IRQ %d\n",arn->irq); printf("*** unknown IRQ %d\n",arn->info.irq);
return 0; kfree(arn);
return -EBUSY;
} }
inbc <<= 1; inbc <<= 1;
inbc |= 1 | (((long)arn->membase >> 10) & 0x30); inbc |= 1 | (((long)arn->info.memaddr >> 10) & 0x30);
outb_p((long)arn->membase >> 16, arn->ioaddr+13); outb_p((long)arn->info.memaddr >> 16, arn->info.ioaddr+13);
outb_p(inbc, arn->ioaddr+12); outb_p(inbc, arn->info.ioaddr+12);
arn->irqf = inb_p(arn->ioaddr+7); arn->irqf = inb_p(arn->info.ioaddr+7);
printf("inbc %02x, inbd %02lx; irqf %02x",inbc,(((long)arn->membase)>>16)&0xFF, arn->irqf); printf("inbc %02x, inbd %02lx; irqf %02x",inbc,(((long)arn->info.memaddr)>>16)&0xFF, arn->irqf);
/* Now checking memory access */ /* Now checking memory access */
@ -1455,27 +1500,31 @@ arnet_init1(struct arnet_info *arn)
if(MEM(char,arn,0x33) != 0xAA) { if(MEM(char,arn,0x33) != 0xAA) {
if((arn->nports <= 2) || (MEM(char,arn,0x33) != 0x5A)) { if((arn->nports <= 2) || (MEM(char,arn,0x33) != 0x5A)) {
printf("ERROR: Readback A, %02x\n", MEM(char,arn,0x33)); printf("ERROR: Readback A, %02x\n", MEM(char,arn,0x33));
return 0; return -EIO;
} }
printf("ERROR: second chip unselectable A, %02x\n", MEM(char,arn,0x33)); printf("ERROR: second chip unselectable A, %02x\n", MEM(char,arn,0x33));
return 0; kfree(arn);
return -EIO;
} }
if(MEM(char,arn,0x53) != 0x55) { if(MEM(char,arn,0x53) != 0x55) {
if((arn->nports <= 2) || (MEM(char,arn,0x53) != 0xA5)) { if((arn->nports <= 2) || (MEM(char,arn,0x53) != 0xA5)) {
printf("ERROR: Readback B, %02x\n", MEM(char,arn,0x53)); printf("ERROR: Readback B, %02x\n", MEM(char,arn,0x53));
return 0; return -EIO;
} }
printf("ERROR: second chip unselectable B, %02x\n", MEM(char,arn,0x53)); printf("ERROR: second chip unselectable B, %02x\n", MEM(char,arn,0x53));
return 0; kfree(arn);
return -EIO;
} }
if(arn->nports > 2) { if(arn->nports > 2) {
arnet_page(arn,ADDR_SCA1); arnet_page(arn,ADDR_SCA1);
if(MEM(char,arn,0x33) != 0x5A) { if(MEM(char,arn,0x33) != 0x5A) {
printf("ERROR: Readback C, %02x\n", MEM(char,arn,0x33)); printf("ERROR: Readback C, %02x\n", MEM(char,arn,0x33));
return 0; kfree(arn);
return -EIO;
} else if(MEM(char,arn,0x53) != 0xA5) { } else if(MEM(char,arn,0x53) != 0xA5) {
printf("ERROR: Readback D, %02x\n", MEM(char,arn,0x53)); printf("ERROR: Readback D, %02x\n", MEM(char,arn,0x53));
return 0; kfree(arn);
return -EIO;
} }
} }
@ -1488,71 +1537,46 @@ arnet_init1(struct arnet_info *arn)
MEM(char,arn,0x53) = 0xFF; MEM(char,arn,0x53) = 0xFF;
} }
if((arn->irq != 0) && request_irq(arn->irq,arnet_intr,0 /* SA_INTERRUPT */,"arnet")) { if((arn->info.irq != 0) && (arnet_map[arn->info.irq] == NULL) && request_irq(arn->info.irq,arnet_intr,0 /* SA_INTERRUPT */,"arnet")) {
printf("*** IRQ %d not available\n",arn->irq); printf("*** IRQ %d not available\n",arn->info.irq);
return 0; kfree(arn);
return -EBUSY;
} }
request_region(arn->ioaddr,16,"arnet"); request_region(arn->info.ioaddr,16,"arnet");
arn->next = arnet_map[arn->info.irq];
arnet_map[arn->info.irq] = arn;
arnet_cards[arn->info.ipl] = arn;
printf("\n"); printf("\n");
arn->usage = 0; arn->usage = 0;
return 1; return 0;
} }
static int
arnet_init (void)
{
ldprintf(".%d.",__LINE__);
arnet_ncards = 0;
arnet_list[arnet_ncards].membase = (void *)0xCC000;
arnet_list[arnet_ncards].irq = 15;
arnet_list[arnet_ncards].ioaddr = 0x300;
if(arnet_init1(&arnet_list[0])) arnet_ncards++;
printf ("ARNET: %d cards found\n",arnet_ncards);
if(arnet_ncards == 0)
return -ESRCH;
else
return 0;
}
static void
arnet_exit(void)
{
int arc = arnet_ncards;
struct arnet_info *arn = arnet_list;
ldprintf(".%d.",__LINE__);
while(arc > 0) {
dprintf("Exit, %d ports: ",arn->nports);
ddprintf("l ");
arnet_exit1(arn);
arc--;
arn++;
}
}
/* Streams code to open the driver. */ /* Streams code to open the driver. */
static int static int
arnet_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL) arnet_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
{ {
struct arnet_info *arn = arnet_list; struct arnet_info **parn = arnet_cards;
struct arnet_info *arn = NULL;
struct arnet_port *arp; struct arnet_port *arp;
int mdev = arnet_ncards; int mdev = ARNET_NCARDS-1;
int cdev; int cdev;
int err; int err;
ldprintf(".%d.",__LINE__); ldprintf(".%d.",__LINE__);
dev = minor (dev); dev = minor (dev);
cdev = dev & 0x0F; cdev = dev & 0x0F;
while(mdev > 0 && cdev >= arn->nports) { while(mdev > 0 && cdev >= 0) {
if((arn = *parn) != NULL && cdev < arn->nports)
break;
ddprintf("n "); ddprintf("n ");
cdev -= arn->nports; cdev -= ARNET_NPORTS;
arn++; parn++;
mdev --; mdev --;
} }
if(mdev == 0) { if(mdev == 0 || cdev < 0) {
ERR_RETURN(-ENXIO); ERR_RETURN(-ENXIO);
} }
arn->usage++; arn->usage++;
@ -1567,13 +1591,11 @@ ddprintf("n ");
arp->q = q; arp->q = q;
arp->mode = dev >> 4; arp->mode = dev >> 4;
MORE_USE;
WR (q)->q_ptr = (caddr_t) arp; WR (q)->q_ptr = (caddr_t) arp;
q->q_ptr = (caddr_t) arp; q->q_ptr = (caddr_t) arp;
if((err = arnet_mode(arp,arp->mode)) < 0) { if((err = arnet_mode(arp,arp->mode)) < 0) {
arnet_dmaexit(arp); arnet_dmaexit(arp);
LESS_USE;
arn->usage--; arn->usage--;
q->q_ptr = NULL; q->q_ptr = NULL;
WR(q)->q_ptr = NULL; WR(q)->q_ptr = NULL;
@ -1595,6 +1617,7 @@ ddprintf("n ");
arp->recvend, arp->recvend,
MEM(short,arn,dmaoff+0x0C)); MEM(short,arn,dmaoff+0x0C));
} }
(*arn->info.use_count)++;
return dev; return dev;
} }
@ -1620,7 +1643,7 @@ arnet_close (queue_t *q, int dummy)
arp->q = NULL; arp->q = NULL;
arn->usage--; arn->usage--;
LESS_USE; (*arn->info.use_count)--;
return; return;
} }
@ -1630,7 +1653,7 @@ static void
arnet_wput (queue_t *q, mblk_t *mp) arnet_wput (queue_t *q, mblk_t *mp)
{ {
struct arnet_port *arp = (struct arnet_port *) q->q_ptr; struct arnet_port *arp = (struct arnet_port *) q->q_ptr;
struct arnet_info *arn = arp->inf; /* struct arnet_info *arn = arp->inf; */
ldprintf(".%d.",__LINE__); ldprintf(".%d.",__LINE__);
#ifdef CONFIG_DEBUG_STREAMS #ifdef CONFIG_DEBUG_STREAMS
@ -1641,13 +1664,13 @@ ldprintf(".%d.",__LINE__);
freemsg(mp); freemsg(mp);
return; return;
} }
switch (DATATYPE(mp)) { switch (DATA_TYPE(mp)) {
case M_IOCTL: case M_IOCTL:
DATA_TYPE(mp) = M_IOCNAK; DATA_TYPE(mp) = M_IOCNAK;
((struct iocblk *)mp->b_rptr)->ioc_error = EINVAL; ((struct iocblk *)mp->b_rptr)->ioc_error = EINVAL;
qreply (q, mp); qreply (q, mp);
break; break;
CASE_DATA case CASE_DATA:
putq (q, mp); putq (q, mp);
break; break;
case M_FLUSH: case M_FLUSH:
@ -1763,7 +1786,6 @@ if(dodebug>1)ddprintf("q ");
} }
#ifdef MODULE #ifdef MODULE
static int devmajor1 = 0; static int devmajor1 = 0;
static int devmajor2 = 0; static int devmajor2 = 0;
@ -1773,18 +1795,13 @@ static int do_init_module(void)
int err; int err;
ldprintf(".%d.",__LINE__); ldprintf(".%d.",__LINE__);
if((err = arnet_init()) < 0)
return err;
err = register_strdev(0,&arnet_info,0); err = register_strdev(0,&arnet_info,0);
if(err < 0) { if(err < 0)
arnet_exit();
return err; return err;
}
devmajor1 = err; devmajor1 = err;
err = register_strdev(0,&arnet_tinfo,arnet_ncards); err = register_strdev(0,&arnet_tinfo,ARNET_NCARDS);
if(err < 0) { if(err < 0) {
unregister_strdev(devmajor1,&arnet_info,0); unregister_strdev(devmajor1,&arnet_info,0);
arnet_exit();
return err; return err;
} }
devmajor2 = err; devmajor2 = err;
@ -1794,9 +1811,9 @@ ldprintf(".%d.",__LINE__);
static int do_exit_module(void) static int do_exit_module(void)
{ {
int err1 = unregister_strdev(devmajor1,&arnet_info,0); int err1 = unregister_strdev(devmajor1,&arnet_info,0);
int err2 = unregister_strdev(devmajor2,&arnet_tinfo,arnet_ncards); int err2 = unregister_strdev(devmajor2,&arnet_tinfo,ARNET_NCARDS);
ldprintf(".%d.",__LINE__); ldprintf(".%d.",__LINE__);
arnet_exit();
return err1 || err2; return err1 || err2;
} }
#endif #endif

View File

@ -26,7 +26,7 @@
#include "isdn_proto.h" #include "isdn_proto.h"
#include "smallq.h" #include "smallq.h"
#include "isdn_limits.h" #include "isdn_limits.h"
#include <sys/stream.h> #include "stream.h"
#include "streamlib.h" #include "streamlib.h"
#include <sys/errno.h> #include <sys/errno.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
@ -49,13 +49,6 @@
#define SetSPL(x) spl((x)) #define SetSPL(x) spl((x))
#endif #endif
/* This is ANSI... */
#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 void log_printmsg (void *log, const char *text, mblk_t * mp, const char*); extern void log_printmsg (void *log, const char *text, mblk_t * mp, const char*);
static void reset_card(struct _bintec *bp); static void reset_card(struct _bintec *bp);
static void toss_unknown (struct _bintec *bp); static void toss_unknown (struct _bintec *bp);
@ -253,7 +246,8 @@ bd_msgout( struct _bintec *bp )
} }
if(++count > 1000) { if(++count > 1000) {
printf("\n%sBINTEC: The board seems to be in an infinite loop.\n",KERN_ERR); printf("\n%sBINTEC: The board seems to be in an infinite loop.\n",KERN_ERR);
isdn2_new_state(&bp->card,2); if(bp->waitmsg == 0)
isdn2_new_state(&bp->card,2);
CTRL_RESET(bp); CTRL_RESET(bp);
return -EIO; return -EIO;
} }
@ -262,7 +256,8 @@ bd_msgout( struct _bintec *bp )
if (*bp->state & 0x80) { /* board failed */ if (*bp->state & 0x80) { /* board failed */
CTRL_RESET(bp); /* reset board */ CTRL_RESET(bp); /* reset board */
printf("BINTEC: msgout: board failed???\n"); printf("BINTEC: msgout: board failed???\n");
isdn2_new_state(&bp->card,2); if(bp->waitmsg == 0)
isdn2_new_state(&bp->card,2);
return -EIO; return -EIO;
} }
return 0; return 0;
@ -1042,8 +1037,7 @@ pushone(struct _bintec *bp, int thechan)
if(err == 0) { if(err == 0) {
freeb(mb); freeb(mb);
S_enqueue(&bp->chan[0].q_out,mr); S_enqueue(&bp->chan[0].q_out,mr);
if(bp->chan[0].q_out.nblocks == 1) sendone(bp,0);
sendone(bp,0);
} else if(err == -EAGAIN) { } else if(err == -EAGAIN) {
S_requeue(&chan->q_in, mb); S_requeue(&chan->q_in, mb);
freemsg(mr); freemsg(mr);
@ -1084,8 +1078,7 @@ postproc(struct _bintec *bp, mblk_t *mb, int ch)
isdn2_chstate(&bp->card,MDL_ERROR_IND,0); isdn2_chstate(&bp->card,MDL_ERROR_IND,0);
return -EIO; return -EIO;
} }
if(bp->chan[0].q_out.nblocks == 1) sendone(bp,0);
sendone(bp,0);
break; break;
case CAPI_DATAB3_IND: case CAPI_DATAB3_IND:
{ {
@ -1117,8 +1110,7 @@ postproc(struct _bintec *bp, mblk_t *mb, int ch)
card instead. */ card instead. */
isdn2_chstate(&bp->card,MDL_ERROR_IND,0); isdn2_chstate(&bp->card,MDL_ERROR_IND,0);
} }
if(chan->q_in.nblocks == 1) pushone(bp,ch);
pushone(bp,ch);
} }
break; break;
case CAPI_DATAB3_CONF: case CAPI_DATAB3_CONF:
@ -1216,8 +1208,7 @@ process_unknown (struct _bintec *bp)
cr->ncci = ci->ncci; cr->ncci = ci->ncci;
cr->blknum = ci->blknum; cr->blknum = ci->blknum;
S_enqueue(&bp->chan[0].q_out,mr); S_enqueue(&bp->chan[0].q_out,mr);
if(bp->chan[0].q_out.nblocks == 1) sendone(bp,0);
sendone(bp,0);
} }
freemsg(mb); freemsg(mb);
} }

View File

@ -50,7 +50,7 @@ CMDR 41
#include "smallq.h" #include "smallq.h"
#include "isdn_limits.h" #include "isdn_limits.h"
#include "isdn_proto.h" #include "isdn_proto.h"
#include <sys/stream.h> #include "stream.h"
#include "streamlib.h" #include "streamlib.h"
#include <sys/errno.h> #include <sys/errno.h>
#ifdef SCO #ifdef SCO
@ -199,11 +199,6 @@ typedef struct _hscx {
#define DUMBTIME 300 /* poll: times per second */ #define DUMBTIME 300 /* poll: times per second */
#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 */
void NAME(REALNAME,poll)(struct _dumb *dumb); void NAME(REALNAME,poll)(struct _dumb *dumb);
#else #else
void NAME(REALNAME,poll)(void *); void NAME(REALNAME,poll)(void *);

View File

@ -8,11 +8,6 @@
#error "You have to define CARDTYPE for this to work." #error "You have to define CARDTYPE for this to work."
#endif #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(CARDTYPE,init)(struct cardinfo *inf); extern int NAME(CARDTYPE,init)(struct cardinfo *inf);
extern void NAME(CARDTYPE,exit)(struct cardinfo *inf); extern void NAME(CARDTYPE,exit)(struct cardinfo *inf);
@ -38,6 +33,7 @@ static int do_init_module(void)
inf.memaddr = mem; inf.memaddr = mem;
inf.ID = name; inf.ID = name;
inf.debug = debug; inf.debug = debug;
inf.use_count = &mod_use_count_;
return NAME(CARDTYPE,init)(&inf); return NAME(CARDTYPE,init)(&inf);
} }

View File

@ -1,14 +1,5 @@
all::
depend::
rm -f syscompat.h linux
ln -s compat.h syscompat.h
ln -s . linux
KERNEL=1 KERNEL=1
TOPDIR=.. TOPDIR=..
include $(TOPDIR)/Make.rules include $(TOPDIR)/Make.rules
clean::
rm -f linux

View File

@ -348,14 +348,14 @@ char kernel_version[] = UTS_RELEASE;
int init_module(void) int init_module(void)
{ {
/* This should work... */ /* This should _really_ work... */
#if defined(__ELF__) printk("If exactly two \"rename...\" errors follow, ignore them.\n");
#define U if(!rename_module_symbol("_do_i_sleep_on","_interruptible_sleep_on") &&
#else !rename_module_symbol( "do_i_sleep_on", "interruptible_sleep_on"))
#define U "_" return -ENOENT;
#endif if(!rename_module_symbol("_do_sleep_on","_sleep_on") &&
rename_module_symbol(U "do_i_sleep_on",U "interruptible_sleep_on"); !rename_module_symbol( "do_sleep_on", "sleep_on"))
rename_module_symbol(U "do_sleep_on",U "sleep_on"); return -ENOENT;
return 0; return 0;
} }

View File

@ -13,7 +13,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -4,7 +4,7 @@
#ifdef KERNEL #ifdef KERNEL
#ifdef linux #ifdef linux
#include <linux/syscompat.h> #include "compat.h"
#endif #endif
#ifdef M_UNIX /* SCO et al */ #ifdef M_UNIX /* SCO et al */

View File

@ -1,10 +1,10 @@
#ifndef _INC_KERNEL #ifndef _INC_KERNEL
#define _INC_KERNEL #define _INC_KERNEL
#ifndef KERNEL
#if defined(linux) #if defined(linux)
#include <linux/config.h> #include <linux/config.h>
#endif #endif
#ifndef KERNEL
#include <malloc.h> #include <malloc.h>
#include <stdio.h> #include <stdio.h>
#include <sys/param.h> #include <sys/param.h>
@ -36,7 +36,13 @@ extern void panic(const char *x, ...);
#define kfree(a) free((a)) #define kfree(a) free((a))
#define kfree_s(a,b) free((a)) #define kfree_s(a,b) free((a))
#undef HZ
#define HZ 10 /* don't need more granularity */
#else /* KERNEL */ #else /* KERNEL */
#ifndef __KERNEL__
#define __KERNEL__
#endif
#include <linux/kernel.h> #include <linux/kernel.h>
char *loghdr(char level); char *loghdr(char level);
#undef KERN_EMERG #undef KERN_EMERG

View File

@ -8,8 +8,13 @@ struct cardinfo {
unsigned char irq, ipl; unsigned char irq, ipl;
unsigned long ID; unsigned long ID;
unsigned int debug; unsigned int debug;
long *use_count;
}; };
#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 */
#endif #endif

View File

@ -2,7 +2,7 @@
#define _PRIM_H #define _PRIM_H
#include <linux/config.h> #include <linux/config.h>
#include <linux/syscompat.h> #include "compat.h"
#include "config.h" #include "config.h"
#include "kernel.h" #include "kernel.h"
@ -12,7 +12,7 @@
#ifdef linux #ifdef linux
#include <linux/major.h> #include <linux/major.h>
#ifdef KERNEL #ifdef KERNEL
#include <linux/syscompat.h> #include "compat.h"
#else #else
#include <stdio.h> /* printf */ #include <stdio.h> /* printf */
#include <unistd.h> #include <unistd.h>

View File

@ -18,7 +18,7 @@
#include "f_signal.h" #include "f_signal.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#include "streams.h" #include "streams.h"
#include "config.h" #include "config.h"

View File

@ -7,10 +7,10 @@
#if !(defined(__sys_stream_h) || defined(_SYS_STREAM_H) || defined(_LINUX_STREAM_H)) #if !(defined(__sys_stream_h) || defined(_SYS_STREAM_H) || defined(_LINUX_STREAM_H))
#ifdef KERNEL #ifdef KERNEL
#include <sys/stream.h> #include "stream.h"
#else #else
#ifdef linux #ifdef linux
#include <sys/stream.h> #include "stream.h"
#else #else
#include <sys/aux-stream.h> #include <sys/aux-stream.h>
#endif /* KERNEL */ #endif /* KERNEL */

View File

@ -4,7 +4,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/syscompat.h> #include <linux/syscompat.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/stropts.h> #include "stropts.h"
#include <linux/kernel.h> #include <linux/kernel.h>
#define MAX_STRDEV MAX_CHRDEV /* don't change */ #define MAX_STRDEV MAX_CHRDEV /* don't change */

View File

@ -1,4 +1,4 @@
#include <sys/stream.h> #include "stream.h"
/* /*
* Compare two feature vectors, mask off certain bits. * Compare two feature vectors, mask off certain bits.
* Return..: * Return..:

View File

@ -13,7 +13,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -14,7 +14,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "ip_mon.h" #include "ip_mon.h"
#include <sys/stropts.h> #include "stropts.h"
#include <sys/file.h> #include <sys/file.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -18,7 +18,7 @@
#include "f_malloc.h" #include "f_malloc.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
/* #ifdef DONT_ADDERROR */ /* #ifdef DONT_ADDERROR */
#include "f_user.h" #include "f_user.h"
/* #endif */ /* #endif */
@ -2219,7 +2219,13 @@ isdn2_wput (queue_t *q, mblk_t *mp)
switch (DATA_TYPE(mp)) { switch (DATA_TYPE(mp)) {
case M_IOCTL: case M_IOCTL:
DATA_TYPE(mp) = M_IOCNAK; DATA_TYPE(mp) = M_IOCNAK;
((struct iocblk *)mp->b_rptr)->ioc_error = EINVAL; ((struct iocblk *)mp->b_rptr)->ioc_error =
#ifdef LINUX
ENOIOCTLCMD
#else
EINVAL
#endif
;
qreply (q, mp); qreply (q, mp);
break; break;
case CASE_DATA: case CASE_DATA:

View File

@ -1091,7 +1091,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
} }
} else { } else {
printf("CAPI error: DISCONNECTB3_CONF in wrong state %d\n",conn->state); printf("CAPI error: DISCONNECTB3_CONF in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
err = -EIO; err = -EIO;
break; break;
} }
@ -1209,7 +1209,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
setstate(conn,0); setstate(conn,0);
} }
} else { } else {
printf("CAPI error: DISCONNECT_CONF in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: DISCONNECT_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
isdn3_setup_conn (conn, EST_DISCONNECT); isdn3_setup_conn (conn, EST_DISCONNECT);
setstate(conn,0); setstate(conn,0);
report_terminate(conn,c2->info,0); report_terminate(conn,c2->info,0);
@ -1251,7 +1251,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
} }
} else { } else {
printf("CAPI error: CONNECT_CONF in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: CONNECT_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
isdn3_setup_conn (conn, EST_DISCONNECT); isdn3_setup_conn (conn, EST_DISCONNECT);
report_terminate(conn,c2->info,0); report_terminate(conn,c2->info,0);
if(send_disconnect(conn,0,N1_LocalProcErr) < 0) if(send_disconnect(conn,0,N1_LocalProcErr) < 0)
@ -1276,7 +1276,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_SELECTB2_CONF); conn->waitflags &=~ (1<<WF_SELECTB2_CONF);
err = after_active(conn,0); err = after_active(conn,0);
} else { } else {
printf("CAPI error: SELECTB2_CONF in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: SELECTB2_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
report_terminate(conn,c2->info,0); report_terminate(conn,c2->info,0);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
@ -1299,7 +1299,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_SELECTB3_CONF); conn->waitflags &=~ (1<<WF_SELECTB3_CONF);
err = after_active(conn,0); err = after_active(conn,0);
} else { } else {
printf("CAPI error: SELECTB3_CONF in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: SELECTB3_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
report_terminate(conn,c2->info,0); report_terminate(conn,c2->info,0);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
@ -1322,7 +1322,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_CONNECTACTIVE_IND); conn->waitflags &=~ (1<<WF_CONNECTACTIVE_IND);
err = after_active(conn,0); err = after_active(conn,0);
} else { } else {
printf("CAPI error: CONNECTACTIVE_IND in wrong state %d\n",conn->state); printf("CAPI error: CONNECTACTIVE_IND in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
} }
@ -1362,7 +1362,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->ncci0 = c2->ncci; conn->ncci0 = c2->ncci;
err = after_active(conn,1); err = after_active(conn,1);
} else { } else {
printf("CAPI error: CONNECTB3_IND in wrong state %d\n",conn->state); printf("CAPI error: CONNECTB3_IND in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
} }
@ -1404,7 +1404,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
err = after_active(conn,0); err = after_active(conn,0);
} else { } else {
err = -EIO; err = -EIO;
printf("CAPI error: LISTENB3_CONF in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: LISTENB3_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
} }
@ -1428,7 +1428,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
err = after_active(conn,1); err = after_active(conn,1);
} else { } else {
err = -EIO; err = -EIO;
printf("CAPI error: CONNECTB3_CONF in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: CONNECTB3_CONF in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
} }
@ -1451,7 +1451,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
conn->waitflags &=~ (1<<WF_CONNECTB3ACTIVE_IND); conn->waitflags &=~ (1<<WF_CONNECTB3ACTIVE_IND);
err = after_active(conn,0); err = after_active(conn,0);
} else { } else {
printf("CAPI error: CONNECTB3ACTIVE_IND in wrong state %d\n",conn->state); printf("CAPI error: CONNECTB3ACTIVE_IND in wrong state %d, wf 0x%lx\n",conn->state,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
} }
@ -2093,12 +2093,12 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
err = after_active(conn,0); err = after_active(conn,0);
} else { } else {
err = -EIO; err = -EIO;
printf("CAPI error: CONTROL_EAZ in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: CONTROL_EAZ in wrong state %d, info %04x, wf 0x%lx\n",conn->state,c2->info,conn->waitflags);
if(send_disconnect(conn,0,N1_OutOfOrder) < 0) if(send_disconnect(conn,0,N1_OutOfOrder) < 0)
setstate(conn,0); setstate(conn,0);
} }
} else if(talk->tstate < STATE_CONF_FIRST || talk->tstate > STATE_CONF_LAST) { } else if(talk->tstate < STATE_CONF_FIRST || talk->tstate > STATE_CONF_LAST) {
printf("CAPI error: CONTROL_EAZ in wrong state %d, info %04x\n",conn->state,c2->info); printf("CAPI error: CONTROL_EAZ in wrong tstate %ld\n",talk->tstate);
} }
if(c2->info != 0) { if(c2->info != 0) {
printf("CAPI error: EAZMAPPING failed %04x\n",c2->info); printf("CAPI error: EAZMAPPING failed %04x\n",c2->info);

View File

@ -1,5 +1,3 @@
/* Show the reasons for not changing connection states */
#define REPORT
/** /**
** ISDN Level 3 control module ** ISDN Level 3 control module
@ -13,7 +11,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif
@ -44,6 +42,11 @@
ushort_t hdrseq = 2; ushort_t hdrseq = 2;
/* Show the reasons for not changing connection states? */
#ifdef DO_DEBUGGING
#define REPORT
#endif
/* /*
* Global data. These should be allocated dynamically. They are not because * Global data. These should be allocated dynamically. They are not because
* most kernels don't have a way to find out how much kernel memory is left, * most kernels don't have a way to find out how much kernel memory is left,
@ -226,7 +229,9 @@ isdn3_killconn (isdn3_conn conn, char force)
isdn3_talk talk = conn->talk; isdn3_talk talk = conn->talk;
#ifdef REPORT
printf ("Conn %ld: Killing %d St %lo: min %d, at %d", conn->call_ref, force, conn->minorstate, conn->minor, conn->fminor); printf ("Conn %ld: Killing %d St %lo: min %d, at %d", conn->call_ref, force, conn->minorstate, conn->minor, conn->fminor);
#endif
if(force) if(force)
conn->id = 0; conn->id = 0;
@ -383,7 +388,7 @@ isdn3_killconn (isdn3_conn conn, char force)
int i; int i;
for(i=0;i<NMINOR;i++) { for(i=0;i<NMINOR;i++) {
if(minor2conn[i]==conn) { if(minor2conn[i]==conn) {
printf("ISDN_3 DeadConn %p, at pos %d, minor %d\n",minor2conn[i],i,conn->minor); if(0)printf("ISDN_3 DeadConn %p, at pos %d, minor %d\n",minor2conn[i],i,conn->minor);
minor2conn[i]=NULL; minor2conn[i]=NULL;
} }
} }
@ -877,7 +882,9 @@ Xisdn3_setup_conn (isdn3_conn conn, char established, const char *deb_file, unsi
mblk_t *mp; mblk_t *mp;
isdn23_hdr hdr; isdn23_hdr hdr;
#ifdef REPORT
printf ("Disconnect %d.",established); printf ("Disconnect %d.",established);
#endif
/* The connection isn't in the process of being established any more. */ /* The connection isn't in the process of being established any more. */
if (conn->minorstate & MS_CONNDELAY_TIMER) { if (conn->minorstate & MS_CONNDELAY_TIMER) {
conn->minorstate &= ~MS_CONNDELAY_TIMER; conn->minorstate &= ~MS_CONNDELAY_TIMER;
@ -2299,8 +2306,7 @@ printf("ErX k\n");
if(call_ref != 0) if(call_ref != 0)
conn->call_ref = call_ref; conn->call_ref = call_ref;
} }
if(theID == CMD_OFF) printf(" D1 "); if(0)printf ("* Conn%p: min %d at %d; minor %d min %d; callref %ld connref %d \n",
printf ("* Conn%p: min %d at %d; minor %d min %d; callref %ld connref %d \n",
conn, conn->minor, conn->fminor, conn, conn->minor, conn->fminor,
minor, fminor, conn->call_ref, conn->conn_id); minor, fminor, conn->call_ref, conn->conn_id);
if (conn->minor == 0 && !nodisc && (theID != CMD_OFF)) { if (conn->minor == 0 && !nodisc && (theID != CMD_OFF)) {
@ -2308,11 +2314,9 @@ if(theID == CMD_OFF) printf(" D1 ");
if (conn->minor != 0) if (conn->minor != 0)
minor2conn[conn->minor] = conn; minor2conn[conn->minor] = conn;
} }
else printf(" D4 ");
if (do_talk) if (do_talk)
conn->minorstate |= MS_FORCING; conn->minorstate |= MS_FORCING;
if (conn->minor != 0) { if (conn->minor != 0) {
if(theID == CMD_OFF) printf(" D5 ");
if (conn->fminor == 0) if (conn->fminor == 0)
conn->fminor = fminor; conn->fminor = fminor;
minor2conn[conn->minor] = conn; minor2conn[conn->minor] = conn;
@ -2322,7 +2326,6 @@ if(theID == CMD_OFF) printf(" D5 ");
if (conn->stack[0] == 0) if (conn->stack[0] == 0)
memcpy(conn->stack,stack,sizeof(conn->stack)); memcpy(conn->stack,stack,sizeof(conn->stack));
if(do_int != 0) { if(do_int != 0) {
if(theID == CMD_OFF) printf(" D6 ");
if(conn->minor == 0) { if(conn->minor == 0) {
printf("\n*** CM Zero!\n"); printf("\n*** CM Zero!\n");
} else if(do_int > 0) } else if(do_int > 0)
@ -2330,11 +2333,9 @@ if(theID == CMD_OFF) printf(" D6 ");
else else
minorflags[conn->minor] &=~ MINOR_INT; minorflags[conn->minor] &=~ MINOR_INT;
} }
if(theID == CMD_OFF) printf(" D7 ");
conn->lockit++; conn->lockit++;
isdn3_setup_conn (conn, EST_NO_CHANGE); isdn3_setup_conn (conn, EST_NO_CHANGE);
conn->lockit--; conn->lockit--;
if(theID == CMD_OFF) printf(" D8 ");
if(conn->state == 0) { if(conn->state == 0) {
/* XXX */ /* XXX */
} }
@ -2345,7 +2346,6 @@ if(theID == CMD_OFF) printf(" D8 ");
printf ("ErrOut t of %d is %d\n", talk->hndl->SAPI, err); printf ("ErrOut t of %d is %d\n", talk->hndl->SAPI, err);
goto err_out; goto err_out;
} }
if(theID == CMD_OFF) printf(" D9 ");
break; break;
} }
/* ok_out: */ /* ok_out: */
@ -2448,7 +2448,7 @@ isdn3_findminor (ushort_t minor)
if (minor2conn[minor] == NULL) if (minor2conn[minor] == NULL)
return NULL; return NULL;
conn = minor2conn[minor]; conn = minor2conn[minor];
printf (".FindMinor%p %d gets C %d:%d\n", conn, minor, conn->minor, conn->fminor); if(0)printf (".FindMinor%p %d gets C %d:%d\n", conn, minor, conn->minor, conn->fminor);
return conn; return conn;
} }
@ -2482,15 +2482,19 @@ isdn3_findtalk (isdn3_card card, isdn3_hndl hndl, mblk_t *info, int create)
int i; int i;
int err; int err;
char systr[200] = ""; #if 0
if(card->info != NULL) char systr[200] = "";
sprintf(systr+strlen(systr),"'%-*s'",card->info->b_wptr-card->info->b_rptr,card->info->b_rptr); if(card->info != NULL)
else strcat(systr,"NULL"); sprintf(systr+strlen(systr),"'%-*s'",card->info->b_wptr-card->info->b_rptr,card->info->b_rptr);
strcat(systr," and info "); else
if(info != NULL) strcat(systr,"NULL");
sprintf(systr+strlen(systr),"'%-*s'",info->b_wptr-info->b_rptr,info->b_rptr); strcat(systr," and info ");
else strcat(systr,"NULL"); if(info != NULL)
syslog(LOG_DEBUG,"====== Create 0x%02x with card %s",hndl->SAPI,systr); sprintf(systr+strlen(systr),"'%-*s'",info->b_wptr-info->b_rptr,info->b_rptr);
else
strcat(systr,"NULL");
syslog(LOG_DEBUG,"====== Create 0x%02x with card %s",hndl->SAPI,systr);
#endif
if(card->info != NULL) { if(card->info != NULL) {
mblk_t *mi = card->info; mblk_t *mi = card->info;
streamchar *sta = mi->b_rptr; streamchar *sta = mi->b_rptr;
@ -2661,7 +2665,7 @@ isdn3_findconn (isdn3_talk talk, long protocol, long call_ref)
for (conn = talk->conn; conn != NULL; conn = conn->next) for (conn = talk->conn; conn != NULL; conn = conn->next)
if (conn->subprotocol == protocol && conn->call_ref == call_ref if (conn->subprotocol == protocol && conn->call_ref == call_ref
&& (conn->state != 0)) { && (conn->state != 0)) {
printf(".FindConn%p, ref %ld:",conn,call_ref); if(0)printf(".FindConn%p, ref %ld:",conn,call_ref);
return conn; return conn;
} }
return NULL; return NULL;
@ -2735,7 +2739,7 @@ isdn3_open (queue_t * q, dev_t dev, int flag, int sflag ERR_DECL)
WR (q)->q_ptr = (caddr_t) & isdn3_q; WR (q)->q_ptr = (caddr_t) & isdn3_q;
q->q_ptr = (caddr_t) isdn3_q; q->q_ptr = (caddr_t) isdn3_q;
printf ("ISDN Master driver %d opened.\n", dev); if(0)printf ("ISDN Master driver %d opened.\n", dev);
return 0; return 0;
} }
@ -2746,7 +2750,7 @@ isdn3_close (queue_t *q, int dummy)
{ {
flushq (q, FLUSHALL); flushq (q, FLUSHALL);
flushq (WR (q), FLUSHALL); flushq (WR (q), FLUSHALL);
printf ("ISDN Master driver closed.\n"); if(0)printf ("ISDN Master driver closed.\n");
isdn3_q = NULL; isdn3_q = NULL;
return; return;
} }
@ -2942,8 +2946,7 @@ isdn3_rsrv (queue_t * q)
isdn3_talk talk; isdn3_talk talk;
if (conn == NULL) { if (conn == NULL) {
if (0) if (0) printf ("XData: Conn for minor %d nf\n", hdr.hdr_detach.minor);
printf ("XData: Conn for minor %d nf\n", hdr.hdr_detach.minor);
break; break;
} }
if ((talk = conn->talk) == NULL) { if ((talk = conn->talk) == NULL) {
@ -3041,7 +3044,7 @@ isdn3_rsrv (queue_t * q)
break; break;
} }
if (minorflags[hdr.hdr_open.minor] & MINOR_OPEN) { if (minorflags[hdr.hdr_open.minor] & MINOR_OPEN) {
printf ("Open: Minor %d open\n", hdr.hdr_open.minor); if(0)printf ("Open: Minor %d open\n", hdr.hdr_open.minor);
break; break;
} }
@ -3070,7 +3073,7 @@ isdn3_rsrv (queue_t * q)
isdn3_conn conn = isdn3_findminor (hdr.hdr_close.minor); isdn3_conn conn = isdn3_findminor (hdr.hdr_close.minor);
mblk_t *mx; mblk_t *mx;
printf("\n*** Closed %d\n",hdr.hdr_close.minor); if(0)printf("\n*** Closed %d\n",hdr.hdr_close.minor);
minorflags[hdr.hdr_close.minor] = 0; minorflags[hdr.hdr_close.minor] = 0;
if (conn != 0 && conn->minor == hdr.hdr_close.minor) { if (conn != 0 && conn->minor == hdr.hdr_close.minor) {
SUBDEV cm = conn->minor; SUBDEV cm = conn->minor;
@ -3239,7 +3242,7 @@ printf(" *SM %d: %d %d.%d\n",__LINE__,conn->conn_id,conn->minor,conn->fminor);
if (hdr.hdr_notify.SAPI == SAPI_INVALID) { if (hdr.hdr_notify.SAPI == SAPI_INVALID) {
for (talk = card->talk; talk != NULL; talk = talk->next) { for (talk = card->talk; talk != NULL; talk = talk->next) {
printf("chstate for SAPI %x\n",talk->hndl->SAPI); if(0)printf("chstate for SAPI %x\n",talk->hndl->SAPI);
(*talk->hndl->chstate) (talk, hdr.hdr_notify.ind, hdr.hdr_notify.add); (*talk->hndl->chstate) (talk, hdr.hdr_notify.ind, hdr.hdr_notify.add);
} }
switch (hdr.hdr_notify.ind) { switch (hdr.hdr_notify.ind) {

View File

@ -1135,11 +1135,13 @@ recv (isdn3_conn conn, uchar_t msgtype, char isUI, uchar_t * data, ushort_t len)
phone_sendback (conn, MT_N1_CONN_ACK, NULL); phone_sendback (conn, MT_N1_CONN_ACK, NULL);
pr_setstate (conn, 10); pr_setstate (conn, 10);
break; break;
case MT_N1_INFO:{ case MT_N1_INFO:
{
QD_INIT (data, len) break; QD_INIT (data, len) break;
report_n1_info (conn, data, len); report_n1_info (conn, data, len);
QD { QD {
QD_CASE (0, PT_N0_netSpecFac):{ QD_CASE (0, PT_N0_netSpecFac):
{
char nlen; char nlen;
uchar_t facility; uchar_t facility;
@ -1153,9 +1155,11 @@ recv (isdn3_conn conn, uchar_t msgtype, char isUI, uchar_t * data, ushort_t len)
if (facility != N1_FAC_Forward1 && facility != N1_FAC_Forward2) { if (facility != N1_FAC_Forward1 && facility != N1_FAC_Forward2) {
pr_setstate (conn, 3); pr_setstate (conn, 3);
} }
} break; }
break;
} }
} break; }
break;
case MT_N1_REL: case MT_N1_REL:
/* send REL up */ /* send REL up */
phone_sendback (conn, MT_N1_REL, NULL); phone_sendback (conn, MT_N1_REL, NULL);
@ -1801,7 +1805,7 @@ recv (isdn3_conn conn, uchar_t msgtype, char isUI, uchar_t * data, ushort_t len)
static int static int
chstate (isdn3_conn conn, uchar_t ind, short add) chstate (isdn3_conn conn, uchar_t ind, short add)
{ {
printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add); if(0)printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add);
if(conn->p_data == NULL) { if(conn->p_data == NULL) {
if((conn->p_data = malloc(sizeof(struct t_info))) == NULL) { if((conn->p_data = malloc(sizeof(struct t_info))) == NULL) {
return -ENOMEM; return -ENOMEM;
@ -1976,16 +1980,18 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
case ARG_SPV: case ARG_SPV:
svc = 1; svc = 1;
break; break;
case ARG_LNUMBER:{ case ARG_LNUMBER:
{
char nbuf[MAXNR];
m_getskip (data); m_getskip (data);
if (data->b_rptr > data->b_wptr+2) { if ((err = m_getstr (data, nbuf, MAXNR)) != 0) {
data->b_rptr = oldpos;
printf("GetX EAZ: "); printf("GetX EAZ: ");
conn->lockit--; conn->lockit--;
return -EINVAL; return err;
} }
((struct t_info *)conn->p_data)->eaz = data->b_rptr[1]; ((struct t_info *)conn->p_data)->eaz = nbuf[strlen(nbuf)-1];
} break; }
break;
case ARG_NUMBER: case ARG_NUMBER:
m_getskip (data); m_getskip (data);
if ((err = m_getstr (data, (char *) ((struct t_info *)conn->p_data)->nr, MAXNR)) != 0) { if ((err = m_getstr (data, (char *) ((struct t_info *)conn->p_data)->nr, MAXNR)) != 0) {
@ -2164,16 +2170,18 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
return err; return err;
} }
break; break;
case ARG_LNUMBER:{ case ARG_LNUMBER:
{
char nbuf[MAXNR];
m_getskip (data); m_getskip (data);
if (data->b_rptr > data->b_wptr-2) { if ((err = m_getstr (data, nbuf, MAXNR)) != 0) {
data->b_rptr = oldpos; printf("GetX EAZans: ");
printf("GetEAZAns ");
conn->lockit--; conn->lockit--;
return -EINVAL; return err;
} }
((struct t_info *)conn->p_data)->eaz = data->b_rptr[1]; ((struct t_info *)conn->p_data)->eaz = nbuf[strlen(nbuf)-1];
} break; }
break;
} }
} }
{ {

View File

@ -983,8 +983,10 @@ Xreport_ET_terminate (isdn3_conn conn, uchar_t * data, int len, int deb_line)
int err = 0; int err = 0;
mblk_t *mb = allocb (256, BPRI_MED); mblk_t *mb = allocb (256, BPRI_MED);
extern int log_34;
printf("\nET Terminate at %d.\n",deb_line); if(log_34 & 2)
printf("\nET Terminate at %d.\n",deb_line);
if (mb == NULL) { if (mb == NULL) {
pr_setstate (conn, 0); pr_setstate (conn, 0);
return; return;
@ -2120,7 +2122,7 @@ printf (" ET: Recv %x in state %d\n", msgtype, conn->state);
static int static int
chstate (isdn3_conn conn, uchar_t ind, short add) chstate (isdn3_conn conn, uchar_t ind, short add)
{ {
printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add); if(0)printf ("PHONE state for card %d says %d:%o\n", conn->card->nr, ind, add);
switch (ind) { switch (ind) {
case DL_ESTABLISH_IND: case DL_ESTABLISH_IND:
case DL_ESTABLISH_CONF: case DL_ESTABLISH_CONF:

View File

@ -438,9 +438,7 @@ read_args (void *nix)
} }
} }
if(nexttime == 0) if((nexttime == 0) || (nexttime > 32767/HZ/60))
nexttime = 60;
else if(nexttime > 32767/HZ/60)
nexttime = 32767/HZ/60; nexttime = 32767/HZ/60;
#ifdef NEW_TIMEOUT #ifdef NEW_TIMEOUT
classtimer = classtimer =

View File

@ -73,7 +73,7 @@ Xsetconnref(const char *deb_file, unsigned int deb_line, conninfo conn, int conn
/* Print the text foo onto all ATL/ channels. */ /* Print the text foo onto all ATL/ channels. */
void void
connreport(char *foo, char *card) connreport(char *foo, char *card, int minor)
{ {
conninfo conn; conninfo conn;
mblk_t xx; mblk_t xx;
@ -92,6 +92,8 @@ connreport(char *foo, char *card)
continue; continue;
if(!wildmatch(conn->cardname,card)) if(!wildmatch(conn->cardname,card))
continue; continue;
if(minor != 0 && conn->minor != minor)
continue;
if(conn->lastMsg != NULL && !strcmp(conn->lastMsg,foo)) if(conn->lastMsg != NULL && !strcmp(conn->lastMsg,foo))
continue; continue;
if(conn->lastMsg != NULL) if(conn->lastMsg != NULL)
@ -116,14 +118,16 @@ connreport(char *foo, char *card)
/* Print the state of this connection with connreport(). */ /* Print the state of this connection with connreport(). */
void void
ReportConn(conninfo conn) ReportOneConn(conninfo conn, int minor)
{ {
char sp[200], *spf = sp; char is1[10]="",sp[200], *spf = sp;
spf += sprintf(spf,"%s%d:%d %s %s %s %d %s/%s %ld %ld %s", if(conn->state == c_off)
sprintf(is1,".%d",conn->retiming);
spf += sprintf(spf,"%s%d:%d %s %s %s %d %s%s/%s %ld %ld %s",
conn->ignore?"!":"", conn->minor, conn->ignore?"!":"", conn->minor,
conn->seqnum, conn->cg ? conn->cg->site : "-", conn->seqnum, conn->cg ? conn->cg->site : "-",
conn->cg ? conn->cg->protocol : "-", conn->cg ? conn->cg->cclass : "-", conn->cg ? conn->cg->protocol : "-", conn->cg ? conn->cg->cclass : "-",
conn->pid, state2str(conn->state), conn->pid, state2str(conn->state), is1,
conn->cg ? conn->cg->card : (conn->cardname ? conn->cardname : "-"), conn->cg ? conn->cg->card : (conn->cardname ? conn->cardname : "-"),
conn->charge, conn->ccharge, FlagInfo(conn->flags)); conn->charge, conn->ccharge, FlagInfo(conn->flags));
if(conn->cg != NULL && (conn->cg->flags ^ conn->flags) != 0) { if(conn->cg != NULL && (conn->cg->flags ^ conn->flags) != 0) {
@ -143,7 +147,20 @@ ReportConn(conninfo conn)
else if(conn->cg != NULL && conn->cg->oldlnr != NULL) else if(conn->cg != NULL && conn->cg->oldlnr != NULL)
spf += sprintf(spf, ";%s",conn->cg->oldlnr); spf += sprintf(spf, ";%s",conn->cg->oldlnr);
spf += sprintf(spf," %s", CauseInfo(conn->cause, conn->causeInfo)); spf += sprintf(spf," %s", CauseInfo(conn->cause, conn->causeInfo));
connreport(sp,(conn->cg ? conn->cg->card : "*")); connreport(sp,(conn->cg ? conn->cg->card : "*"),minor);
}
int retimeout(conninfo conn)
{
/* Exponential backoff. Sorry but this is necessary. */
if(conn->charge != 0)
return 5*60*(1<<++conn->retiming);
else if (conn->cause == ID_priv_Busy)
return 5*(1<<(++conn->retiming/6));
else if(conn->flags & F_FASTREDIAL)
return 2+(1<<(++conn->retiming/4));
else
return 5+(1<<(++conn->retiming/2));
} }
/* Sets the state of a connection; does all the housekeeping associated /* Sets the state of a connection; does all the housekeeping associated
@ -157,11 +174,11 @@ Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState
printf(" -> %s\n",state2str(state)); printf(" -> %s\n",state2str(state));
else else
printf("\n"); printf("\n");
if(conn->timer_reconn && (state == c_offdown || (state >= c_going_up if(conn->timer_reconn && (state == c_off || state == c_offdown || (state >= c_going_up
&& conn->state < c_going_up))) { && conn->state < c_going_up))) {
conn->timer_reconn = 0; conn->timer_reconn = 0;
untimeout(time_reconn,conn); untimeout(time_reconn,conn);
} else if(!conn->timer_reconn && state < c_going_up && conn->state >= c_going_up) { } else if(!conn->timer_reconn && state != c_off && state < c_going_up && conn->state >= c_going_up) {
if(conn->want_fast_reconn) { if(conn->want_fast_reconn) {
conn->want_fast_reconn = 0; conn->want_fast_reconn = 0;
} else { } else {
@ -253,7 +270,7 @@ Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState
} }
if((state == c_off) && !conn->retime && (conn->flags & F_PERMANENT)) { if((state == c_off) && !conn->retime && (conn->flags & F_PERMANENT)) {
conn->retime = 1; conn->retime = 1;
timeout(retime,conn,((conn->charge != 0) ? 5*60*++conn->retiming : (conn->cause == ID_priv_Busy) ? 5 : (conn->flags & F_FASTREDIAL) ? 2 : 5)*HZ); timeout(retime,conn,retimeout(conn)*HZ);
} else if((state != c_off) && conn->retime) { } else if((state != c_off) && conn->retime) {
conn->retime = 0; conn->retime = 0;
untimeout(retime,conn); untimeout(retime,conn);
@ -269,10 +286,10 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
{ {
chkone(conn); chkone(conn);
if(conn->locked) { if(conn->locked) {
if(1)printf ("DropConn %s:%d: LOCK %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref); if(log_34 & 2)printf ("DropConn %s:%d: LOCK %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref);
return; return;
} }
if(1)printf ("DropConn %s:%d: %d/%d/%ld\n", deb_file,deb_line, conn->minor, conn->fminor, conn->connref); 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) { if(!conn->ignore) {
conn->ignore=1; conn->ignore=1;
setconnstate(conn,c_forceoff); setconnstate(conn,c_forceoff);
@ -314,7 +331,7 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
{ /* Say that we forgot the thing. */ { /* Say that we forgot the thing. */
char xs[10]; char xs[10];
sprintf(xs,"-%d",conn->seqnum); sprintf(xs,"-%d",conn->seqnum);
connreport(xs,conn->cg ? conn->cg->card : "*"); connreport(xs,conn->cg ? conn->cg->card : "*",0);
} }
dropgrab(conn->cg); dropgrab(conn->cg);
if(conn->lastMsg != NULL) if(conn->lastMsg != NULL)
@ -404,10 +421,8 @@ try_reconn(struct conninfo *conn)
cg->lnr = NULL; cg->lnrsuf = NULL; cg->lnr = NULL; cg->lnrsuf = NULL;
cg->card = conn->cardname ? conn->cardname : "*"; cg->card = conn->cardname ? conn->cardname : "*";
cg->cclass = conn->classname ? conn->classname : "*"; cg->cclass = conn->classname ? conn->classname : "*";
cg->flags &=~(F_MOVEFLAGS|F_INCOMING|F_OUTCOMPLETE|F_LNRCOMPLETE); cg->flags &=~(F_MASKFLAGS|F_INCOMING|F_OUTCOMPLETE|F_LNRCOMPLETE);
cg->flags |= F_OUTGOING; cg->flags |= F_OUTGOING;
if((cg->flags & (F_PERMANENT|F_LEASED)) == F_PERMANENT)
cg->flags |= F_DIALUP;
if(cg->par_out != NULL) if(cg->par_out != NULL)
freemsg(cg->par_out); freemsg(cg->par_out);
if((cg->par_out = allocb(256,BPRI_LO)) == NULL) { if((cg->par_out = allocb(256,BPRI_LO)) == NULL) {

View File

@ -246,7 +246,7 @@ find_conn(void)
if(conn == NULL) if(conn == NULL)
conn = xconn; conn = xconn;
if(conn != NULL) { if(conn != NULL) {
printf("Found Conn %d/%d, cref %ld\n",conn->minor,conn->fminor,conn->connref); if(0)printf("Found Conn %d/%d, cref %ld\n",conn->minor,conn->fminor,conn->connref);
} }
if (conn != NULL && ind != IND_OPEN) { if (conn != NULL && ind != IND_OPEN) {
if (conn->minor == 0 && minor != 0) { if (conn->minor == 0 && minor != 0) {
@ -312,9 +312,11 @@ init_vars (void)
*(ulong_t *) crd = 0; *(ulong_t *) crd = 0;
crd[4] = '\0'; crd[4] = '\0';
printf ("HL R "); if(log_34 & 1) {
dumpascii (data, len); printf ("HL R ");
printf ("\n"); dumpascii (data, len);
printf ("\n");
}
data[len] = '\0'; data[len] = '\0';
xx.b_rptr = data; xx.b_rptr = data;
xx.b_wptr = data + len; xx.b_wptr = data + len;
@ -406,7 +408,7 @@ do_card(void)
io[0].iov_len = xlen; io[0].iov_len = xlen;
len = 1; len = 1;
if(dl->args != NULL) { if(dl->args != NULL) {
printf ("+ "); if(log_34 & 1)printf ("+ ");
io[len].iov_base = ":: "; io[len].iov_base = ":: ";
io[len].iov_len = 3; io[len].iov_len = 3;
len++; len++;
@ -514,7 +516,7 @@ do_cardproto(void)
xx.b_rptr = xx.b_wptr = ans; xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis10 "); if(log_34 & 2)printf("Dis10 ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
if(minor > 0) { if(minor > 0) {
m_putsx (&xx, ARG_MINOR); m_putsx (&xx, ARG_MINOR);
@ -549,7 +551,7 @@ do_cardproto(void)
xx.b_rptr = xx.b_wptr = ans; xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis11 "); if(log_34 & 2)printf("Dis11 ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
if(minor > 0) { if(minor > 0) {
m_putsx (&xx, ARG_MINOR); m_putsx (&xx, ARG_MINOR);
@ -667,7 +669,7 @@ do_incoming(void)
incomplete = 0; incomplete = 0;
goto inc_err; goto inc_err;
} }
cg->flags = F_INCOMING|F_DIALUP|F_PERMANENT|F_NRCOMPLETE|F_LNRCOMPLETE; cg->flags = F_INCOMING|F_MULTIDIALUP|F_DIALUP|F_PERMANENT|F_NRCOMPLETE|F_LNRCOMPLETE;
cinf = allocb(len,BPRI_LO); cinf = allocb(len,BPRI_LO);
if(cinf == NULL) { if(cinf == NULL) {
resp = "OutOfMemFoo"; resp = "OutOfMemFoo";
@ -696,12 +698,13 @@ do_incoming(void)
} }
{ {
char *sit = NULL,*pro = NULL,*car = NULL,*cla = NULL; /* GCC */ char *sit = NULL,*pro = NULL,*car = NULL,*cla = NULL; /* GCC */
long flg;
ulong_t sub = 0; ulong_t sub = 0;
if(0)printf("Hunt for %s/%s/%s/%s/%o\n",cg->site,cg->protocol,cg->card,cg->cclass,cg->flags); if(0)printf("Hunt for %s/%s/%s/%s/%o\n",cg->site,cg->protocol,cg->card,cg->cclass,cg->flags);
/* Figure out which program to run. */ /* Figure out which program to run. */
for (cfr = cf_R; cfr != NULL; cfr = cfr->next) { for (cfr = cf_R; cfr != NULL; cfr = cfr->next) {
if(cfr->got_err) continue; if(cfr->got_err) continue;
if (!matchflag(cg->flags,cfr->type)) continue; if ((flg = matchflag (cg->flags,cfr->type)) == 0) continue;
if ((sit = wildmatch (cg->site, cfr->site)) == NULL) continue; if ((sit = wildmatch (cg->site, cfr->site)) == NULL) continue;
if ((pro = wildmatch (cg->protocol, cfr->protocol)) == NULL) continue; if ((pro = wildmatch (cg->protocol, cfr->protocol)) == NULL) continue;
if ((car = wildmatch (cg->card, cfr->card)) == NULL) continue; if ((car = wildmatch (cg->card, cfr->card)) == NULL) continue;
@ -735,7 +738,7 @@ do_incoming(void)
mz = allocb(40,BPRI_HI); if(mz == NULL) goto cont; mz = allocb(40,BPRI_HI); if(mz == NULL) goto cont;
if(*resp != '+') { /* Throw away the incoming call */ if(*resp != '+') { /* Throw away the incoming call */
if(1)printf("Dis1 "); if(log_34 & 2)printf("Dis1 ");
m_putid (mz, CMD_OFF); m_putid (mz, CMD_OFF);
m_putsx (mz, ARG_NODISC); m_putsx (mz, ARG_NODISC);
m_putsx (mz, ARG_FORCE); m_putsx (mz, ARG_FORCE);
@ -784,7 +787,7 @@ do_incoming(void)
} }
resp = NULL; resp = NULL;
} else { /* Throw away the outgoing call */ } else { /* Throw away the outgoing call */
if(1)printf("Dis2 "); if(log_34 & 2)printf("Dis2 ");
m_putid (mz, CMD_OFF); m_putid (mz, CMD_OFF);
m_putsx (mz, ARG_NODISC); m_putsx (mz, ARG_NODISC);
m_putsx (mz, ID_N0_cause); m_putsx (mz, ID_N0_cause);
@ -869,7 +872,7 @@ do_incoming(void)
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis3 "); if(log_34 & 2)printf("Dis3 ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
if(connref != 0) { if(connref != 0) {
m_putsx (&xx, ARG_CONNREF); m_putsx (&xx, ARG_CONNREF);
@ -1118,7 +1121,7 @@ do_disc(void)
xx.b_rptr = xx.b_wptr = ans; xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis4d "); if(log_34 & 2)printf("Dis4d ");
m_putid (&xx, CMD_CLOSE); m_putid (&xx, CMD_CLOSE);
m_putsx (&xx, ARG_MINOR); m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor); m_puti (&xx, minor);
@ -1189,7 +1192,7 @@ do_disc(void)
xx.b_rptr = xx.b_wptr = ans; xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis4 "); if(log_34 & 2)printf("Dis4 ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR); m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor); m_puti (&xx, minor);
@ -1222,7 +1225,7 @@ do_close(void)
if (conn->pid == 0) if (conn->pid == 0)
dropconn (conn); dropconn (conn);
else { else {
printf("PID still %d\n",conn->pid); if(log_34 & 2)printf("PID still %d\n",conn->pid);
kill(conn->pid,SIGHUP); kill(conn->pid,SIGHUP);
} }
} }
@ -1239,7 +1242,7 @@ do_close(void)
if (conn->pid == 0) if (conn->pid == 0)
dropconn (conn); dropconn (conn);
else { else {
printf("PID still %d\n",conn->pid); if(log_34 & 2)printf("PID still %d\n",conn->pid);
kill(conn->pid,SIGHUP); kill(conn->pid,SIGHUP);
} }
} }
@ -1378,7 +1381,7 @@ do_hasconnected(void)
{ {
if (conn != NULL) { if (conn != NULL) {
if (conn->cg != NULL) if (conn->cg != NULL)
conn->flags |= conn->cg->flags & F_MOVEFLAGS; conn->flags = (conn->flags &~ F_MASKFLAGS) | (conn->cg->flags & F_MOVEFLAGS);
setconnstate(conn,c_up); setconnstate(conn,c_up);
} }
resp = "CONNECT"; resp = "CONNECT";
@ -1438,7 +1441,7 @@ do_disconnect(void)
xx.b_rptr = xx.b_wptr = ans; xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis5 "); if(log_34 & 2)printf("Dis5 ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR); m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor); m_puti (&xx, minor);
@ -1465,7 +1468,7 @@ do_hasdisconnect(void)
m_putid (&xx, PROTO_MODULE); m_putid (&xx, PROTO_MODULE);
m_putsx (&xx, PROTO_MODULE); m_putsx (&xx, PROTO_MODULE);
m_putsz (&xx, (uchar_t *) "proto"); m_putsz (&xx, (uchar_t *) "proto");
printf("On4 %p %d\n",conn,dialin); if(log_34 & 2)printf("On4 %p %d\n",conn,dialin);
m_putsx (&xx, ((conn != NULL) || (dialin > 0)) ? PROTO_ONLINE : PROTO_OFFLINE); m_putsx (&xx, ((conn != NULL) || (dialin > 0)) ? PROTO_ONLINE : PROTO_OFFLINE);
xlen = xx.b_wptr - xx.b_rptr; xlen = xx.b_wptr - xx.b_rptr;
DUMPW (xx.b_rptr, xlen); DUMPW (xx.b_rptr, xlen);
@ -1476,7 +1479,7 @@ do_hasdisconnect(void)
xx.b_rptr = xx.b_wptr = ans; xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis6 "); if(log_34 & 2)printf("Dis6 ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR); m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor); m_puti (&xx, minor);
@ -1555,7 +1558,7 @@ do_wantconnect(void)
xx.b_rptr = xx.b_wptr = ans; xx.b_rptr = xx.b_wptr = ans;
db.db_base = ans; db.db_base = ans;
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
if(1)printf("Dis7 "); if(log_34 & 2)printf("Dis7 ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
m_putsx (&xx, ARG_MINOR); m_putsx (&xx, ARG_MINOR);
m_puti (&xx, minor); m_puti (&xx, minor);
@ -1715,7 +1718,7 @@ do_atcmd(void)
setconnstate(conn, c_forceoff); setconnstate(conn, c_forceoff);
else else
setconnstate(conn, c_down); setconnstate(conn, c_down);
if(1)printf("Dis8 "); if(log_34 & 2)printf("Dis8 ");
if(mb != NULL) { if(mb != NULL) {
{ {
@ -1755,12 +1758,8 @@ do_atcmd(void)
case 'L': /* List connections and state changes. */ case 'L': /* List connections and state changes. */
{ {
struct conninfo *fconn; struct conninfo *fconn;
char *sp; char buf[30];
msgbuf = malloc(10240);
if(msgbuf == NULL) {
resp = "NO MEMORY.6";
return 1;
}
conn = malloc(sizeof(*conn)); conn = malloc(sizeof(*conn));
if(conn == NULL) { if(conn == NULL) {
free(msgbuf); free(msgbuf);
@ -1791,29 +1790,22 @@ do_atcmd(void)
} else } else
conn->cardname = "*"; conn->cardname = "*";
} }
sp = resp = msgbuf; conn->seqnum = ++connseq;
sp += sprintf(sp,"#:ref id site protocol class pid state/card cost total flags,rem.nr;loc.nr cause\r\n"); conn->ignore = 3;
conn->minor = minor;
conn->next = isdn4_conn; isdn4_conn = conn;
connreport("#:ref id site protocol class pid state/card cost total flags,remNr;locNr cause\r\n","*",minor);
for(fconn = isdn4_conn; fconn != NULL; fconn = fconn->next) { for(fconn = isdn4_conn; fconn != NULL; fconn = fconn->next) {
if(fconn->ignore >= 3) if(fconn->ignore >= 3)
continue; continue;
if((fconn->cg != NULL) && (fconn->cg->card != NULL)) if((fconn->cg != NULL) && (fconn->cg->card != NULL))
if(!wildmatch(fconn->cg->card,conn->cardname)) if(!wildmatch(fconn->cg->card,conn->cardname))
continue; continue;
sp += sprintf(sp,"%s%d:%d %s %s %s %d %s/%s %ld %ld %s %s\r\n", ReportOneConn(fconn,minor);
fconn->ignore?"!":"", fconn->minor, fconn->seqnum,
(fconn->cg && fconn->cg->site) ? fconn->cg->site : "-",
(fconn->cg && fconn->cg->protocol) ? fconn->cg->protocol : "-",
(fconn->cg && fconn->cg->cclass) ? fconn->cg->cclass : "-",
fconn->pid, state2str(fconn->state),
(fconn->cg && fconn->cg->card) ? fconn->cg->card : (fconn->cardname ? fconn->cardname : "-"),
fconn->charge, fconn->ccharge, FlagInfo(fconn->flags),
CauseInfo(fconn->cause, fconn->causeInfo));
} }
conn->seqnum = ++connseq; sprintf(buf,"# Waiting %s...",conn->cardname);
conn->ignore = 3; resp = str_enter(buf);
conn->minor = minor;
conn->next = isdn4_conn; isdn4_conn = conn;
sp += sprintf(sp,"# Waiting %s...",conn->cardname);
return 1; return 1;
} }
@ -1970,7 +1962,7 @@ do_atcmd(void)
m_putid (&yy, PROTO_MODULE); m_putid (&yy, PROTO_MODULE);
m_putsx (&yy, PROTO_MODULE); m_putsx (&yy, PROTO_MODULE);
m_putsz (&yy, (uchar_t *) "proto"); m_putsz (&yy, (uchar_t *) "proto");
printf("On5\n"); if(log_34 & 2)printf("On5\n");
m_putsx (&yy, PROTO_ONLINE); m_putsx (&yy, PROTO_ONLINE);
xlen = yy.b_wptr - yy.b_rptr; xlen = yy.b_wptr - yy.b_rptr;
DUMPW (yy.b_rptr, xlen); DUMPW (yy.b_rptr, xlen);
@ -1988,7 +1980,7 @@ do_atcmd(void)
yy.b_rptr = yy.b_wptr = ans; yy.b_rptr = yy.b_wptr = ans;
dbb.db_base = ans; dbb.db_base = ans;
dbb.db_lim = ans + sizeof (ans); dbb.db_lim = ans + sizeof (ans);
if(1)printf("Dis9 "); if(log_34 & 2)printf("Dis9 ");
m_putid (&yy, CMD_OFF); m_putid (&yy, CMD_OFF);
m_putsx (&yy, ARG_MINOR); m_putsx (&yy, ARG_MINOR);
m_puti (&yy, minor); m_puti (&yy, minor);
@ -2095,14 +2087,14 @@ do_atcmd(void)
} }
if(conn != NULL) { if(conn != NULL) {
setconnref(conn,connrefs); setconnref(conn,isdn4_connref);
connrefs += 2; isdn4_connref += 2;
cg->refs++; cg->refs++;
dropgrab(conn->cg); dropgrab(conn->cg);
conn->cg = cg; conn->cg = cg;
} }
cg->flags = F_OUTGOING|F_DIALUP; cg->flags = F_OUTGOING|F_MULTIDIALUP|F_DIALUP;
if(m3 != NULL) if(m3 != NULL)
cg->card = str_enter(m3); cg->card = str_enter(m3);
else else
@ -2225,7 +2217,7 @@ printf("GotAnError: Minor %ld, connref %ld, hdr %s\n",minor,connref,HdrName(hdrv
cf cfr; cf cfr;
for (cfr = cf_R; cfr != NULL; cfr = cfr->next) { for (cfr = cf_R; cfr != NULL; cfr = cfr->next) {
if (!matchflag(conn->cg->flags,cfr->type)) continue; if (matchflag (conn->cg->flags,cfr->type) == 0) continue;
if (wildmatch (conn->cg->site, cfr->site) == NULL) continue; if (wildmatch (conn->cg->site, cfr->site) == NULL) continue;
if (wildmatch (conn->cg->protocol, cfr->protocol) == NULL) continue; if (wildmatch (conn->cg->protocol, cfr->protocol) == NULL) continue;
if (wildmatch (conn->cg->card, cfr->card) == NULL) continue; if (wildmatch (conn->cg->card, cfr->card) == NULL) continue;
@ -2259,7 +2251,7 @@ printf("GotAnError: Minor %ld, connref %ld, hdr %s\n",minor,connref,HdrName(hdrv
db.db_lim = ans + sizeof (ans); db.db_lim = ans + sizeof (ans);
*xx.b_wptr++ = PREF_NOERR; *xx.b_wptr++ = PREF_NOERR;
if(1)printf("DisA "); if(log_34 & 2)printf("DisA ");
m_putid (&xx, CMD_OFF); m_putid (&xx, CMD_OFF);
m_putsx(&xx,ARG_FORCE); m_putsx(&xx,ARG_FORCE);
if(minor > 0) { if(minor > 0) {

View File

@ -37,12 +37,18 @@ main (int argc, char *argv[])
else else
progname++; progname++;
while ((x = getopt (argc, argv, "iIf:dlLwWqQ"))!= EOF) { while ((x = getopt (argc, argv, "iIf:dlLwWqQmM"))!= EOF) {
switch (x) { switch (x) {
/* /*
* Logging. Small letters are usermode, capitals log in the kernel. * Logging. Small letters are usermode, capitals log in the kernel.
* 'l' is raw data, 'w' is interpreted data, 'q' is queue info. * 'l' is raw data, 'w' is interpreted data, 'q' is queue info.
*/ */
case 'm':
log_34 |= 1;
break;
case 'M':
log_34 |= 2;
break;
case 'l': case 'l':
pushlog |= 1; pushlog |= 1;
break; break;
@ -124,6 +130,12 @@ main (int argc, char *argv[])
#ifdef HAVE_SETPGRP_0 #ifdef HAVE_SETPGRP_0
setpgrp(); setpgrp();
#endif #endif
}
{ /* Switch stdout and stderr */
int fd = dup(1);
dup2(2,1);
dup2(fd,2);
close(fd);
} }
#ifdef linux #ifdef linux
@ -166,7 +178,7 @@ main (int argc, char *argv[])
mknod (idevname (i), S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(isdnstd,i)); mknod (idevname (i), S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(isdnstd,i));
chmod (idevname (i), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); chmod (idevname (i), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
} }
syslog(LOG_DEBUG,"ISDN: isdn/XX: major number %d",isdnstd); if(0)syslog(LOG_DEBUG,"ISDN: isdn/XX: major number %d",isdnstd);
} }
if(isdnterm == 0) if(isdnterm == 0)
@ -175,7 +187,7 @@ main (int argc, char *argv[])
int i; int i;
for(i=1;i<NPORT;i++) for(i=1;i<NPORT;i++)
unlink(devname(i)); unlink(devname(i));
syslog(LOG_DEBUG,"ISDN: ttyiXX: major number %d",isdnterm); if(0)syslog(LOG_DEBUG,"ISDN: ttyiXX: major number %d",isdnterm);
} }
} }
} }

View File

@ -9,10 +9,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h>
#include "f_signal.h" #include "f_signal.h"
#include "kernel.h"
#include <sys/wait.h> #include <sys/wait.h>
#include <strings.h>
#include <syslog.h> #include <syslog.h>
#include "streams.h" #include "streams.h"
#include "sioctl.h" #include "sioctl.h"
@ -29,8 +28,7 @@
#include "f_ioctl.h" #include "f_ioctl.h"
#include "f_termio.h" #include "f_termio.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#include "f_signal.h"
#include <sys/wait.h> #include <sys/wait.h>
#include "f_strings.h" #include "f_strings.h"
#include <syslog.h> #include <syslog.h>
@ -41,10 +39,7 @@
#include <ctype.h> #include <ctype.h>
#include <malloc.h> #include <malloc.h>
#include <fcntl.h> #include <fcntl.h>
#include "streams.h"
#include "sioctl.h"
#include "streamlib.h" #include "streamlib.h"
#include "isdn_34.h"
#include "phone_1TR6.h" #include "phone_1TR6.h"
#include "phone_ETSI.h" #include "phone_ETSI.h"
#include "isdn_proto.h" #include "isdn_proto.h"
@ -57,8 +52,6 @@
#include "isdn_23.h" #include "isdn_23.h"
#endif #endif
#include "isdn_limits.h" #include "isdn_limits.h"
#include "dump.h"
#include "timeout.h"
#include "x75.h" #include "x75.h"
#include "proto.h" #include "proto.h"
@ -155,10 +148,11 @@ EXTERN uid_t user[NMINOR];
/* Unique refnum, always incremented by two */ /* Unique refnum, always incremented by two */
/* The lower level also has one of these, but with the low bit set */ /* The lower level also has one of these, but with the low bit set */
EXTERN long connrefs INIT(2); EXTERN long isdn4_connref INIT(2);
EXTERN int fd_mon; /* the lower/layer connection */ EXTERN int fd_mon; /* the lower/layer connection */
EXTERN char *progname; EXTERN char *progname;
EXTERN int log_34 INIT(0);
EXTERN int testonly INIT(0); /* set if fd_mon is not actually connected */ EXTERN int testonly INIT(0); /* set if fd_mon is not actually connected */
EXTERN int igstdin INIT(1); /* Ignore stdin */ EXTERN int igstdin INIT(1); /* Ignore stdin */
EXTERN int in_boot INIT(1); /* We're still coming up */ EXTERN int in_boot INIT(1); /* We're still coming up */
@ -182,7 +176,7 @@ EXTERN int connseq INIT(0);
EXTERN struct xstream *xs_mon; /* Pseudo-stream for the L3 engine */ EXTERN struct xstream *xs_mon; /* Pseudo-stream for the L3 engine */
#define DUMPW(s,l) do { printf("HL W "); dumpascii((uchar_t *)(s),(l)); printf("\n"); } while(0) #define DUMPW(s,l) do { if(!(log_34 & 1)) break; printf("HL W "); dumpascii((uchar_t *)(s),(l)); printf("\n"); } while(0)
/* String database. Should probably be an AVL tree or a hash but I'm lazy. */ /* String database. Should probably be an AVL tree or a hash but I'm lazy. */
/** The purpose of this thing is to be able not to bother with keeping track /** The purpose of this thing is to be able not to bother with keeping track
@ -307,25 +301,27 @@ typedef struct conninfo {
#define F_INTERRUPT 01 /* interrupt, don't disconnect */ #define F_INTERRUPT 01 /* interrupt, don't disconnect */
#define F_PREFOUT 02 /* drop incoming connection on call collision */ #define F_PREFOUT 02 /* drop incoming connection on call collision */
#define F_FORCEOUT 04 /* always drop incoming connection */ #define F_FORCEOUT 04 /* always drop incoming connection */
#define F_IGNORELIMIT 010 /* override card limit */ #define F_IGNORELIMIT 010 /* override connection limit */
#define F_FASTDROP 020 /* immediate connection reject */ #define F_FASTDROP 020 /* immediate connection reject */
#define F_FASTREDIAL 040 /* don't delay as much when a dialup attempt fails */ #define F_FASTREDIAL 040 /* don't delay as much when a dialup attempt fails */
#define F_PERMANENT 0100 /* connection doesn't really die */ #define F_PERMANENT 0100 /* dialup connection which doesn't really die */
#define F_LEASED 0200 /* leased line */ #define F_LEASED 0200 /* connection on leased line */
#define F_CHANBUSY 0400 /* busy if no free channel */ #define F_CHANBUSY 0400 /* busy if no free channel */
#define F_NRCOMPLETE 01000 /* remote number is complete */ #define F_NRCOMPLETE 01000 /* remote number is complete */
#define F_LNRCOMPLETE 02000 /* local number is complete */ #define F_LNRCOMPLETE 02000 /* local number is complete */
#define F_INCOMING 04000 /* incoming call */ #define F_INCOMING 04000 /* incoming call */
#define F_OUTGOING 010000 /* outgoing call */ #define F_OUTGOING 010000 /* outgoing call */
#define F_DIALUP 020000 /* dialup line */ #define F_DIALUP 020000 /* dialup connection */
#define F_IGNORELIMIT2 040000 /* override card limit */ #define F_MULTIDIALUP 040000 /* dialup connection, independent */
#define F_OUTCOMPLETE 0100000 /* outgoing call info complete */ #define F_OUTCOMPLETE 0100000 /* outgoing call info complete */
#define F_SETINITIAL 0200000 /* initial connection setup */ #define F_SETINITIAL 0200000 /* initial connection setup */
#define F_SETLATER 0400000 /* later re-setup */ #define F_SETLATER 0400000 /* later re-setup */
#define F_NOREJECT 01000000 /* don't cause "temp unavailable" messages */ #define F_NOREJECT 01000000 /* don't cause "temp unavailable" messages */
#define F_BACKCALL 02000000 /* callback on B if incoming call on A busy */ #define F_BACKCALL 02000000 /* callback on B if incoming call on A busy */
#define F_FOOBAR 04000000 /* dummy flag to return TRUE */
#define F_MOVEFLAGS (F_IGNORELIMIT|F_IGNORELIMIT2) #define F_MOVEFLAGS (F_IGNORELIMIT|F_PERMANENT|F_DIALUP|F_MULTIDIALUP|F_LEASED)
#define F_MASKFLAGS (F_PERMANENT|F_DIALUP|F_MULTIDIALUP)
/* FLags we set on start of a connection from the conngrab */ /* FLags we set on start of a connection from the conngrab */
/* /*
@ -363,11 +359,12 @@ void do_quitnow(void *nix);
#define setconnref(a,b) Xsetconnref(__FILE__,__LINE__,(a),(b)) #define setconnref(a,b) Xsetconnref(__FILE__,__LINE__,(a),(b))
void Xsetconnref(const char *deb_file,unsigned int deb_line, conninfo conn, int connref); void Xsetconnref(const char *deb_file,unsigned int deb_line, conninfo conn, int connref);
void connreport(char *foo, char *card); void connreport(char *foo, char *card, int minor);
/* Changing a connection status, and things to do */ /* Changing a connection status, and things to do */
const char *CauseInfo(int cause, char *pri); const char *CauseInfo(int cause, char *pri);
void ReportConn(conninfo conn); void ReportOneConn(conninfo conn, int minor);
#define ReportConn(a) ReportOneConn((a),0)
#define setconnstate(a,b) Xsetconnstate(__FILE__,__LINE__,(a),(b)) #define setconnstate(a,b) Xsetconnstate(__FILE__,__LINE__,(a),(b))
void Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState state); void Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState state);
@ -462,7 +459,7 @@ void Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_li
void rdropconn (struct conninfo *conn, int deb_line); void rdropconn (struct conninfo *conn, int deb_line);
void deadkid (void); void deadkid (void);
int matchflag(long flags, char *ts); long matchflag(long flags, char *ts);
cf getcards(conngrab cg, cf list); cf getcards(conngrab cg, cf list);
void Xbreak(void); void Xbreak(void);

View File

@ -10,18 +10,19 @@
/* Verify that the connection mode matches the stated flags. */ /* Verify that the connection mode matches the stated flags. */
int long
matchflag(long flags, char *ts) matchflag(long flags, char *ts)
{ {
char inc,outg,leas,prep,dial,ini,aft; char inc,outg,leas,perm,dial,mdial,ini,aft;
ini = (strchr(ts,'u') != NULL); ini = (strchr(ts,'u') != NULL);
aft = (strchr(ts,'a') != NULL); aft = (strchr(ts,'a') != NULL);
inc = (strchr(ts,'i') != NULL); inc = (strchr(ts,'i') != NULL);
outg= (strchr(ts,'o') != NULL); outg= (strchr(ts,'o') != NULL);
leas= (strchr(ts,'f') != NULL); leas= (strchr(ts,'f') != NULL);
prep= (strchr(ts,'p') != NULL); perm= (strchr(ts,'p') != NULL);
dial= (strchr(ts,'d') != NULL); dial= (strchr(ts,'d') != NULL);
mdial=(strchr(ts,'m') != NULL);
if(flags & F_SETINITIAL) { if (aft && !ini) return 0; } if(flags & F_SETINITIAL) { if (aft && !ini) return 0; }
if(flags & F_SETLATER) { if (!aft && ini) return 0; } if(flags & F_SETLATER) { if (!aft && ini) return 0; }
@ -29,12 +30,23 @@ matchflag(long flags, char *ts)
if(flags & F_OUTGOING) { if (inc && !outg) return 0; } if(flags & F_OUTGOING) { if (inc && !outg) return 0; }
if(flags & F_INCOMING) { if (!inc && outg) return 0; } if(flags & F_INCOMING) { if (!inc && outg) return 0; }
if(!(flags & (F_LEASED|F_PERMANENT|F_DIALUP))) return 1; if(!(leas || dial || perm)) goto set;
if(!(leas || dial || prep)) return 1; if(!(flags & (F_LEASED|F_PERMANENT|F_MULTIDIALUP|F_DIALUP))) goto set;
if((flags & F_LEASED) && leas) return 1; if((flags & F_LEASED) && leas) goto set;
if((flags & F_PERMANENT)&& prep) return 1; if((flags & F_PERMANENT) && perm) goto set;
if((flags & F_DIALUP) && dial) return 1; if((flags & F_DIALUP) && dial) goto set;
if((flags & F_MULTIDIALUP) && mdial) goto set;
return 0; return 0;
set:
if(ini) flags |= F_SETINITIAL;
if(aft) flags |= F_SETLATER;
if(inc) flags |= F_INCOMING;
if(outg) flags |= F_OUTGOING;
if(leas) flags |= F_LEASED;
if(perm) flags |= F_PERMANENT;
if(dial) flags |= F_DIALUP;
if(mdial)flags |= F_MULTIDIALUP;
return flags | F_FOOBAR;
} }
/* Check if this P-line matches a connection request */ /* Check if this P-line matches a connection request */
@ -42,6 +54,7 @@ char *
pmatch1 (cf prot, conngrab *cgm) pmatch1 (cf prot, conngrab *cgm)
{ {
char *sit, *pro, *cla, *car; char *sit, *pro, *cla, *car;
long flg;
ulong_t sub; ulong_t sub;
char first = 1; char first = 1;
conngrab cg = *cgm; conngrab cg = *cgm;
@ -71,7 +84,7 @@ pmatch1 (cf prot, conngrab *cgm)
mblk_t *cand = NULL; mblk_t *cand = NULL;
streamchar *mbs_in = NULL, *mbs_out = NULL; streamchar *mbs_in = NULL, *mbs_out = NULL;
if(!matchflag(cg->flags,prot->type)) { if(first) { dropgrab(cg); return "5ERR BadFlag"; } else continue;} if((flg = matchflag(cg->flags,prot->type)) == 0) { if(first) { dropgrab(cg); return "5ERR BadFlag"; } else continue;}
if (first) { if (first) {
if (strchr (prot->type, 'M')) { /* First Match not allowed. */ if (strchr (prot->type, 'M')) { /* First Match not allowed. */
dropgrab(cg); dropgrab(cg);
@ -96,7 +109,7 @@ pmatch1 (cf prot, conngrab *cgm)
} }
if(!first) { if(!first) {
cgc->site = sit; cgc->protocol = pro; cgc->card = car; cgc->cclass = cla; cgc->site = sit; cgc->protocol = pro; cgc->card = car; cgc->cclass = cla;
cgc->mask = sub; cgc->mask = sub; cgc->flags = flg;
} }
if(cgc->par_out == NULL) { /* No outgoing parameter list? Yet! */ if(cgc->par_out == NULL) { /* No outgoing parameter list? Yet! */
if ((cgc->par_out = allocb(256,BPRI_LO)) == NULL) { if ((cgc->par_out = allocb(256,BPRI_LO)) == NULL) {
@ -286,8 +299,8 @@ pmatch1 (cf prot, conngrab *cgm)
break; break;
if ((nrt & ARG_IN) && (cgc->flags & F_INCOMING)) { if ((nrt & ARG_IN) && (cgc->flags & F_INCOMING)) {
if (cgc->nrsuf != NULL) { if (cgc->nrsuf != NULL) {
if(1)printf("MatchSuffix %s and %s\n",cgc->nrsuf,yy); if(0)printf("MatchSuffix %s and %s\n",cgc->nrsuf,yy);
if(match_suffix(cgc->nrsuf,yy) <= 0) DG("2WrongNrSuffix 2"); if(match_suffix(cgc->nrsuf,yy) <= 0) DG("3WrongNrSuffix 2");
} else } else
cgc->nrsuf = str_enter(yy); cgc->nrsuf = str_enter(yy);
} }
@ -322,7 +335,7 @@ pmatch1 (cf prot, conngrab *cgm)
if(cgc->lnrsuf != NULL) { if(cgc->lnrsuf != NULL) {
if(1)printf("MatchLSuffix %s and %s\n",cgc->lnrsuf,yy); if(1)printf("MatchLSuffix %s and %s\n",cgc->lnrsuf,yy);
if((suf = match_suffix(cgc->lnrsuf,yy)) <= 0) if((suf = match_suffix(cgc->lnrsuf,yy)) <= 0)
DG(suf ? "3LNrIncompSuffix 2" : "3WrongLNrSuffix 2"); DG(suf ? "1LNrIncompSuffix 2" : "2WrongLNrSuffix 2");
} else } else
DG("4LNrIncompSuffix 3"); DG("4LNrIncompSuffix 3");
} }
@ -342,9 +355,9 @@ pmatch1 (cf prot, conngrab *cgm)
cgc->flags |= F_LNRCOMPLETE; cgc->flags |= F_LNRCOMPLETE;
} else { } else {
if((cgc->lnrsuf != 0) && (match_suffix(cgc->lnrsuf,yy) < 0)) if((cgc->lnrsuf != 0) && (match_suffix(cgc->lnrsuf,yy) < 0))
DG("3LNrIncompSuffix 4"); DG("2LNrIncompSuffix 4");
else else
DG("3WrongLNrSuffix 4"); DG("2WrongLNrSuffix 4");
} }
} }
} }
@ -489,6 +502,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
char *matcar; char *matcar;
char *matpro; char *matpro;
ulong_t matsub; ulong_t matsub;
long matflg;
if(d == NULL) { /* Restart at the beginning */ if(d == NULL) { /* Restart at the beginning */
numwrap = 0; numwrap = 0;
@ -500,20 +514,23 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
continue; /* scan and skip */ continue; /* scan and skip */
else if(numwrap == 0) else if(numwrap == 0)
numwrap = -1; numwrap = -1;
if(!(cg->flags & F_INCOMING)) if(!(cg->flags & F_INCOMING)) {
numidx++; /* Check this; check the next number next time. */ numidx++;
if((strchr(d->type,'B') != NULL) && (numwrap > 0))
continue; /* THIS DOES NOT WORK YET */
}
/* Yes, we did increment the refcount, above. */ /* Yes, we did increment the refcount, above. */
dropgrab(cg); dropgrab(cg);
cg = *foo; cg = *foo;
cg->refs++; cg->refs++;
if((matflg = matchflag(cg->flags,d->type)) == 0) continue;
if((matsit = wildmatch(cg->site,d->site)) == NULL) continue; if((matsit = wildmatch(cg->site,d->site)) == NULL) continue;
if((matpro = wildmatch(cg->protocol,d->protocol)) == NULL) continue; if((matpro = wildmatch(cg->protocol,d->protocol)) == NULL) continue;
if((matcar = wildmatch(matcrd,d->card)) == NULL) continue; if((matcar = wildmatch(matcrd,d->card)) == NULL) continue;
if((matcla = classmatch(matclass,d->cclass)) == NULL) continue; if((matcla = classmatch(matclass,d->cclass)) == NULL) continue;
if((matsub = maskmatch(cg->mask,d->mask)) == 0) continue; if((matsub = maskmatch(cg->mask,d->mask)) == 0) continue;
if(!matchflag(cg->flags,d->type)) continue;
/* Preliminary match OK, remember the data so far. */ /* Preliminary match OK, remember the data so far. */
dropgrab(cg); dropgrab(cg);
@ -522,7 +539,7 @@ if(0)printf("%s.%s.!.",cg->site,cg->card); /* I hate debugging. */
cg->site = matsit; cg->cclass = matcla; cg->site = matsit; cg->cclass = matcla;
cg->card = matcar; cg->protocol = matpro; cg->card = matcar; cg->protocol = matpro;
cg->mask = matsub; cg->mask = matsub; cg->flags = matflg;
if(!(cg->flags & F_LEASED)) { if(!(cg->flags & F_LEASED)) {
/* Now figure out the numbers... */ /* Now figure out the numbers... */

View File

@ -99,8 +99,12 @@ char *match_nr (char *extnr, char *locnr, char *locpref)
return NULL; return NULL;
extpos++; locpos++; extpos++; locpos++;
} }
if(*locpos != '\0') if(*locpos != '\0') {
if(*locpos == '/' || *locpos == '.')
if(wildmat("",locpos+1))
return str_enter(locpos);
return NULL; return NULL;
}
return ""; return "";
} }

View File

@ -57,6 +57,12 @@ char *FlagInfo(int flag)
static char fbuf[30]; static char fbuf[30];
fbuf[0]='\0'; fbuf[0]='\0';
if (flag & F_INCOMING) strcat(fbuf, ":in");
if (flag & F_OUTGOING) strcat(fbuf, ":ou");
if (flag & F_PERMANENT) strcat(fbuf, ":dP");
if (flag & F_LEASED) strcat(fbuf, ":dL");
if (flag & F_MULTIDIALUP) strcat(fbuf, ":dM");
if (flag & F_DIALUP) strcat(fbuf, ":dD");
if (flag & F_INTERRUPT) strcat(fbuf, ":is"); if (flag & F_INTERRUPT) strcat(fbuf, ":is");
if (flag & F_PREFOUT) strcat(fbuf, ":xi"); if (flag & F_PREFOUT) strcat(fbuf, ":xi");
if (flag & F_FORCEOUT) strcat(fbuf, ":yi"); if (flag & F_FORCEOUT) strcat(fbuf, ":yi");
@ -64,15 +70,9 @@ char *FlagInfo(int flag)
if (flag & F_IGNORELIMIT) strcat(fbuf, ":il"); if (flag & F_IGNORELIMIT) strcat(fbuf, ":il");
if (flag & F_FASTDROP) strcat(fbuf, ":fX"); if (flag & F_FASTDROP) strcat(fbuf, ":fX");
if (flag & F_FASTREDIAL) strcat(fbuf, ":fr"); if (flag & F_FASTREDIAL) strcat(fbuf, ":fr");
if (flag & F_PERMANENT) strcat(fbuf, ":dP");
if (flag & F_LEASED) strcat(fbuf, ":dL");
if (flag & F_CHANBUSY) strcat(fbuf, ":ib"); if (flag & F_CHANBUSY) strcat(fbuf, ":ib");
if (flag & F_NRCOMPLETE) strcat(fbuf, ":nc"); if (flag & F_NRCOMPLETE) strcat(fbuf, ":nc");
if (flag & F_LNRCOMPLETE) strcat(fbuf, ":lc"); if (flag & F_LNRCOMPLETE) strcat(fbuf, ":lc");
if (flag & F_INCOMING) strcat(fbuf, ":in");
if (flag & F_OUTGOING) strcat(fbuf, ":ou");
if (flag & F_DIALUP) strcat(fbuf, ":dD");
if (flag & F_IGNORELIMIT2) strcat(fbuf, ":iL");
if (flag & F_OUTCOMPLETE) strcat(fbuf, ":oc"); if (flag & F_OUTCOMPLETE) strcat(fbuf, ":oc");
if (flag & F_SETINITIAL) strcat(fbuf, ":si"); if (flag & F_SETINITIAL) strcat(fbuf, ":si");
if (flag & F_SETLATER) strcat(fbuf, ":sl"); if (flag & F_SETLATER) strcat(fbuf, ":sl");
@ -91,6 +91,7 @@ const char *CauseInfo(int cause, char *pri)
case 0: return "OK"; case 0: return "OK";
case ID_priv_Busy: return "Local Busy"; case ID_priv_Busy: return "Local Busy";
case ID_priv_Print: if(isdigit(*pri)) return pri+1; else return pri; case ID_priv_Print: if(isdigit(*pri)) return pri+1; else return pri;
case CHAR2('?','?'): return "-unknown-";
#ifdef _capi_ #ifdef _capi_
case ID_E_REGISTER: return "application registration"; case ID_E_REGISTER: return "application registration";

View File

@ -16,7 +16,8 @@ deadkid (void)
struct conninfo *conn; struct conninfo *conn;
while((pid = wait4 (-1,&val,WNOHANG,NULL)) > 0) { while((pid = wait4 (-1,&val,WNOHANG,NULL)) > 0) {
printf ("\n* PID %d died, %x\n", pid, val); if(log_34 & 2)
printf ("\n* PID %d died, %x\n", pid, val);
chkall(); chkall();
for (conn = isdn4_conn; conn != NULL; conn = conn ? conn->next : NULL) { for (conn = isdn4_conn; conn != NULL; conn = conn ? conn->next : NULL) {
@ -78,7 +79,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
char *mods = NULL; char *mods = NULL;
for (prot = cf_ML; prot != NULL; prot = prot->next) { for (prot = cf_ML; prot != NULL; prot = prot->next) {
if(!matchflag(cg->flags,prot->type)) continue; if (!matchflag (cg->flags,prot->type)) continue;
if (!wildmatch (cg->site, prot->site)) continue; if (!wildmatch (cg->site, prot->site)) continue;
if (!wildmatch (cg->protocol, prot->protocol)) continue; if (!wildmatch (cg->protocol, prot->protocol)) continue;
if (!wildmatch (cg->card, prot->card)) continue; if (!wildmatch (cg->card, prot->card)) continue;
@ -151,7 +152,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
streamchar *newlim = NULL; streamchar *newlim = NULL;
mblk_t *mz = NULL; mblk_t *mz = NULL;
if(!matchflag(cg->flags,cm->type)) continue; if (!matchflag (cg->flags,cm->type)) continue;
if (!wildmatch (cg->site, cm->site)) continue; if (!wildmatch (cg->site, cm->site)) continue;
if (!wildmatch (cg->protocol, cm->protocol)) continue; if (!wildmatch (cg->protocol, cm->protocol)) continue;
if (!wildmatch (cg->card, cm->card)) continue; if (!wildmatch (cg->card, cm->card)) continue;
@ -212,7 +213,8 @@ pushprot (conngrab cg, int minor, int connref, char update)
io[1].iov_base = mi->b_rptr; io[1].iov_base = mi->b_rptr;
io[1].iov_len = mi->b_wptr - mi->b_rptr; io[1].iov_len = mi->b_wptr - mi->b_rptr;
DUMPW (mj->b_rptr, io[0].iov_len); DUMPW (mj->b_rptr, io[0].iov_len);
printf ("+ "); if(log_34 & 1)
printf ("+ ");
DUMPW (mi->b_rptr, io[1].iov_len); DUMPW (mi->b_rptr, io[1].iov_len);
(void) strwritev (xs_mon, io, 2, 1); (void) strwritev (xs_mon, io, 2, 1);
freeb (mj); freeb (mj);
@ -258,7 +260,7 @@ pushcardprot (conngrab cg, int minor, int connref)
if(card == NULL) if(card == NULL)
return -ENOENT; return -ENOENT;
for (prot = cf_ML; prot != NULL; prot = prot->next) { for (prot = cf_ML; prot != NULL; prot = prot->next) {
if(!matchflag(cg->flags,prot->type)) continue; if (!matchflag (cg->flags,prot->type)) continue;
if (!wildmatch (cg->site, prot->site)) continue; if (!wildmatch (cg->site, prot->site)) continue;
if (!wildmatch (cg->protocol, prot->protocol)) continue; if (!wildmatch (cg->protocol, prot->protocol)) continue;
if (!wildmatch (cg->card, prot->card)) continue; if (!wildmatch (cg->card, prot->card)) continue;
@ -351,7 +353,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
if(conn->cg == cg) if(conn->cg == cg)
break; break;
} }
if(conn == NULL) { if(conn == NULL && (cg->flags & (F_PERMANENT|F_MULTIDIALUP|F_DIALUP))) {
for(conn = isdn4_conn; conn != NULL; conn = conn->next) { for(conn = isdn4_conn; conn != NULL; conn = conn->next) {
char *sit,*pro,*car,*cla; char *sit,*pro,*car,*cla;
ulong_t sub; ulong_t sub;
@ -360,7 +362,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
continue; continue;
if(conn->pid == 0 || conn->minor == 0) if(conn->pid == 0 || conn->minor == 0)
continue; continue;
if(!(conn->flags & F_PERMANENT)) if(!(conn->flags & (F_PERMANENT|F_DIALUP)))
continue; continue;
if(conn->cg == NULL) if(conn->cg == NULL)
continue; continue;
@ -374,7 +376,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
break; break;
} }
} }
if(conn == NULL) { if(conn == NULL && (cg->flags & (F_PERMANENT|F_MULTIDIALUP|F_DIALUP))) {
for(conn = isdn4_conn; conn != NULL; conn = conn->next) { for(conn = isdn4_conn; conn != NULL; conn = conn->next) {
char *sit,*pro; char *sit,*pro;
@ -382,7 +384,7 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
continue; continue;
if(conn->pid == 0 || conn->minor == 0) if(conn->pid == 0 || conn->minor == 0)
continue; continue;
if(!(conn->flags & F_PERMANENT)) if(!(conn->flags & (F_PERMANENT|F_DIALUP)))
continue; continue;
if(conn->cg == NULL) if(conn->cg == NULL)
continue; continue;
@ -399,6 +401,8 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
} }
/* Returning "+" in the first position means keep the new connection. */ /* Returning "+" in the first position means keep the new connection. */
/* Return "-" to keep the old connection. */
/* Return "=" to call back. */
if(conn->state == c_forceoff) { if(conn->state == c_forceoff) {
dropgrab(cg); dropgrab(cg);
@ -407,15 +411,15 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
} }
if(conn->state == c_going_down) { if(conn->state == c_going_down) {
dropgrab(cg); dropgrab(cg);
*ret = "-COLLISION 1b"; *ret = "+COLLISION 1b";
return conn; return conn;
} }
if(conn->state > c_going_down) { if(conn->state > c_going_down) {
*ret = "+COLLISION 1b"; *ret = "-COLLISION 1b";
if((conn->state == c_going_up) && (cg->flags & F_PREFOUT)) if((conn->state == c_going_up) && (cg->flags & F_PREFOUT))
**ret = '-'; **ret = '+';
if((conn->state == c_up) && (cg->flags & (F_PREFOUT | F_FORCEOUT))) if((conn->state == c_up) && (cg->flags & (F_PREFOUT | F_FORCEOUT)))
**ret = '-'; **ret = '+';
dropgrab(cg); dropgrab(cg);
return conn; return conn;
} }
@ -425,7 +429,8 @@ startconn(conngrab cg, int fminor, int connref, char **ret, conngrab *retcg)
return conn; return conn;
} }
printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr); if(log_34 & 2)
printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
if(((*ret) = findit (&cg,0)) != NULL) { if(((*ret) = findit (&cg,0)) != NULL) {
*retcg = cg; *retcg = cg;
dropgrab(rcg); dropgrab(rcg);
@ -452,8 +457,8 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
m_puti (&yy, cg->delay); m_puti (&yy, cg->delay);
if(cg->flags & F_OUTGOING) { if(cg->flags & F_OUTGOING) {
m_putsx(&yy,ARG_NOCONN); m_putsx(&yy,ARG_NOCONN);
setconnref(conn,connrefs); setconnref(conn,isdn4_connref);
connrefs += 2; isdn4_connref += 2;
} else if(connref != 0) { } else if(connref != 0) {
if(conn->connref != 0 && conn->state == c_up) { if(conn->connref != 0 && conn->state == c_up) {
*ret = "COLLISION 2"; *ret = "COLLISION 2";
@ -483,10 +488,12 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
if (cg->lnr != NULL) { if (cg->lnr != NULL) {
char *s = strip_nr(cg->lnr,1); char *s = strip_nr(cg->lnr,1);
printf("Strip3 %s -> %s\n",cg->lnr,s); if(log_34 & 2)
printf("Strip3 %s -> %s\n",cg->lnr,s);
if(s == NULL && cg->lnrsuf != NULL) { if(s == NULL && cg->lnrsuf != NULL) {
s = append_nr(cg->lnr,cg->lnrsuf); s = append_nr(cg->lnr,cg->lnrsuf);
printf("Append3 %s,%s -> %s\n",cg->lnr,cg->lnrsuf,s); if(log_34 & 2)
printf("Append3 %s,%s -> %s\n",cg->lnr,cg->lnrsuf,s);
} }
if(s != NULL) { if(s != NULL) {
m_putsx (&yy, ARG_LNUMBER); m_putsx (&yy, ARG_LNUMBER);
@ -495,10 +502,12 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
} }
if (cg->nr != NULL) { if (cg->nr != NULL) {
char *s = strip_nr(cg->nr,0); char *s = strip_nr(cg->nr,0);
printf("Strip3 %s -> %s\n",cg->nr,s); if(log_34 & 2)
printf("Strip3 %s -> %s\n",cg->nr,s);
if(s == NULL && cg->nrsuf != NULL) { if(s == NULL && cg->nrsuf != NULL) {
s = append_nr(cg->nr,cg->nrsuf); s = append_nr(cg->nr,cg->nrsuf);
printf("Append3 %s,%s -> %s\n",cg->nr,cg->nrsuf,s); if(log_34 & 2)
printf("Append3 %s,%s -> %s\n",cg->nr,cg->nrsuf,s);
} }
if(s != NULL) { if(s != NULL) {
m_putsx (&yy, ARG_NUMBER); m_putsx (&yy, ARG_NUMBER);
@ -541,10 +550,12 @@ printf("Start: %s:%s #%s...",cg->site,cg->protocol,cg->nr);
#endif #endif
DUMPW (yy.b_rptr, io[0].iov_len); DUMPW (yy.b_rptr, io[0].iov_len);
if (iovlen > 1) { if (iovlen > 1) {
printf ("+ "); if(log_34 & 1)
printf ("+ ");
DUMPW (xx->b_rptr, io[1].iov_len); DUMPW (xx->b_rptr, io[1].iov_len);
if(iovlen > 2) { if(iovlen > 2) {
printf ("+ "); if(log_34 & 1)
printf ("+ ");
DUMPW (cg->par_out->b_rptr, io[2].iov_len); DUMPW (cg->par_out->b_rptr, io[2].iov_len);
} }
} }
@ -658,6 +669,18 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
conn->pid = (pid_t)~0; conn->pid = (pid_t)~0;
ReportConn(conn); ReportConn(conn);
} }
{
int flags = 0;
if (strchr(cfr->type,'m') != NULL)
flags |= F_MULTIDIALUP;
if (strchr(cfr->type,'d') != NULL)
flags |= F_DIALUP;
if (strchr(cfr->type,'p') != NULL)
flags |= F_PERMANENT;
if (strchr(cfr->type,'f') != NULL)
flags |= F_LEASED;
cg->flags = (cg->flags &~ (F_MULTIDIALUP|F_DIALUP|F_PERMANENT|F_LEASED)) | flags;
}
} else { } else {
if(conn != NULL) { if(conn != NULL) {
int id = 0; char *ids = strchr(cfr->type,'/'); int id = 0; char *ids = strchr(cfr->type,'/');
@ -982,8 +1005,8 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
#endif #endif
close (pip[0]); close (pip[0]);
} }
syslog (LOG_INFO, "exec %x:%x %d %s/%s %s", dev, dev2, pid, cfr->site,cfr->protocol, cfr->args); syslog (LOG_INFO, "exec %d:%d %d %s/%s %s", dev, dev2, pid, cfr->site,cfr->protocol, cfr->args);
printf ("* PID %d\n", pid); if(0)printf ("* PID %d\n", pid);
if(prog != NULL) { if(prog != NULL) {
prog->next = conn->run; prog->next = conn->run;

View File

@ -8,7 +8,7 @@
#include "f_malloc.h" #include "f_malloc.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -7,7 +7,7 @@
#include "f_signal.h" #include "f_signal.h"
#include "f_malloc.h" #include "f_malloc.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#ifdef DO_ADDUSER #ifdef DO_ADDUSER
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -8,7 +8,7 @@
#include "f_malloc.h" #include "f_malloc.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#include "streamlib.h" #include "streamlib.h"
#include "isdn_23.h" #include "isdn_23.h"
#include "kernel.h" #include "kernel.h"

View File

@ -8,7 +8,7 @@
#include "f_signal.h" #include "f_signal.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#include "f_user.h" #include "f_user.h"
#include <sys/errno.h> #include <sys/errno.h>
#include <f_termio.h> #include <f_termio.h>
@ -902,7 +902,6 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
if(0)printf("%sProto IOC %x\n",KERN_DEBUG,iocb->ioc_cmd); if(0)printf("%sProto IOC %x\n",KERN_DEBUG,iocb->ioc_cmd);
switch (iocb->ioc_cmd) { switch (iocb->ioc_cmd) {
#if 1 /* ndef linux */
#ifdef TCGETA #ifdef TCGETA
case TCGETA: case TCGETA:
{ {
@ -926,18 +925,15 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
#else #else
memcpy(tty->c_cc,proto->tty.c_cc,NCCS); memcpy(tty->c_cc,proto->tty.c_cc,NCCS);
#endif #endif
goto iocackn;
goto iocack;
} }
#endif #endif
#endif
#ifdef TCFLSH #ifdef TCFLSH
case TCFLSH: case TCFLSH:
{ {
goto iocack; /* We don't flush */ goto iocackn; /* We don't flush */
} }
#endif #endif
#if 1 /* ndef linux */
#ifdef TCGETS #ifdef TCGETS
case TCGETS: case TCGETS:
{ {
@ -951,10 +947,9 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
mp->b_cont = m0; mp->b_cont = m0;
*((struct termios *) m0->b_wptr)++ = proto->tty; *((struct termios *) m0->b_wptr)++ = proto->tty;
goto iocack; goto iocackn;
} }
#endif #endif
#endif
#ifdef UIOCTTSTAT #ifdef UIOCTTSTAT
case UIOCTTSTAT: case UIOCTTSTAT:
{ {
@ -973,7 +968,6 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
goto iocack; goto iocack;
} }
#endif #endif
#if 1 /* ndef linux */
#ifdef TCSETA #ifdef TCSETA
case TCSETA: case TCSETA:
case TCSETAW: case TCSETAW:
@ -1027,12 +1021,10 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
/* bzero(proto->tty.c_cc,NCC); */ /* bzero(proto->tty.c_cc,NCC); */
#endif #endif
splx (ms); splx (ms);
goto iocack; goto iocackn;
} }
#endif #endif
#endif
#if 1 /* ndef linux */
#ifdef TCSETS #ifdef TCSETS
case TCSETS: case TCSETS:
case TCSETSW: case TCSETSW:
@ -1078,11 +1070,10 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
/* bzero(proto->tty.c_cc,NCC); */ /* bzero(proto->tty.c_cc,NCC); */
#endif #endif
splx (ms); splx (ms);
goto iocack; goto iocackn;
} }
#endif #endif
#endif
#ifdef TCSBRK #ifdef TCSBRK
case TCSBRK: case TCSBRK:
#endif #endif
@ -1174,6 +1165,7 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
#ifdef UIOCNOFLOW #ifdef UIOCNOFLOW
case UIOCNOFLOW: case UIOCNOFLOW:
#endif #endif
iocack: iocack:
DATA_TYPE(mp) = M_IOCACK; DATA_TYPE(mp) = M_IOCACK;
qreply (q, mp); qreply (q, mp);
@ -1181,11 +1173,13 @@ if(!realq)printf("%sFromDel %p\n",KERN_DEBUG, &proto->write_delay);
default: default:
putnext (q, mp); putnext (q, mp);
break; break;
#ifdef linux /* This is handled by the line discipline. */
iocackn:
error = -ENOIOCTLCMD; /* special code */
#endif
iocnak: iocnak:
DATA_TYPE(mp) = M_IOCNAK; DATA_TYPE(mp) = M_IOCNAK;
if(error < 0) iocb->ioc_error = (error < 0) ? -error : error;
error = -error;
iocb->ioc_error = error;
qreply (q, mp); qreply (q, mp);
} }
break; break;

View File

@ -8,7 +8,7 @@
#include "f_malloc.h" #include "f_malloc.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#include "f_user.h" #include "f_user.h"
#include <sys/errno.h> #include <sys/errno.h>
#include "streamlib.h" #include "streamlib.h"

View File

@ -8,7 +8,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#include "f_user.h" #include "f_user.h"
#include "f_malloc.h" #include "f_malloc.h"
#include <sys/errno.h> #include <sys/errno.h>

View File

@ -11,7 +11,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -11,7 +11,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -20,7 +20,7 @@
#define NSTR 8 #define NSTR 8
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef M_UNIX #ifdef M_UNIX
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif

View File

@ -25,7 +25,7 @@
#include "primitives.h" #include "primitives.h"
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef M_UNIX #ifdef M_UNIX
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif

View File

@ -32,7 +32,7 @@
#include "primitives.h" #include "primitives.h"
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#include <sys/socket.h> #include <sys/socket.h>
#if LINUX_VERSION_CODE >= 66324 /* 1.3.20 ??? */ #if LINUX_VERSION_CODE >= 66324 /* 1.3.20 ??? */
#include <linux/if_arp.h> #include <linux/if_arp.h>
@ -42,7 +42,6 @@
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif
#include <linux/syscompat.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/errno.h> #include <sys/errno.h>
#include "f_ioctl.h" #include "f_ioctl.h"

View File

@ -5,7 +5,7 @@
#include <sys/time.h> #include <sys/time.h>
#include "f_signal.h" #include "f_signal.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#ifdef DO_ADDUSER #ifdef DO_ADDUSER
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -5,7 +5,7 @@
#include <sys/time.h> #include <sys/time.h>
#include "f_signal.h" #include "f_signal.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#ifdef DO_ADDUSER #ifdef DO_ADDUSER
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -18,7 +18,7 @@
#include "f_ioctl.h" #include "f_ioctl.h"
#include "f_ip.h" #include "f_ip.h"
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stropts.h> #include "stropts.h"
#include "f_termio.h" #include "f_termio.h"
#include <sys/signal.h> #include <sys/signal.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@ -1,16 +1,9 @@
all:: all::
depend::
rm -f sys linux
ln -s . linux
ln -s . sys
KERNEL=1 KERNEL=1
OBJ = streams.o OBJ = streams.o
TOPDIR=.. TOPDIR=..
include $(TOPDIR)/Make.rules include $(TOPDIR)/Make.rules
clean::
rm -f sys linux

View File

@ -3,8 +3,8 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/syscompat.h> #include "compat.h"
#include <linux/stropts.h> #include "stropts.h"
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/major.h> #include <linux/major.h>

View File

@ -11,8 +11,9 @@
#include "f_module.h" #include "f_module.h"
#undef F_NOCODE #undef F_NOCODE
#endif #endif
#include "kernel.h"
#include <linux/types.h> #include <linux/types.h>
#include <linux/stream.h> #include "stream.h"
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/errno.h> #include <linux/errno.h>
@ -27,8 +28,6 @@
#include <linux/tqueue.h> #include <linux/tqueue.h>
#include <linux/syscompat.h>
#define WAIT_READ 1 #define WAIT_READ 1
#define WAIT_WRITE 2 #define WAIT_WRITE 2
#define WAIT_NOINTR 4 #define WAIT_NOINTR 4
@ -982,7 +981,11 @@ static int xstream_write(struct stream_header *p_stream, int fromuser, const cha
} }
static int static int
streams_write (struct inode *inode, struct file *file, const char *buf, int count) streams_write (struct inode *inode, struct file *file,
#if LINUX_VERSION_CODE > 66304 /* 1.3.0 ?? */
const
#endif
char *buf, int count)
{ {
struct stream_header *p_stream; struct stream_header *p_stream;
unsigned long s; unsigned long s;
@ -1286,7 +1289,7 @@ xstreams_ioctl (struct stream_header *p_stream, unsigned int cmd, unsigned long
case TCSETSF: case TCSETSF:
strioc.ic_len = sizeof(struct termios); strioc.ic_len = sizeof(struct termios);
cmd |= IOC_IN; cmd |= IOC_IN;
goto doit; goto do_strioctl;
#endif #endif
#ifdef TCSETA #ifdef TCSETA
case TCSETA: case TCSETA:
@ -1294,30 +1297,28 @@ xstreams_ioctl (struct stream_header *p_stream, unsigned int cmd, unsigned long
case TCSETAF: case TCSETAF:
strioc.ic_len = sizeof(struct termio); strioc.ic_len = sizeof(struct termio);
cmd |= IOC_IN; cmd |= IOC_IN;
goto doit; goto do_strioctl;
#endif #endif
#ifdef TCGETS #ifdef TCGETS
case TCGETS: case TCGETS:
strioc.ic_len = sizeof(struct termios); strioc.ic_len = sizeof(struct termios);
cmd |= IOC_OUT; cmd |= IOC_OUT;
goto doit; goto do_strioctl;
#endif #endif
#ifdef TCGETA #ifdef TCGETA
case TCGETA: case TCGETA:
strioc.ic_len = sizeof(struct termio); strioc.ic_len = sizeof(struct termio);
cmd |= IOC_OUT; cmd |= IOC_OUT;
goto doit; goto do_strioctl;
#endif #endif
#ifdef UIOCTTSTAT #ifdef UIOCTTSTAT
case UIOCTTSTAT: case UIOCTTSTAT:
strioc.ic_len = 3; strioc.ic_len = 3;
cmd |= IOC_OUT; cmd |= IOC_OUT;
goto doit; goto do_strioctl;
#endif #endif
default: default:
strioc.ic_len = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; strioc.ic_len = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
doit:
goto do_strioctl; goto do_strioctl;
case I_STR: case I_STR:
@ -1667,7 +1668,10 @@ static void tstreams_close(struct tty_struct * tty, struct file * file)
} }
static int tstreams_write(struct tty_struct * tty, int fromuser, static int tstreams_write(struct tty_struct * tty, int fromuser,
const unsigned char *buf, int count) #if LINUX_VERSION_CODE >= 66304 /* 1.3.0 ?? */
const
#endif
unsigned char *buf, int count)
{ {
struct stream_header *p_stream = (struct stream_header *)tty->driver_data; struct stream_header *p_stream = (struct stream_header *)tty->driver_data;
@ -1749,12 +1753,10 @@ static int tstreams_ioctl(struct tty_struct *tty, struct file * file,
int err; int err;
struct stream_header *p_stream = (struct stream_header *)tty->driver_data; struct stream_header *p_stream = (struct stream_header *)tty->driver_data;
if(p_stream == NULL) if(p_stream == NULL)
return 0; return 0;
err = xstreams_ioctl(p_stream,cmd,arg); err = xstreams_ioctl(p_stream,cmd,arg);
if(err == -EINVAL)
err = -ENOIOCTLCMD;
return err; return err;
} }

View File

@ -13,9 +13,10 @@
#ifdef MODULE #ifdef MODULE
#include "f_module.h" #include "f_module.h"
#endif #endif
#include "kernel.h"
#include <linux/types.h> #include <linux/types.h>
#include <linux/stream.h> #include "stream.h"
#include <linux/errno.h> #include <linux/errno.h>
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/mm.h> #include <linux/mm.h>
@ -28,13 +29,11 @@
#else #else
unsigned long bh_mask; unsigned long bh_mask;
#endif #endif
#include "kernel.h"
#ifdef linux #ifdef linux
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/interrupt.h> #include <linux/interrupt.h>
#endif #endif
#include <linux/syscompat.h>
#ifdef SK_STREAM #ifdef SK_STREAM
#include <linux/skbuff.h> #include <linux/skbuff.h>
#endif #endif
@ -439,7 +438,7 @@ freemsg(mblk_t *p_msg)
if(p_msg == NULL) { if(p_msg == NULL) {
#ifdef CONFIG_DEBUG_STREAMS #ifdef CONFIG_DEBUG_STREAMS
printf("%sFreeing NULL msg at %s:%d\n",KERN_ERR ,deb_file,deb_line); printf("%sFreeing NULL msg at %s:%d\n",KERN_ERR , deb_file,deb_line);
#endif #endif
return; return;
} }

View File

@ -10,7 +10,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
/* #include <sys/user.h> */ /* #include <sys/user.h> */
#include <sys/errno.h> #include <sys/errno.h>
#include "streamlib.h" #include "streamlib.h"

View File

@ -1,6 +1,6 @@
#include "primitives.h" #include "primitives.h"
#include "f_ioctl.h" #include "f_ioctl.h"
#include <sys/stropts.h> #include "stropts.h"
#include <sys/errno.h> #include <sys/errno.h>
#ifdef linux #ifdef linux
#include <linux/ioctl.h> #include <linux/ioctl.h>

View File

@ -3,7 +3,7 @@
#include <sys/file.h> #include <sys/file.h>
#include <sys/errno.h> #include <sys/errno.h>
#include "f_signal.h" #include "f_signal.h"
#include <sys/stropts.h> #include "stropts.h"
#include "f_termio.h" #include "f_termio.h"
#include "f_user.h" #include "f_user.h"
#include <sys/uio.h> #include <sys/uio.h>

View File

@ -11,7 +11,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -11,7 +11,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -7,7 +7,7 @@
# Sample answering machine. # Sample answering machine.
# It answers on EAZ 2 (1TR6) bzw. MSN ...2 (Euro). # It answers on EAZ 2 (1TR6) bzw. MSN ...2 (Euro).
R phone * * * <username> RM.3 catfone R phone * * * <username> mRM.3 catfone
## This number ---^ is the delay before the answerer answers. ## This number ---^ is the delay before the answerer answers.
## Warning: You have to adapt the catfone script to your requirements. ## Warning: You have to adapt the catfone script to your requirements.
@ -20,7 +20,7 @@ ML phone * * * - transalaw alaw
# Sample remote login. # Sample remote login.
# Logins from "somebody" are only accepted if their number ends in 8. # Logins from "somebody" are only accepted if their number ends in 8.
R login * * * root TSRUDi /bin/login R login * * * root mTSRUDi /bin/login
P login somebody * * R :nr .8 P login somebody * * R :nr .8
P login * * * MFX :lr /1 :vB 8890 :sv 0700 P login * * * MFX :lr /1 :vB 8890 :sv 0700

View File

@ -20,9 +20,6 @@ cd bin-$(uname -r) || cd bin
set +e set +e
while : ; do while : ; do
master -wdi /etc/isdn.conf >>/tmp/isdn.log 2>>/var/log/isdn master -wdi /etc/isdn.conf 2>>/tmp/isdn.log >>/var/log/isdn
sleep 15 sleep 15
done & done &
if test -x /etc/isdn.route ; then
/etc/isdn.route
fi

View File

@ -15,7 +15,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -11,7 +11,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/stropts.h> #include "stropts.h"
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif

View File

@ -18,7 +18,6 @@
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include "streams.h" #include "streams.h"
#include <sys/errno.h> #include <sys/errno.h>
/* #include <sys/stropts.h> */
#ifdef DONT_ADDERROR #ifdef DONT_ADDERROR
#include "f_user.h" #include "f_user.h"
#endif #endif