the call "isdnctrl pppbind ipppX" will be bound the interface to X

This commit is contained in:
Stefan Luethje 1997-07-30 20:09:32 +00:00
parent 5d3b036e53
commit e5b71f635a
4 changed files with 32 additions and 73 deletions

View File

@ -21,6 +21,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.7 1997/07/23 20:39:15 luethje
* added the option "force" for the commands delif and reset
*
* Revision 1.6 1997/07/22 22:36:10 luethje
* isdnrep: Use " " for blanks
* isdnctrl: Add the option "reset"
@ -316,59 +319,6 @@ static void listif(int isdnctrl, char *name, int errexit)
nextlistif[0] = '\0';
}
static void get_setup(int isdnctrl, char *name)
{
isdn_net_ioctl_cfg cfg;
char buffer[0x1000];
char *p;
FILE *f;
if (ioctl(isdnctrl, IIOCGETSET, &buffer) < 0) {
perror("ioctl GET_SETUP");
exit(-1);
}
if (strcmp(name,"-"))
f = fopen(name, "w");
else
f = stdout;
if (!f) {
perror(name);
exit(-1);
}
p = buffer;
fprintf(f,"[isdnctrl]\n");
while (strlen(p)) {
if (strlen(cfg.master)) {
fprintf(f, " netslave=\"%s\"\n", p);
fprintf(f, " master=\"%s\"\n", p);
} else
fprintf(f, " netif=\"%s\"\n", p);
p += 10;
memcpy((char *) &cfg, p, sizeof(cfg));
fprintf(f, " eazmsn=\"%s\"\n", cfg.eaz);
fprintf(f, " secure=%d\n", cfg.secure);
fprintf(f, " callback=%d\n", cfg.callback);
fprintf(f, " huptimeout=%d\n", cfg.onhtime);
fprintf(f, " ihup=%d\n", cfg.ihup);
fprintf(f, " chargehup=%d\n", cfg.chargehup);
fprintf(f, " l2prot=%d\n", cfg.l2_proto);
fprintf(f, " l3prot=%d\n", cfg.l3_proto);
fprintf(f, " encap=%d\n", cfg.p_encap);
fprintf(f, " chargeint=%d\n", cfg.chargeint);
fprintf(f, " slavedelay=%d\n", cfg.slavedelay);
fprintf(f, " triggercps=%d\n", cfg.triggercps);
fprintf(f, " exclusive=%d\n", cfg.exclusive);
fprintf(f, " binddev=\"%s\"\n", cfg.drvid);
p += sizeof(cfg);
fprintf(f, " outphones=\"%s\"\n", p);
p += (strlen(p) + 1);
fprintf(f, " inphones=\"%s\"\n", p);
p += (strlen(p) + 1);
}
if (f != stdout)
fclose(f);
}
int findcmd(char *str)
{
int i;
@ -389,7 +339,7 @@ int exec_args(int fd, int argc, char **argv)
int result;
FILE *iflst;
char *p;
char s[255];
char s[255], dummy[255];
isdn_net_ioctl_phone phone;
isdn_net_ioctl_cfg cfg;
isdn_ioctl_struct iocts;
@ -420,9 +370,9 @@ int exec_args(int fd, int argc, char **argv)
}
#ifdef I4L_CTRL_CONF
if (id != NULL && i != RESET && i != GETCONF && i != WRITECONF && i != READCONF) {
if (id != NULL && i != RESET && i != WRITECONF && i != READCONF) {
#else
if (id != NULL && i != RESET && i != GETCONF) {
if (id != NULL && i != RESET) {
#endif /* I4L_CTRL_CONF */
if (strlen(id) > 8) {
fprintf(stderr, "Interface name must not exceed 8 characters!\n");
@ -543,14 +493,21 @@ int exec_args(int fd, int argc, char **argv)
perror(id);
return -1;
}
if (args > 1) {
sscanf(arg1, "%d", &cfg.pppbind);
if ((result = ioctl(fd, IIOCNETSCF, &cfg)) < 0) {
if ((args == 2 && sscanf(arg1, "%d%s", &cfg.pppbind,dummy) == 1) ||
(args == 1 && sscanf(id, "ippp%d%s", &cfg.pppbind,dummy) == 1)) {
if ((result = ioctl(fd, IIOCNETSCF, &cfg)) < 0) {
sprintf(s, "%s or %s", id, arg1);
perror(s);
return -1;
}
}
} else {
if (args == 1)
fprintf(stderr,"Unknown interface `%s', use ipppX\n", id);
else
fprintf(stderr,"Unknown argument `%s'\n", arg1);
return -1;
}
printf("%s bound to ", id);
if (cfg.pppbind >= 0)
printf("%d\n", cfg.pppbind);
@ -721,13 +678,6 @@ int exec_args(int fd, int argc, char **argv)
printf("Verbose-level set to %d.\n", i);
break;
case GETCONF:
if (args == 0)
id = "-";
get_setup(fd, id);
printf("Configuration written to %s.\n", id);
break;
case HUPTIMEOUT:
strcpy(cfg.name, id);
if ((result = ioctl(fd, IIOCNETGCF, &cfg)) < 0) {

View File

@ -21,6 +21,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
* Revision 1.4 1997/07/23 20:39:16 luethje
* added the option "force" for the commands delif and reset
*
* Revision 1.3 1997/07/22 22:36:11 luethje
* isdnrep: Use "&nbsp;" for blanks
* isdnctrl: Add the option "reset"
@ -45,7 +48,7 @@ enum {
BIND, UNBIND, PPPBIND, PPPUNBIND,
BUSREJECT, MAPPING, SYSTEM, HANGUP,
ADDPHONE, DELPHONE, LIST, EAZ,
VERBOSE, GETCONF, HUPTIMEOUT, CBDELAY,
VERBOSE, HUPTIMEOUT, CBDELAY,
CHARGEINT, DIALMAX, SDELAY, CHARGEHUP,
CBHUP, IHUP, SECURE, CALLBACK,
L2_PROT, L3_PROT, ADDLINK, REMOVELINK,
@ -84,7 +87,6 @@ cmd_struct cmds[] =
{"list", "1"},
{"eaz", "12"},
{"verbose", "1"},
{"getconf", "01"},
{"huptimeout", "12"},
{"cbdelay", "12"},
{"chargeint", "12"},

View File

@ -6,6 +6,9 @@
#
#
# $Log$
# Revision 1.5 1997/07/23 20:39:17 luethje
# added the option "force" for the commands delif and reset
#
# Revision 1.4 1997/07/22 22:36:12 luethje
# isdnrep: Use "&nbsp;" for blanks
# isdnctrl: Add the option "reset"
@ -254,7 +257,11 @@ Unbinds a the previously bound interface "name".
Binds the current interface to a ippp device (/dev/ipppX).
This works only for syncronous ppp.
The value must be a number.
If no number is omitted, it shows the current binding.
If no number is omitted and the interface name is called "ipppX", then
it binds it to the same ippp interface.
.TP 5
.B pppunbind name
Unbinds a the previously bound interface "name" to a ippp device.
.TP 5
.B busreject driverId [on|off]
If switched on, isdn4linux replies a REJECT to incoming calls, it

View File

@ -427,7 +427,7 @@ Folgende Programme und Dateien werden durch den "make install" erstellt:
/sbin/isdnlog
/usr/sbin/isdnrep
/etc/isdn/avon (wenn LIBAREA nicht definiert ist!)
/usr/lib/areacodes (wenn LIBAREA definiert ist!)
/usr/lib/areacode.dat (wenn LIBAREA definiert ist!)
ACHTUNG: Durch die Syntaxaenderung und den Erweiterungen muessen folgende
@ -532,11 +532,11 @@ CODELIB:
CODELIB=avon
AREALIB:
Enthaelt den vollen Pfad zu der Datei "areacodes". Diese Angabe ist
Enthaelt den vollen Pfad zu der Datei "areacode.dat". Diese Angabe ist
optional und nur notwendig, wenn sich der Pfad nach der Compilation
geaendert hat.
Beispiel:
AREALIB=/usr/share/lib/areacodes
AREALIB=/usr/share/lib/areacode.dat
AVONLIB:
Enthaelt den vollen Pfad zu der Datei "avon". Diese Angabe ist