This commit is contained in:
Matthias Urlichs 1997-06-04 06:45:55 +02:00 committed by Harald Welte
parent 75b6ca7f79
commit 7ccfe6b7e6
40 changed files with 386 additions and 312 deletions

93
DOKU
View File

@ -3,7 +3,7 @@ Basiert auf Linuxkernel 2.0.8.
Dies ist eine Betaversion.
Dieses Programmpaket ist (c) 1994,1995 Matthias Urlichs <urlichs@noris.de>.
Dieses Programmpaket ist (c) 1994-1997 Matthias Urlichs <urlichs@noris.de>.
Es darf ohne meine Zustimmung _nicht_ weitergegeben werden. Kommerzielle
Verwertung jedweder Art bedarf meiner Zustimmung. Das Anbieten auf
FTP-Servern, in Mailboxen, etc.pp. ist ohne meine Zustimmung nicht
@ -32,55 +32,18 @@ Es gibt eine Mailingliste zum Thema: linux-isdn@uranus.central.de.
linux-isdn-request@uranus.central.de.
Version 14: Die CL- und DL-Zeilen haben sich geändert (erweitert um
<Key>-Parameter). Intelligente Karten funktionieren NOCH NICHT.
Änderungen Version 45
---------------------
In der Version 11 lagen noch ein paar .depend-Dateien und anderer Kram rum,
die den Buildprozeß gestört haben. Abhilfe: "make clean".
Die ISDN-Modulliste steht jetzt nicht mehr in /lib/modules/modules.isdn
oder so, sondern wird mit MOD-Zeilen in die /etc/isdn.conf-Datei geschrieben.
Umsetzung (so ähnlich):
# sed -e 's/isdn./MOD /' < /lib/modules/modules.isdn >> /etc/isdn.conf
Die volle Liste findet sich in modules.isdn (im Hauptverzeichnis der
Sourcen, nach dem Installieren), nicht in /lib/modules/modules.isdn.all.
Mit der Version 11 ist das OK am Ende des statischen Teils der AT/L-Ausgabe
weggefallen, weil das zu viele Leute irritiert hat. (Schließlich folgt noch
was nach.)
Mit der Version 11 hat sich die Installationsprozedur fuer ISDN-Karten
geaendert. Vorher: Config.c editieren, Modul bauen. Jetzt: d_teles.o
laden, dann fuer jede Karte "insmod teles.o -o Tel0 name=$(cardname Tel0)
mem=0xD6000 irq=5" ausfuehren. Daten anpassen! Unterschiedliche Namen
verwenden! Das rc-Skript in tools/ wurde entsprechend angepasst.
16-Bit-Karten: Zusaetzlich "ipl=X" (X=1..3) fuer die erste bis dritte Karte.
Damit sollte es problemlos sein, zwischen verschiedenen Systemen (mit
einigermaßen identisch konfigurierten Kernels) die Treiber auszutauschen.
Mit der Version für 1.2.0 hat sich die Syntax der cf-Datei leicht geändert:
Der :ea-Parameter in der P-Zeile wurde durch den :lr-Parameter ersetzt:
- verwende ":lr /X" statt ":ea X".
- hänge an die DL-Zeile an die Nummer einen / an und danach ":pr 0 :sp 65
:pr 63" für 1TR6 oder :sp 8 für Euro-ISDN.
Generell steht nun "/" für EAZs und so; "." steht für Nebenstellennummern.
Bei externen Nummern verwende ich generell ".", aber das ist
Geschmackssache.
Einige Konfigzeilen haben als zusätzlichen Parameter das ISDN-Interface
verpaßt bekommen.
Die Parameter :pr und :sp stehen nun in der DL-Zeile und nicht mehr in
der P-Zeile.
Die I- und O-Flags werden nun klein geschrieben.
Die Verzögerung beim Auflegen (ML-Zeile) wird nun mit einem Komma an die
Flags angehängt anstatt als Extraparameter.
Einen leicht genervten Dank an den einen von ca. 30 Leuten, die den Fehler
in der letzten DOKU-Ausgabe nicht nur bemerkt haben, sondern der sogar auf
die unheimlich neuartige Idee gekommen ist, mir eine entsprechende Mail zu
schreiben. (You know who you are.) Und zwar nicht eine Mail "Du da paßt
was nicht zusammen, ey boah ey", sondern sogar mit der anscheinend (wenn
ich mir die anderen Mails so ansehe) absolut unnötigen Info, _was_ nicht
stimmt. Echt goil ey.
rc.isdnmon schreibt nach /var/log/acct/ip.isdn.
Geldmangel
@ -157,9 +120,10 @@ Linux. GCC 2.7.2, Libraries 5.0.9, oder neuere (Testumgebung: Libraries
Passive ISDN-Karte mit Hardware-Doku, oder Teles-8 oder -16 / Creatix.
Support fuer BSC- und AVM A1-Karten ist in Vorbereitung, Source liegt bei,
funktioniert aber noch nicht so ganz (BSC: B-Kanäle; beide: Interrupts?) --
wer kann und will, möge sich dransetzen. Die neuen PnP-Creatix unterstütze
ich auch noch nicht, weil PnP-Support für Linux erst unter 2.1 kommt und
ich keinerlei Bock habe, das Rad neu zu erfinden.
wer kann und will, möge sich dransetzen.
Support für Teles S0/16.3 und Creatix PNP ist seit neuesten auch dabei;
Dank an Peter Brückner.
Kernelpatches
@ -287,18 +251,23 @@ make.isdn
# Nun als Superuser:
make.isdn
# oder einfach "make install".
### Editiere /lib/modules/modules.isdn (die automatisch erzeugte Version
### steht in /lib/modules/modules.isdn.all:
isdn/teles.o -o Tel0 name=$(cardname Tel0) mem=0xD6000 irq=5 ipl=1
anstatt
isdn/teles.o
eintragen. Näheres siehe "Treiberparameter" weiter unten.
cd /usr/local/isdn/bin-Kernelversion # also zB .../bin-1.3.29
vi /etc/isdn.conf # ISDN-Nummern, Dienste, etc. eintragen
# MOD-Zeilen anpassen Insbesondere
MOD teles -o Tel0 name=$(cardname Tel0) mem=0xD6000 irq=5 ipl=1
anstatt
MOD teles
(zum Beispiel)
/etc/rc.d/rc.isdn # geht automatisch in den Hintergrund
### oder
/sbin/init.d/uisdn start
### .. je nach installierter Distribution
# Wenn das alles funktioniert, rc.isdn via rc.local starten.
Sämtliche Gerätedateien werden automatisch angelegt.
Sämtliche Gerätedateien werden automatisch angelegt; die Zuordnung zu
Gerätenummern erfolgt dynamisch.
Probleme bei der Installation
--------
@ -335,9 +304,9 @@ 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.
Stattdessen müssen die entsprechenden Daten in /etc/isdn.conf 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
@ -1167,9 +1136,10 @@ Mod:
nach n Sekunden der Verbindungsaufbau wieder erlaubt. (Noch nicht
implementiert)
$ Die Befehlszeile wird nicht direkt ausgeführt, sondern der Shell übergeben.
B Die Verbindung wird beim Hochfahren des Managers automatisch aufgebaut.
D /dev/ttyiXX wird angelegt und nach Programmende gelöscht.
E Beim Auftreten eines Fehlers wird dieses Programm deaktiviert.
(Reaktivieren: AT/R.)
D /dev/ttyiXX wird angelegt und nach Programmende gelöscht.
F Das Programm wird sofort gestartet, und die Verbindung wird aufgebaut.
Interessant insbesondere bei Festverbindungen und SPVs.
L nur der angegebene Benutzer kann die Verbindung aktivieren.
@ -1178,7 +1148,8 @@ R kein Dialout via ATD m
S stderr des Programms liegt auf ISDN (sonst: stderr des Treiberprogramms)
T Verbindung im Terminalmodus (ankommend, also zB beim Start von /bin/login).
U ein Eintrag in /etc/utmp wird angelegt (wichtig zB für login).
B Die Verbindung wird beim Hochfahren des Managers automatisch aufgebaut.
X der Verbindungsaufbau wird erst vollendet, wenn FD 3 geschlossen wird
(Fehlercode, wenn ein Zeichen kommt).
i für ankommende Verbindungen
o für abgehende Verbindungen
f für Festverbindungen. "B" wird hier normalerweise ebenfalls angegeben.

View File

@ -28,7 +28,7 @@ else
## =()<CC = @<HOSTCC>@>()=
CC = gcc
## =()<CFLAGS = @<HOSTCFLAGS>@ >()=
CFLAGS = -g -O2 -Wall
CFLAGS = -g -O2 -Wall -D_GNU_SOURCE
## =()<LIBS = @<LIBS>@>()=
LIBS = -lbsd-compat
endif

View File

@ -2,7 +2,7 @@ all::
DOCARDS=1
REALSOURCE=shell.c
SOURCES=avm.c ncp.c teles.c ncp16.c bsc.c teles3.c
SOURCES=avm.c ncp.c teles.c ncp16.c bsc.c teles3.c creatixpnp.c
TOPDIR=../..
include $(TOPDIR)/Make.rules

View File

@ -50,7 +50,7 @@
#define HSCX_R_FIFO_SIZE 32
#define HSCX_W_FIFO_SIZE 32
#ifdef _teles3_
#if defined(_teles3_) || defined(_creatixpnp_)
#define FIFO(x) Fifo
#else
#define FIFO(x) fifo[0] /* forget the address -- WARNING: side effects of x get lost */
@ -147,7 +147,7 @@ typedef struct _hscx {
#define ByteInHSCX(_dumb,_hcr,_what) InHSCX((_dumb),(_hcr),offsetof(struct _hscx,r._what))
#define ByteOutHSCX(_dumb,_hcr,_what,_data) OutHSCX((_dumb),(_hcr),offsetof(struct _hscx,w._what),(_data))
#ifdef linux
#ifdef __linux__
#define SetSPL(x) spl(1)
#else
#define SetSPL(x) spl((x))
@ -178,6 +178,10 @@ typedef struct _hscx {
#include "teles3_io.c"
#endif
#ifdef _creatixpnp_
#include "creatixpnp_io.c"
#endif
#define DUMBTIME 300 /* poll: times per second */

View File

@ -1,8 +1,16 @@
#include <linux/delay.h>
inline static void
PostIRQ(struct _dumb * dumb)
{
}
/*
* Die Offsets sind alle +20 wegen der FIFO, deshalb wird überall 0x20
* "zuviel" abgezogen.
*/
inline static Byte
InISAC(struct _dumb * dumb, char offset) {
return ByteIn(dumb->info.ioaddr-0x420+offset);
@ -11,140 +19,119 @@ inline static void
OutISAC(struct _dumb * dumb, char offset, Byte data) {
ByteOut(dumb->info.ioaddr-0x420+offset,data);
}
inline static Byte
InHSCX(struct _dumb * dumb, unsigned char hscx, char offset) {
return ByteIn(dumb->info.ioaddr+offset-((hscx&1)?0x820:0xC20));
return ByteIn(dumb->info.ioaddr+offset-((hscx&1)?0xC20:0x820));
}
inline static void
OutHSCX(struct _dumb * dumb, unsigned char hscx, char offset, Byte what) {
ByteOut(dumb->info.ioaddr+offset-((hscx&1)?0x820:0xC20),what);
ByteOut(dumb->info.ioaddr+offset-((hscx&1)?0xC20:0x820),what);
}
inline static Byte
Slot(struct _dumb * dumb, unsigned char hscx) {
printf(" Slot %d: ",hscx);
return (hscx&1) ? 0x07 : 0x03;
return (hscx&1) ? 0x2f : 0x03;
}
static int
Init(struct _dumb * dumb) {
int timout;
long flags;
if(dumb->info.ioaddr == 0)
return -EINVAL;
Byte cfval;
long flags;
long timout;
if(dumb->info.ioaddr == 0) return -EINVAL;
dumb->numHSCX = 2;
save_flags(flags);
if(dumb->info.ipl) {
Byte cfval;
switch(dumb->info.irq) {
default: printk("irq %d not possible: ",dumb->info.irq); return -EINVAL;
case 2: cfval = 0x00; break;
case 3: cfval = 0x02; break;
case 4: cfval = 0x04; break;
case 5: cfval = 0x06; break;
case 10: cfval = 0x08; break;
case 11: cfval = 0x0A; break;
case 12: cfval = 0x0C; break;
case 15: cfval = 0x0E; break;
}
if(ByteIn(dumb->info.ioaddr+0) != 0x51) { return -EINVAL; }
if(ByteIn(dumb->info.ioaddr+1) != 0x93) { return -EINVAL; }
if((ByteIn(dumb->info.ioaddr+2) & 0xFC) != 0x1C) { return -EINVAL; }
timout = jiffies+(HZ/10)+1;
ByteOut(dumb->info.ioaddr+4,cfval);
sti();
while(jiffies <= timout) ;
ByteOut(dumb->info.ioaddr+4,cfval|1);
timout = jiffies+(HZ/10)+1;
while(jiffies <= timout) ;
restore_flags(flags);
switch(dumb->info.irq) {
default: printk("irq %d not possible: ",dumb->info.irq); return -EINVAL;
case 9:
case 2: cfval = 0x00; break;
case 5: cfval = 0x06; break;
case 10: cfval = 0x08; break;
case 12: cfval = 0x0C; break;
case 15: cfval = 0x0E; break;
}
#if 0
timout = jiffies+(HZ/5)+1;
*(Byte *)(dumb->info.memaddr + 0x80) = 0;
if(ByteIn(dumb->info.ioaddr+0) != 0x51) { return -EINVAL; }
if(ByteIn(dumb->info.ioaddr+1) != 0x93) { return -EINVAL; }
if((ByteIn(dumb->info.ioaddr+2) & 0xFC) != 0x1C) { return -EINVAL; }
save_flags(flags);
sti();
while(jiffies <= timout) ;
*(Byte *)(dumb->info.memaddr + 0x80) = 1;
timout = jiffies+(HZ/5)+1;
while(jiffies <= timout) ;
#endif
ByteOut(dumb->info.ioaddr+4,cfval);
timout=jiffies+(HZ/10+1);
while(jiffies<timout);
ByteOut(dumb->info.ioaddr+4,cfval|1);
timout=jiffies+(HZ/10+1);
printf("%steles3:HSCX0:%d HSCX1:%d ISAC:%d\n",KERN_INFO,
ByteInHSCX(dumb,0,VSTR) &0xf,ByteInHSCX(dumb,1,VSTR) &0xf,ByteInISAC(dumb,RBCH));
restore_flags(flags);
return 0;
}
static void
InitISAC(struct _dumb * dumb)
{
dumb->chan[0].mode = M_OFF;
dumb->chan[0].listen = 0;
ByteOutISAC(dumb, MASK, 0xFF);
ByteOutISAC(dumb, ADF2, 0x80);
ByteOutISAC(dumb, SQXR, 0x2F);
ByteOutISAC(dumb, SPCR, 0x00);
ByteOutISAC(dumb, ADF1, 0x02);
ByteOutISAC(dumb, STCR, 0x70);
ByteOutISAC(dumb, MODE, 0xC3);
ByteOutISAC(dumb, MODE, 0xC9);
ByteOutISAC(dumb, TIMR, 0x00);
ByteOutISAC(dumb, ADF1, 0x00);
ByteOutISAC(dumb, CMDR, 0x41);
ByteOutISAC(dumb, CIX0, 0x03);
ByteOutISAC(dumb, CIX0, 0x07);
ByteOutISAC(dumb, MASK, 0xFF);
ByteOutISAC(dumb, MASK, 0x00);
}
static void
InitHSCX_(struct _dumb * dumb, unsigned char hscx)
{
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,CCR1, 0x85);
ByteOutHSCX(dumb,hscx,XAD1, 0xFF);
ByteOutHSCX(dumb,hscx,XAD2, 0xFF);
ByteOutHSCX(dumb,hscx,RAH2, 0xFF);
ByteOutHSCX(dumb,hscx,XBCH, 0);
ByteOutHSCX(dumb,hscx,RLCR, 0);
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
ByteOutHSCX(dumb,hscx,TSAX, 0xFF);
ByteOutHSCX(dumb,hscx,TSAR, 0xFF);
ByteOutHSCX(dumb,hscx,XCCR, 7);
ByteOutHSCX(dumb,hscx,RCCR, 7);
ByteOutHSCX(dumb,hscx,MODE, 0x06);
ByteOutHSCX(dumb,hscx,CCR1, 0x85); /* 0x85 */
ByteOutHSCX(dumb,hscx,CCR2, 0x32); /* 0x38 */
ByteOutHSCX(dumb,hscx,XAD1, 0x01);
ByteOutHSCX(dumb,hscx,XAD2, 0x03);
ByteOutHSCX(dumb,hscx,RAL1, 0x03);
ByteOutHSCX(dumb,hscx,RAL2, 0x01);
ByteOutHSCX(dumb,hscx,RAH1, 0);
ByteOutHSCX(dumb,hscx,RAH2, 0);
#if 0
ByteOutHSCX(dumb,hscx,TIMR, 0x70);
#endif
ByteOutHSCX(dumb,hscx,RLCR, 0x00);
ByteOutHSCX(dumb,hscx,MODE, 0x84);
ByteOutHSCX(dumb,hscx,MASK, 0x00);
}
static int
HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
{
unsigned long ms = SetSPL(dumb->info.ipl);
unsigned long ms = SetSPL(1);
if(dumb->chan[hscx].m_in != NULL) {
freemsg(dumb->chan[hscx].m_in);
dumb->chan[hscx].m_in = dumb->chan[hscx].m_in_run = NULL;
}
if(dumb->chan[hscx].m_out != NULL) {
freemsg(dumb->chan[hscx].m_out);
dumb->chan[hscx].m_out = dumb->chan[hscx].m_out_run = NULL;
}
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,XCCR, 7);
ByteOutHSCX(dumb,hscx,RCCR, 7);
ByteOutHSCX(dumb,hscx,CCR1, 0x05);
}
if(dumb->chan[hscx].m_out != NULL) {
freemsg(dumb->chan[hscx].m_out);
dumb->chan[hscx].m_out = dumb->chan[hscx].m_out_run = NULL;
}
ByteOutHSCX(dumb,hscx,CCR1, 0x85);
ByteOutHSCX(dumb,hscx,XAD1, 0xFF);
ByteOutHSCX(dumb,hscx,XAD2, 0xFF);
ByteOutHSCX(dumb,hscx,RAH2, 0xFF);
ByteOutHSCX(dumb,hscx,XBCH, 0);
ByteOutHSCX(dumb,hscx,RLCR, 0);
switch(mode) {
case M_OFF:
case M_STANDBY:
ByteOutHSCX(dumb,hscx,MASK, 0x00);
ByteOutHSCX(dumb,hscx,MODE, 0x96);
ByteOutHSCX(dumb,hscx,XAD1, 0xFF);
ByteOutHSCX(dumb,hscx,XAD2, 0xFF);
ByteOutHSCX(dumb,hscx,RAH2, 0xFF);
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
ByteOutHSCX(dumb,hscx,TSAX, 0xFF);
ByteOutHSCX(dumb,hscx,TSAR, 0xFF);
ByteOutHSCX(dumb,hscx,XCCR, 0x07);
ByteOutHSCX(dumb,hscx,RCCR, 0x07);
ByteOutHSCX(dumb,hscx,MODE, 0x84);
dumb->chan[hscx].mode = mode;
dumb->chan[hscx].locked = 0;
dumb->chan[hscx].listen = listen;
@ -153,7 +140,12 @@ HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
case M_TRANS_ALAW:
case M_TRANS_V110:
case M_TRANSPARENT:
ByteOutHSCX(dumb,hscx,MODE, 0xE6);
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,XCCR, 0x07);
ByteOutHSCX(dumb,hscx,RCCR, 0x07);
ByteOutHSCX(dumb,hscx,MODE, 0xE4);
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
ByteOutHSCX(dumb,hscx,MASK, 0x00);
dumb->chan[hscx].mode = mode;
@ -164,13 +156,29 @@ HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
ByteOutHSCX(dumb,hscx,CCR2, 0x02);
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx)+1);
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx)+1);
/* FALL THRU */
case M_HDLC_7L:
ByteOutHSCX(dumb,hscx,XCCR, 6);
ByteOutHSCX(dumb,hscx,RCCR, 6);
/* FALL THRU */
ByteOutHSCX(dumb,hscx,MODE, 0x8C);
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
ByteOutHSCX(dumb,hscx,MASK, 0x00);
break;
case M_HDLC_7L:
ByteOutHSCX(dumb,hscx,CCR2, 0x02);
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,XCCR, 6);
ByteOutHSCX(dumb,hscx,RCCR, 6);
ByteOutHSCX(dumb,hscx,MODE, 0x8C);
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
ByteOutHSCX(dumb,hscx,MASK, 0x00);
break;
case M_HDLC:
ByteOutHSCX(dumb,hscx,MODE, 0x8E);
ByteOutHSCX(dumb,hscx,CCR2, 0x30);
ByteOutHSCX(dumb,hscx,TSAX, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,TSAR, Slot(dumb,hscx));
ByteOutHSCX(dumb,hscx,XCCR, 0x07);
ByteOutHSCX(dumb,hscx,RCCR, 0x07);
ByteOutHSCX(dumb,hscx,MODE, 0x8C);
ByteOutHSCX(dumb,hscx,CMDR, 0x41);
ByteOutHSCX(dumb,hscx,MASK, 0x00);
dumb->chan[hscx].mode = mode;
@ -186,3 +194,4 @@ HSCX_mode(struct _dumb * dumb, unsigned char hscx, Byte mode, Byte listen)
splx(ms);
return 0;
}

View File

@ -1,5 +1,5 @@
#! /bin/sh
## $Revision: 1.1 $
## $Revision: 1.1.1.1 $
##
## Check the config.data file to make sure there is a tab on every
## non-comment line.

View File

@ -35,7 +35,7 @@ ROUTE_PATH /sbin/route
##
##
##
## Card drivers to install. teles bintec.
## Card drivers to install. teles bintec teles3 creatixpnp.
##
#### =()<CARDS @<CARDS>@>()=
CARDS teles
@ -89,7 +89,7 @@ CFLAGS -g -O2 -Wall -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE
## C flags for programs
##
#### =()<HOSTCFLAGS @<HOSTCFLAGS>@>()=
HOSTCFLAGS -g -O2 -Wall
HOSTCFLAGS -g -O2 -Wall -D_GNU_SOURCE
#CFLAGS -x c++ -g -O2 -W -Wreturn-type -Wshadow -Wcomment
#CFLAGS -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
##

View File

@ -1,6 +1,6 @@
/* This is from INN. */
/* $Revision: 1.1.1.1 $
/* $Revision: 1.2 $
**
** A C version of Henry Spencer's "subst" script.
*/

View File

@ -20,5 +20,7 @@ $(KERNELSRC)/include/linux/autoconf.h $(KERNELSRC)/include/linux/version.h:
install::
-mkdir -p $${MODDIR:-/lib/modules}/$(shell ../tools/getversion)/isdn
-mkdir -p $(DESTDIR)/bin-$(shell ../tools/getversion)
cp /dev/null /lib/modules/modules.isdn.all
cp /dev/null ../modules.isdn
clean::
rm -f ../modules.isdn

View File

@ -87,4 +87,7 @@ extern int writev(int fd, struct iovec *vp, int vpcount);
/* =()<#define ROOTUSER "@<ROOT>@">()= */
#define ROOTUSER "smurf"
/* =()<#define @<GARBAGE>@_COLLECT>()= */
#define DONT_COLLECT
#endif /* _CONFIG_H */

View File

@ -9,7 +9,13 @@
#define _IOWR(a,b,c) _IOSWR((a),(b),(c))
#endif
#if defined(AUX) || defined(linux)
#ifdef linux
#ifdef KERNEL
#include <linux/ioctl.h>
#else
#include <sys/ioctl.h>
#endif
#else
#include <sys/ioctl.h>
#endif

View File

@ -4,7 +4,7 @@
#define INET
#include "primitives.h"
#if defined(linux) && !defined(CONFIG_INET_BSD)
#if defined(linux) && (defined(KERNEL) || (__GNU_LIBRARY__-0 < 6))
/* If somebody could please reboot the person responsible for this.
Start over. It avoids a big whole lot of hassle for us all. Thanks. */
@ -49,7 +49,6 @@
#define icmp_code code
#define icmp_cksum checksum
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/icmp.h>
@ -70,13 +69,17 @@
#include <sys/protosw.h>
#endif
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#ifndef __linux__
#include <netinet/in_var.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#endif
#define THFLAG(a) (a)->th_flags
#ifndef linux
#define SOCK_HAS_LEN /* socket has sa_len field */
#endif
#endif /* F_DONE */
#endif /* _F_IP */

View File

@ -6,6 +6,11 @@
#include <linux/signal.h>
#else
#include <signal.h>
#if __GNU_LIBRARY__ -0 < 6
#define bsd_signal(a,b) signal((a),(b))
#endif
#endif
#ifdef SYSV_SIGTYPE
@ -33,7 +38,7 @@
#else
#define SIG_SUSPEND(_var,_sig) do { (_var).__sign = _sig; (_var).__sig = signal(_sig,SIG_IGN); } while(0)
#endif
#define SIG_RESUME(_var) do { (void) signal((_var).__sign, (_var).__sig); } while(0)
#define SIG_RESUME(_var) do { (void) bsd_signal((_var).__sign, (_var).__sig); } while(0)
#endif

View File

@ -1,2 +1,6 @@
#ifdef KERNEL
#include <linux/termios.h>
#else
/* =()<#include <@<TERMIO>@.h>>()= */
#include <termios.h>
#endif

View File

@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ppp.h,v 1.3 1993/11/10 01:34:27 paulus Exp $
* $Id: ppp.h,v 1.1.1.2 1996/07/29 08:45:23 smurf Exp $
*/
#ifndef __PPP_H__

View File

@ -2,11 +2,7 @@
#define __IP_MON
#include "primitives.h"
#include <netinet/in.h>
#ifndef linux
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#endif
#include "f_ip.h"
#define IP_MON_TIMEOUT CHAR2('t','o')
#define IP_MON_EACHPACKET CHAR2('p','a')

View File

@ -6,12 +6,7 @@
#include <errno.h>
#include "f_strings.h"
#include <syslog.h>
#if __GNU_LIBRARY__ - 0 < 6
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <f_ip.h>
#include <netdb.h>
#include <stdio.h>
#include <ctype.h>
@ -20,9 +15,6 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef linux
#include <linux/fs.h>
#endif
#include <sys/uio.h>
#if 0
@ -190,7 +182,7 @@ int main (int argc, char *argv[])
syslog(LOG_CRIT, "No IP monitor driver found!");
else {
unlink(IP_MON_NAME);
mknod (IP_MON_NAME, S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(monitordev,0));
mknod (IP_MON_NAME, S_IFCHR | S_IRUSR | S_IWUSR, makedev(monitordev,0));
syslog(LOG_DEBUG,"ISDN: monitor: major number %d\n",monitordev);
}
}

View File

@ -1,5 +1,5 @@
PROGRAM = master
EXTRA_LIBS=../isdn_3.a ../support.a
EXTRA_LIBS=../isdn_3.a ../support.a
EXTRA_CFLAGS=$(addsuffix _,$(addprefix -D_,$(PROTOCOLS) $(SUBPROTOCOLS)))
#EXTRA_LDFLAGS=-static

View File

@ -46,7 +46,7 @@ read_line (FILE * ffile, int *theLine)
if (sofar == line || remain <= 3 || now == 0)
return NULL;
*sofar = '\0';
out = (struct _cf *)xmalloc (sizeof (struct _cf) + (now = sofar - line + 1));
out = (struct _cf *)gxmalloc (sizeof (struct _cf) + (now = sofar - line + 1));
bcopy (line, (char *) (out + 1), now);
bzero ((char *) out, sizeof (struct _cf));
@ -381,7 +381,7 @@ read_file (FILE * ffile, char *errf)
continue;
}
syslog (LOG_ERR, "Bad line %s:%d: %s", errf, errl, (char *) (c + 1));
free (c);
gfree (c);
}
return;
}
@ -402,7 +402,7 @@ read_args (void *nix)
conngrab cg;
cf cft;
#define CFREE(what) do { while(what != NULL) { cf cf2 = what->next;free(what);what = cf2; } } while(0)
#define CFREE(what) do { while(what != NULL) { cf cf2 = what->next;gfree(what);what = cf2; } } while(0)
CFREE (cf_P);
CFREE (cf_ML);
CFREE (cf_MP);
@ -470,7 +470,7 @@ read_args (void *nix)
#endif
timeout(read_args_run,NULL,nexttime * HZ);
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
char causeInfo[100];
bzero(conn,sizeof(*conn));

View File

@ -16,9 +16,10 @@ Xnewgrab(conngrab master, int lin)
{
conngrab slave;
slave = xmalloc(sizeof(*slave));
slave = gcxmalloc(sizeof(*slave));
if(slave == NULL)
return NULL;
GrabAllocs++;
if(master == NULL) {
bzero(slave,sizeof(*slave));
slave->cclass = "*";
@ -47,6 +48,7 @@ Xdropgrab(conngrab cg,int lin)
if(--cg->refs == 0) {
chkone(cg);
GrabFrees++;
if(cg->par_out != NULL)
freemsg(cg->par_out);
if(cg->par_in != NULL)
@ -58,7 +60,7 @@ Xdropgrab(conngrab cg,int lin)
cg->cclass = (void *)0xdeadbeef;
cg->card = (void *)0xdeadbeef;
chkone(cg);
free(cg);
gfree(cg);
return;
}
}
@ -98,8 +100,8 @@ connreport(char *foo, char *card, int minor)
if(conn->lastMsg != NULL && !strcmp(conn->lastMsg,foo))
continue;
if(conn->lastMsg != NULL)
free(conn->lastMsg);
conn->lastMsg = xmalloc(strlen(foo)+1);
gfree(conn->lastMsg);
conn->lastMsg = gbxmalloc(strlen(foo)+1);
if(conn->lastMsg != NULL)
strcpy(conn->lastMsg,foo);
@ -326,7 +328,7 @@ Xsetconnstate(const char *deb_file, unsigned int deb_line,conninfo conn, CState
}
if(conn->state > c_forceoff && state <= c_forceoff && conn->pid != 0) {
struct conninfo *xconn;
xconn = xmalloc(sizeof(*xconn));
xconn = gcxmalloc(sizeof(*xconn));
if(xconn != NULL) {
bzero(xconn,sizeof(*xconn));
xconn->seqnum = ++connseq;
@ -437,8 +439,8 @@ Xdropconn (struct conninfo *conn, const char *deb_file, unsigned int deb_line)
printf("Drop %p %s:%d\n",conn,deb_file,deb_line);
dropgrab(conn->cg);
if(conn->lastMsg != NULL)
free(conn->lastMsg);
free(conn);
gfree(conn->lastMsg);
gfree(conn);
}

View File

@ -124,7 +124,7 @@ lockdev(int dev, char onefailok)
char pidnum[7];
int f, err, len;
len = sprintf(pidnum,"%d\n",getpid());
len = sprintf(pidnum,"%d",getpid());
sprintf(vartt,LOCKNAME,pidnum);
sprintf(permtt1,LOCKNAME,mdevname(dev));
sprintf(permtt2,LOCKNAME,isdevname(dev));

View File

@ -414,7 +414,7 @@ do_card(void)
if (!strcmp(card->name, crd))
return -EEXIST;
}
card = xmalloc(sizeof(*card));
card = gcxmalloc(sizeof(*card));
if(card == NULL)
return -ENOMEM;
bzero(card,sizeof(*card));
@ -426,7 +426,7 @@ do_card(void)
card->next = isdn4_card; isdn4_card = card;
if(cardcap & CHM_INTELLIGENT) {
ld = xmalloc(sizeof(struct loader));
ld = gcxmalloc(sizeof(struct loader));
if(ld == NULL)
return -errno;
bzero(ld,sizeof(*ld));
@ -476,7 +476,7 @@ do_card(void)
(void) strwritev (xs_mon, io,len, 1);
}
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -517,7 +517,7 @@ do_nocard(void)
break;
}
}
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -551,7 +551,7 @@ do_offcard(void)
if (!strcmp(card->name, crd))
card->is_down = 1;
}
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -578,7 +578,7 @@ do_recard(void)
if (!strcmp(card->name, crd))
card->is_down = 0;
}
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -833,7 +833,7 @@ do_incoming(void)
conn->want_fast_reconn = 1;
}
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -876,7 +876,7 @@ do_incoming(void)
cg->refs++; dropgrab(conn->cg); conn->cg = cg;
ReportConn(conn);
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -895,7 +895,7 @@ do_incoming(void)
startconn(cg,fminor,connref,&resp, NULL);
if(resp != NULL) {
printf("OhNo %s\n",resp);
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -917,7 +917,7 @@ do_incoming(void)
/* At this point we don't have a connection. The call is valid, so
record the thing and start the program for it. */
conn = (struct conninfo *)xmalloc (sizeof (struct conninfo));
conn = (struct conninfo *)gcxmalloc (sizeof (struct conninfo));
if (conn == NULL) {
resp = "NO MEMORY.5";
@ -1000,7 +1000,7 @@ do_incoming(void)
DUMPW (ans, xlen);
(void) strwrite (xs_mon, ans, xlen, 1);
}
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -1283,11 +1283,12 @@ do_close(void)
bzero (&ut, sizeof (ut));
strncpy (ut.ut_id, sdevname (minor), sizeof (ut.ut_id));
strncpy (ut.ut_line, mdevname (minor), sizeof (ut.ut_line));
ut.ut_pid = getpid ();
ut.ut_type = DEAD_PROCESS;
ut.ut_time = time(NULL);
if (getutline (&ut) != 0) {
int wf = open ("/etc/wtmp", O_WRONLY | O_APPEND);
int wf;
ut.ut_pid = getpid ();
ut.ut_type = DEAD_PROCESS;
ut.ut_time = time(NULL);
wf = open ("/etc/wtmp", O_WRONLY | O_APPEND);
if (wf >= 0) {
(void) write (wf, &ut, sizeof (ut));
@ -1804,9 +1805,9 @@ do_atcmd(void)
struct conninfo *fconn;
char buf[30];
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn == NULL) {
free(msgbuf);
gfree(msgbuf);
resp = "NoMem";
return 1;
}
@ -1865,7 +1866,7 @@ do_atcmd(void)
case 'W': /* Monitor D channels */
{
char buf[30];
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn == NULL) {
resp = "NoMemConn";
return 1;
@ -1910,7 +1911,7 @@ do_atcmd(void)
#if LEVEL < 4
extern int l3print(char *);
#endif
msgbuf = xmalloc(10240);
msgbuf = gbxmalloc(10240);
if(msgbuf == NULL) {
resp = "NO MEMORY.6";
return 1;
@ -2119,7 +2120,7 @@ do_atcmd(void)
m2 = NULL;
m3 = NULL;
}
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn == NULL) {
dropgrab(cg);
resp = "NoMemConn";
@ -2282,7 +2283,7 @@ printf("GotAnError: Minor %ld, connref %ld, hdr %s\n",minor,connref,HdrName(hdrv
if(strchr(cfr->type,'E'))
cfr->got_err = 1;
xconn = xmalloc(sizeof(*xconn));
xconn = gcxmalloc(sizeof(*xconn));
if(xconn != NULL) {
bzero(xconn,sizeof(*xconn));
xconn->seqnum = ++connseq;
@ -2477,7 +2478,7 @@ do_noerror(void)
(void) strwrite (xs_mon, ans, xlen, 1);
}
if(msgbuf != NULL && resp == msgbuf)
free(msgbuf);
gfree(msgbuf);
return;
}
if(ret < 0 || ret == 2)

View File

@ -34,7 +34,7 @@ card_load_close(struct loader *ld, char success)
break;
}
if(conn == NULL) {
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
newconn = 1;
}
if(conn != NULL) {
@ -49,7 +49,7 @@ card_load_close(struct loader *ld, char success)
dropconn(conn);
}
}
free(ld);
gfree(ld);
if(cards_loading > 0)
cards_loading--;
do_run_now++;
@ -106,7 +106,7 @@ card_load_fail(struct loader *ld, int err)
break;
}
if(conn == NULL) {
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
newconn = 1;
}
if(conn != NULL) {
@ -121,7 +121,7 @@ card_load_fail(struct loader *ld, int err)
}
}
card_load_close(ld,0);
free(card);
gfree(card);
}
void
@ -168,7 +168,7 @@ card_load(struct loader *ld)
streamchar ans[50];
if(ld->file != NULL) {
buf = xmalloc(lf->num);
buf = gbxmalloc(lf->num);
if(buf == NULL) {
syslog(LOG_ERR, "Card loader for %s !\n",ld->card);
goto ex_load;
@ -181,7 +181,7 @@ card_load(struct loader *ld)
len = fread(buf,1,lf->num,ld->file);
if(len < 0) {
syslog(LOG_ERR, "Card loader for %s: read returned %m\n",ld->card);
free(buf);
gfree(buf);
goto ex_load;
}
foffset = ld->foffset;
@ -227,7 +227,7 @@ card_load(struct loader *ld)
}
(void) strwritev (xs_mon, io,len, 1);
if(buf != NULL)
free(buf);
gfree(buf);
ld->timer = 1;
timeout(card_load,ld,(ld->file || !lf) ? HZ : (HZ*lf->num2+HZ/3));
if(!do_again)

View File

@ -27,6 +27,7 @@ main (int argc, char *argv[])
int x;
mlockall(MCL_CURRENT | MCL_FUTURE);
MALLOC_INIT();
#ifdef DO_DEBUG_MALLOC
mcheck(NULL);
@ -193,10 +194,10 @@ main (int argc, char *argv[])
system("rm -rf /dev/isdn /dev/isdnmon");
mkdir("/dev/isdn",0755);
mknod ("/dev/isdnmon", S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(isdnstd,0));
mknod ("/dev/isdnmon", S_IFCHR | S_IRUSR | S_IWUSR, makedev(isdnstd,0));
for(i=1;i<NPORT;i++) {
mknod (idevname (i), S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(isdnstd,i));
mknod (idevname (i), S_IFCHR | S_IRUSR | S_IWUSR, makedev(isdnstd,i));
chmod (idevname (i), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
}
if(0)syslog(LOG_DEBUG,"ISDN: isdn/XX: major number %d",isdnstd);
@ -215,16 +216,13 @@ main (int argc, char *argv[])
#endif
/* Standard signal handling -- TODO: Use sigaction() instead. */
signal (SIGALRM, (sigfunc__t) alarmsig);
signal (SIGPIPE, SIG_IGN);
if(signal(SIGHUP,SIG_IGN) != SIG_IGN)
signal (SIGHUP, (void *)do_quitnow);
if(signal(SIGINT,SIG_IGN) != SIG_IGN)
signal (SIGINT, (void *)do_quitnow); /* Always these "incompatible" pointers... */
if(signal(SIGTERM,SIG_IGN) != SIG_IGN)
signal (SIGTERM, (void *)do_quitnow); /* Always these "incompatible" pointers... */
signal (SIGQUIT, (sigfunc__t) do_quitnow);
signal (SIGUSR1, (sigfunc__t) kill_progs);
bsd_signal (SIGALRM, (sigfunc__t) alarmsig);
bsd_signal (SIGPIPE, SIG_IGN);
bsd_signal (SIGHUP, (void *)do_quitnow);
bsd_signal (SIGINT, (void *)do_quitnow); /* Always these "incompatible" pointers... */
bsd_signal (SIGTERM, (void *)do_quitnow); /* Always these "incompatible" pointers... */
bsd_signal (SIGQUIT, (sigfunc__t) do_quitnow);
bsd_signal (SIGUSR1, (sigfunc__t) kill_progs);
/* Create a stream within the program */
xs_mon = stropen (0);

View File

@ -3,6 +3,32 @@
#undef DO_DEBUG_MALLOC
/*
* gmalloc alloziert einen normalen Block, der Zeiger auf aufzuräumende
* Blöcke haben kann, aber selber nicht aufgeräumt wird.
*
* gcmalloc alloziert einen Block, der aufgeräumt werden kann.
* gbmalloc dito, aber ohne interne Zeiger.
*/
#ifdef DO_GARBAGE_COLLECT
#include <gc.h>
#define gmalloc GC_malloc_uncollectable
#define gcmalloc GC_malloc
#define gbmalloc GC_malloc_atomic
#define gfree GC_free
#define grealloc GC_realloc
#define MALLOC_INIT() GC_enable_incremental()
#define MALLOC_IDLE() GC_collect_a_little()
#else
#define gmalloc malloc
#define gcmalloc malloc
#define gbmalloc malloc
#define gfree free
#define grealloc realloc
#define MALLOC_INIT() do { } while(0)
#define MALLOC_IDLE() do { } while(0)
#endif
/*
* A large heap of include files. Some may no longer be necessary...
*/
@ -45,7 +71,7 @@
#include "isdn_proto.h"
#include "wildmat.h"
#include "vectcmp.h"
#if 0 /* def linux */
#if __GNU_LIBRARY__ - 0 < 6
#include <linux/fs.h>
#endif
#if LEVEL < 4
@ -69,6 +95,9 @@ EXTERN char *progname;
void xquit (const char *s, const char *t);
void *xmalloc(size_t sz);
void *gxmalloc(size_t sz);
void *gcxmalloc(size_t sz);
void *gbxmalloc(size_t sz);
#ifdef DO_DEBUG_MALLOC
@ -548,4 +577,8 @@ EXTERN uchar_t *theclass INIT(NULL);
EXTERN uid_t rootuser INIT(0);
EXTERN int GrabAllocs INIT(0);
EXTERN int GrabFrees INIT(0);
EXTERN int GrabStrs INIT(0);
#endif

View File

@ -211,67 +211,67 @@ pmatch1 (cf prot, conngrab *cgm)
#define CHKVI() \
({ __label__ ex; int xx,yy,xm; streamchar *vx,*vy,*vm; ushort_t id2; \
yy = m_gethexlen(cand); \
if (yy <= 0 || (vy=xmalloc(yy))==NULL) break; \
if(m_gethex(cand,vy,yy) != 0) { free(vy); break; } \
if (yy <= 0 || (vy=gcxmalloc(yy))==NULL) break; \
if(m_gethex(cand,vy,yy) != 0) { gfree(vy); break; } \
if ((xm = m_gethexlen(cand)) > 0) { \
if ((vm=xmalloc(xm)) == NULL) \
{ free(vy); break; } \
{ gfree(vy); break; } \
if(m_gethex(cand,vm,xm) != 0) \
{ free(vy); free(vm); break; } \
{ gfree(vy); gfree(vm); break; } \
} else \
{ vm=NULL; xm=0; } \
if(cgc->par_in != NULL) { \
while(m_getsx(cgc->par_in,&id2) == 0) { \
if(id != id2) continue; \
xx = m_gethexlen(cgc->par_in); \
if (xx <= 0 || (vx=xmalloc(xx))==NULL) break; \
if (xx <= 0 || (vx=gcxmalloc(xx))==NULL) break; \
if(m_gethex(cgc->par_in,vx,xx) != 0) \
{ free(vx); break; } \
{ gfree(vx); break; } \
if(abs(vectcmp(vx,xx,vy,yy,vm,xm)) < 5) \
{ free(vx); free(vy); if(xm>0)free(vm); goto ex; } \
{ gfree(vx); gfree(vy); if(xm>0)gfree(vm); goto ex; } \
if(0)if(!strchr(prot->type,'F') && !first) continue; \
cgc->par_in->b_rptr = mbs_in; \
freeb(cand); \
if(0)printf("MatchVI %x: %s vs %s\n",id,vx,vy); \
free(vx); free(vy); if(xm>0)free(vm); \
gfree(vx); gfree(vy); if(xm>0)gfree(vm); \
dropgrab(cgc); dropgrab(cg); return "3ERR FIND Match Arg"; \
} \
free(vy); if(xm>0)free(vm); \
gfree(vy); if(xm>0)gfree(vm); \
} \
ex:; }) /**/
#define CHKVO() \
({ __label__ ex; int xx,yy,xm; streamchar *vx,*vy,*vm; ushort_t id2; \
yy = m_gethexlen(cand); \
if (yy <= 0 || (vy=xmalloc(yy))==NULL) break; \
if(m_gethex(cand,vy,yy) != 0) { free(vy); break; } \
if (yy <= 0 || (vy=gcxmalloc(yy))==NULL) break; \
if(m_gethex(cand,vy,yy) != 0) { gfree(vy); break; } \
if ((xm = m_gethexlen(cand)) > 0) { \
if ((vm=xmalloc(xm)) == NULL) \
{ free(vy); break; } \
if ((vm=gcxmalloc(xm)) == NULL) \
{ gfree(vy); break; } \
if(m_gethex(cand,vm,xm) != 0) \
{ free(vy); free(vm); break; } \
{ gfree(vy); gfree(vm); break; } \
} else \
{ vm=NULL; xm=0; } \
if(cgc->par_out != NULL) { \
while(m_getsx(cgc->par_out,&id2) == 0) { \
if(id != id2) continue; \
xx = m_gethexlen(cgc->par_out); \
if (xx <= 0 || (vx=xmalloc(xx))==NULL) break; \
if (xx <= 0 || (vx=gcxmalloc(xx))==NULL) break; \
if(m_gethex(cgc->par_out,vx,xx) != 0) \
{ free(vx); break; } \
{ gfree(vx); break; } \
if(abs(vectcmp(vx,xx,vy,yy,vm,xm)) < 5) \
{ free(vx); free(vy); if(xm>0)free(vm); goto ex; } \
{ gfree(vx); gfree(vy); if(xm>0)gfree(vm); goto ex; } \
if(0)if(!strchr(prot->type,'F') && !first) continue; \
cgc->par_out->b_rptr = mbs_out; \
if(0)printf("MatchVO %x: %s vs %s\n",id,vx,vy); \
freeb(cand); \
free(vx); free(vy); if(xm>0)free(vm); \
gfree(vx); gfree(vy); if(xm>0)gfree(vm); \
dropgrab(cgc); dropgrab(cg); return "3ERR FIND Match Arg"; \
} \
if(!(cgc->flags & F_OUTCOMPLETE)) { \
m_putsx(cgc->par_out,id); \
m_puthex(cgc->par_out,vy,yy); \
} \
free(vy); if(xm>0)free(vm); \
gfree(vy); if(xm>0)gfree(vm); \
} \
ex:; }) /**/

View File

@ -162,6 +162,7 @@ backrun (int fd, int timeo)
rdx = rd;
runqueues (); deadkid(); runqueues ();
MALLOC_IDLE();
if(fd >= 0) FD_SET(fd,&rdx);
err = select (FD_SETSIZE, &rdx, NULL, NULL, &now);
if (err == 0 || (err < 0 && errno == EINTR)) {

View File

@ -24,12 +24,57 @@ xmalloc(size_t sz)
return foo;
}
void *
gxmalloc(size_t sz)
{
void *foo;
foo = gmalloc(sz);
if(foo == NULL) {
syslog(LOG_CRIT,"No memory for %d bytes! Dying!\n",sz);
abort();
}
return foo;
}
void *
gcxmalloc(size_t sz)
{
void *foo;
foo = gcmalloc(sz);
if(foo == NULL) {
syslog(LOG_CRIT,"No memory for %d bytes! Dying!\n",sz);
abort();
}
return foo;
}
void *
gbxmalloc(size_t sz)
{
void *foo;
foo = gbmalloc(sz);
if(foo == NULL) {
syslog(LOG_CRIT,"No memory for %d bytes! Dying!\n",sz);
abort();
}
return foo;
}
/* Too many strings to keep track of, no time for garbage collection. */
/* Enter them in a binary tree... */
/* str_enter MUST NOT be called while any string in the tree is temporarily
modified. No string in the tree may be permanently modified in ANY way. */
/* Actually, with GC enabled this gets a whole lot simpler. */
char *str_enter(char *master)
{
#ifdef DO_GC
char *foo = gbxmalloc(strlen(master)+1);
strcpy(foo,master);
return foo;
#else
struct string **str = &stringdb;
struct string *st = *str;
@ -51,12 +96,14 @@ char *str_enter(char *master)
st = xmalloc(sizeof(struct string)+strlen(master));
if(st == NULL)
return NULL;
GrabStrs++;
strcpy(st->data,master);
st->left = st->right = NULL;
*str = st;
chkone(st);
return st->data;
#endif
}
/* Simpleminded, bidirectional wildmat().
@ -292,7 +339,7 @@ log_idle (void *xxx)
tm = localtime(&now);
now = (now - started) / 60;
sprintf(repbuf,"#%d %02d:%02d %d,%d,%d", (int)now, tm->tm_hour,tm->tm_min,nc1,nc2,nc3);
sprintf(repbuf,"#%d %02d:%02d %d,%d,%d G:%d/%d+%d", (int)now, tm->tm_hour,tm->tm_min,nc1,nc2,nc3,GrabAllocs,GrabFrees,GrabStrs);
connreport(repbuf,"*",0);
if(!(now % 5))

View File

@ -53,7 +53,7 @@ deadkid (void)
#endif
}
#endif
free (fprog);
gfree (fprog);
conn = NULL;
break;
}
@ -120,7 +120,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
(void) strwrite (xs_mon, (uchar_t *) mj->b_rptr, len, 1);
freeb (mj);
sx = (char *)xmalloc (strlen (prot->args) + 5 + strlen (PROTO_NAME));
sx = (char *)gbxmalloc (strlen (prot->args) + 5 + strlen (PROTO_NAME));
if (sx == NULL)
return -ENOMEM;
sprintf (sx, " %s %s", prot->args, PROTO_NAME);
@ -143,7 +143,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
break;
}
if ((mi = allocb (256, BPRI_MED)) == NULL) {
free (sx);
gfree (sx);
return -ENOMEM;
}
for (cm = cf_MP; cm != NULL; cm = cm->next) {
@ -220,7 +220,7 @@ pushprot (conngrab cg, int minor, int connref, char update)
}
freeb (mi);
}
free (sx);
gfree (sx);
if(!(oupdate & (PUSH_AFTER|PUSH_UPDATE))) {
mblk_t *mj = allocb (64, BPRI_LO);
int len;
@ -609,7 +609,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo, char what)
if((err = findit (foo,!!(cg->flags & F_PERMANENT))) != NULL) {
if(conn != NULL && rconn != NULL && conn != *rconn)
free(conn);
gfree(conn);
if(dev > 0)
unlockdev(dev);
return err;
@ -617,7 +617,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo, char what)
cg = *foo;
if(conn == NULL) {
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn == NULL) {
if(dev > 0)
unlockdev(dev);
@ -662,14 +662,15 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo, char what)
id = atoi(ids);
if(id != 0) {
for(prog = conn->run; prog != NULL; prog = prog->next) {
if(prog->id == id)
if(prog->id == id) {
if(dev > 0)
unlockdev(dev);
return "Already Running";
}
}
}
}
prog = (struct proginfo *) xmalloc (sizeof (struct proginfo));
prog = (struct proginfo *) gcxmalloc (sizeof (struct proginfo));
if (prog == NULL) {
if(dev > 0)
@ -709,7 +710,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo, char what)
zzconn = conn;
alarm(15);
signal(SIGALRM,(void *)dropdead);
bsd_signal(SIGALRM,(void *)dropdead);
if (foo != NULL) {
close (pip[0]);
fcntl (pip[1], F_SETFD, 1); /* close-on-exec */
@ -768,7 +769,7 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo, char what)
#endif
if (cfr != NULL && ((cg != NULL) || strchr(cfr->type,'c') != NULL)) {
if (strchr(cfr->type,'T') != NULL) {
mknod (devname (dev), S_IFCHR | S_IRUSR | S_IWUSR, MKDEV(isdnterm,dev));
mknod (devname (dev), S_IFCHR | S_IRUSR | S_IWUSR, makedev(isdnterm,dev));
chown (devname (dev), cfr->num, cfr->num2);
chmod (devname (dev), S_IRUSR | S_IWUSR | S_IWGRP);
devfd = open(devname(dev), O_RDWR | O_EXCL
@ -846,13 +847,12 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo, char what)
bzero (&ut, sizeof (ut));
strncpy (ut.ut_id, sdevname (dev), sizeof (ut.ut_id));
strncpy (ut.ut_line, mdevname (dev), sizeof (ut.ut_line));
#ifndef M_UNIX
strncpy (ut.ut_host, cfr->site, sizeof (ut.ut_host));
#endif
getutline (&ut);
strncpy (ut.ut_user, cfr->site, sizeof (ut.ut_user));
/* strncpy (ut.ut_host, cfr->site, sizeof (ut.ut_host)); */
ut.ut_pid = getpid ();
ut.ut_type = LOGIN_PROCESS;
ut.ut_time = time(NULL);
getutline (&ut);
pututline (&ut);
endutent ();
{
@ -1122,7 +1122,7 @@ kill_rp(struct conninfo *conn, char whatnot)
if(maskmatch(pro->mask,conn->cg->mask) == 0) continue;
if(classmatch(pro->cclass,conn->cg->cclass) == NULL) continue;
xconn = xmalloc(sizeof(*xconn));
xconn = gcxmalloc(sizeof(*xconn));
if(xconn != NULL) {
bzero(xconn,sizeof(*xconn));
xconn->seqnum = ++connseq;
@ -1173,7 +1173,7 @@ run_rp(struct conninfo *conn, char what)
if(maskmatch(pr->mask,sub) == 0) continue;
if(classmatch(pr->cclass,cla) == NULL) continue;
xconn = xmalloc(sizeof(*xconn));
xconn = gcxmalloc(sizeof(*xconn));
if(xconn != NULL) {
bzero(xconn,sizeof(*xconn));
xconn->seqnum = ++connseq;
@ -1206,8 +1206,7 @@ run_now(void *nix)
cf what;
int spos = 0;
if(signal(SIGHUP,SIG_IGN) != SIG_IGN)
signal (SIGHUP, SIG_DFL);
bsd_signal(SIGHUP,SIG_IGN);
if(do_run_now && --do_run_now) {
progidx = 0;
@ -1268,7 +1267,7 @@ run_now(void *nix)
kill_rp(conn,'t');
run_rp(conn,'i');
} else if(err != NULL) {
conn = xmalloc(sizeof(*conn));
conn = gcxmalloc(sizeof(*conn));
if(conn != NULL) {
bzero(conn,sizeof(*conn));
conn->seqnum = ++connseq;
@ -1330,8 +1329,7 @@ run_now(void *nix)
}
}
}
if(signal(SIGHUP,SIG_IGN) != SIG_IGN)
signal (SIGHUP, (sigfunc__t) read_args_run);
bsd_signal (SIGHUP, (sigfunc__t) read_args_run);
progidx = 0;
do_run_now = 0;
}

View File

@ -28,8 +28,10 @@
#include <net/if_slvar.h>
#include <net/slip.h>
#else
#if 0
#include <linux/if_slip.h>
#endif
#endif
#include <arpa/inet.h>
#ifdef SYSV
#include <sys/stream.h>
@ -370,7 +372,7 @@ enable (void)
islinked = 1;
if(fork() == 0) {
signal(SIGCHLD,SIG_DFL);
bsd_signal(SIGCHLD,SIG_DFL);
fprintf(stderr,"<<%s>>\n",makeroute);
execl("/bin/sh","sh","-c",makeroute,NULL);
/* system (makeroute); */
@ -385,7 +387,7 @@ disable (void)
syslog(LOG_DEBUG,"Taking down IF %s",ifname);
if(fork() == 0) {
signal(SIGCHLD,SIG_DFL);
bsd_signal(SIGCHLD,SIG_DFL);
fprintf(stderr,"<<%s>>\n",unmakeroute);
execl("/bin/sh","sh","-c",unmakeroute,NULL);
}
@ -464,15 +466,15 @@ main (int argc, char *argv[])
openlog (progname, LOG_PID|LOG_PERROR, LOG_LOCAL7);
signal (SIGUSR1, (sigfunc__t) enable);
signal (SIGUSR2, (sigfunc__t) disable);
signal (SIGPWR, (sigfunc__t) disable);
signal (SIGHUP, (sigfunc__t) disableq);
signal (SIGINT, (sigfunc__t) disableq);
signal (SIGTERM, (sigfunc__t) disableq);
signal (SIGQUIT, (sigfunc__t) disableq);
signal (SIGCHLD, SIG_IGN);
signal (SIGTTOU, SIG_IGN);
bsd_signal (SIGUSR1, (sigfunc__t) enable);
bsd_signal (SIGUSR2, (sigfunc__t) disable);
bsd_signal (SIGPWR, (sigfunc__t) disable);
bsd_signal (SIGHUP, (sigfunc__t) disableq);
bsd_signal (SIGINT, (sigfunc__t) disableq);
bsd_signal (SIGTERM, (sigfunc__t) disableq);
bsd_signal (SIGQUIT, (sigfunc__t) disableq);
bsd_signal (SIGCHLD, SIG_IGN);
bsd_signal (SIGTTOU, SIG_IGN);
while ((s = getopt (argc, argv, "Ddr:R:lEMm:vfLop:s:S:A:x")) != EOF)
switch (s) {
@ -648,7 +650,7 @@ main (int argc, char *argv[])
}
if (dovanj) {
if (ioctl (devfd, I_PUSH, "van_j") < 0) {
#ifdef SIOCSIFENCAP
#if defined(SIOCSIFENCAP) && defined(SL_OPT_ADAPTIVE)
int i = SL_MODE_CSLIP|SL_OPT_ADAPTIVE;
ioctl(devfd,SIOCSIFENCAP,&i);
#endif

View File

@ -294,7 +294,7 @@ struct stroptions {
/*
* Default timeout in seconds for ioctls and close
*/
#define STRTIMOUT 15
#define STRTIMOUT 5
/*
* Stream head default high/low water marks

View File

@ -334,7 +334,7 @@ streams_close (struct inode *inode, struct file *file)
*/
xtimeout = jiffies + HZ * STRTIMOUT;
while (p_queue->q_next != NULL) {
if (p_stream->error >= 0 && !(file->f_flags & O_NDELAY)) {
if (jiffies < xtimeout && p_stream->error >= 0 && !(file->f_flags & O_NDELAY)) {
current->timeout = xtimeout;
if(p_queue->q_next->q_count != 0 &&
!(current->signal & ~current->blocked))

View File

@ -1,7 +1,7 @@
#ifndef _LINUX_STROPTS_H
#define _LINUX_STROPTS_H
#include <sys/ioctl.h>
#include "f_ioctl.h"
#ifndef FMNAMESZ
#define FMNAMESZ 16

View File

@ -196,10 +196,6 @@ callout_alarm (void)
if (callout_list)
callout_settimeout ();
SIG_RESUME (sm);
#if defined(M_UNIX) || defined(linux)
signal (SIGALRM, (sigfunc__t) callout_alarm);
#endif
}
void
@ -217,7 +213,7 @@ callout_sync (void)
timerclear (&itm.it_value);
setitimer (ITIMER_REAL, &itm, NULL);
signal (SIGALRM, SIG_DFL);
bsd_signal (SIGALRM, SIG_DFL);
}
SIG_RESUME (sm);
}
@ -230,7 +226,7 @@ callout_async (void)
if (!callout_doasync) {
callout_doasync = 1;
signal (SIGALRM, (sigfunc__t) callout_alarm);
bsd_signal (SIGALRM, (sigfunc__t) callout_alarm);
callout_settimeout ();
}
SIG_RESUME (sm);

View File

@ -1,6 +1,6 @@
#include "primitives.h"
/*
* $Revision: 1.7 $ *
* $Revision: 1.1.1.1 $ *
*
* Do shell-style pattern matching for ?, \, [], and * characters. * Might not be
* robust in face of malformed patterns; e.g., "foo[a-" * could cause a

View File

@ -6,9 +6,12 @@ NOCLEAN = catfone
all::
install::
@if test ! -f /etc/isdn.conf; then \
echo install isdn.conf /etc ; \
install isdn.conf /etc ; \
@if test ! -f /etc/isdn.conf; then \
echo install isdn.conf /etc ; \
cp isdn.conf /tmp; \
sed -e 's/^/MOD /' < modules.isdn >> /tmp/isdn.conf; \
install /tmp/isdn.conf /etc; \
rm /tmp/isdn.conf; \
fi
@if test -d /sbin/init.d/scripts ; then \
echo "*** /sbin/init.d/scripts/uisdn ***"; \

View File

@ -6,9 +6,8 @@
FILE=$1
VERSION=${VERSION:-$(${TOPDIR}/tools/getversion)}
MODDIR=${MODDIR:-/lib/modules}
dir=${MODDIR}/$VERSION
echo isdn/d_$FILE >>$dir/../modules.isdn.all
dir=${MODDIR}/${VERSION}
echo MOD $(basename d_$FILE .o) >>$TOPDIR/modules.isdn
rm -f $dir/isdn/d_$FILE
(
cp $FILE $dir/isdn/d_$FILE

View File

@ -6,9 +6,8 @@
FILE=$1
VERSION=${VERSION:-$(${TOPDIR}/tools/getversion)}
MODDIR=${MODDIR:-/lib/modules}
dir=${MODDIR}/$VERSION
echo isdn/$FILE >>$dir/../modules.isdn.all
dir=${MODDIR}/${VERSION}
echo MOD $(basename $FILE .o) >>$TOPDIR/modules.isdn
rm -f $dir/isdn/$FILE
(
cp $FILE $dir/isdn/$FILE

View File

@ -3,7 +3,7 @@
## =()<DESTDIR=@<DESTDIR>@>()=
DESTDIR=/usr/lib/isdn
## =()<LOCKNAME=@<LOCKNAME>@>()=
LOCKNAME=/var/lock
LOCKNAME=/var/lock/LCK..%s
set -e
@ -77,19 +77,19 @@ echo $$ > /var/run/isdn.pid
if lsmod | grep isdn_2 >/dev/null 2>&1 ; then : ; else
cd /lib/modules/$(uname -r)
if test -f /tmp/symbols.isdn ; then mv /tmp/symbols.isdn /tmp/symbols.isdn.old ; fi
while read x a ; do
while read x a b ; do
case "$x" in
MO*)
/bin/echo -n "\rISDN Modules: " >&2
/bin/echo -n "\rISDN Modules: $a: " >&2
eval "insmod -m $a" ## wegen name=$(cardname Foo0) in $a
/bin/echo -n "\rISDN Modules: $a: $b " >&2
eval "insmod -m isdn/$a.o $b" ## wegen evtl. name=$(cardname Foo0) in $b
;;
esac
done < /etc/isdn.conf > /tmp/symbols.isdn
/bin/echo "\rISDN Modules...done. "
fi
cd /var/tmp # for coredumps...
cd /var/tmp # coredumps..?
ulimit -c 40000
# ulimit -d 20000

View File

@ -12,7 +12,7 @@
/*
* Definitions for tcp compression routines.
*
* $Header: /usr/src/cvs/kernel/isdn/van_j/compress.h,v 1.1.1.1 1996/07/29 07:09:09 smurf Exp $
* $Header: /usr/src/cvs/kernel/isdn/van_j/compress.h,v 1.2 1996/09/16 01:03:31 smurf Exp $
*
* Copyright (c) 1989 Regents of the University of California. All rights
* reserved.