Increase the length of an individual device name to LINE_LEN.

Adjust the base physical device name correctly after a link
transfer (allowing correct multilink callbacks).
This commit is contained in:
brian 1999-06-01 19:08:59 +00:00
parent 316fd42ae7
commit 89b86dc6ea
4 changed files with 15 additions and 11 deletions

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: defs.h,v 1.42 1999/04/27 00:23:54 brian Exp $ * $Id: defs.h,v 1.43 1999/05/08 11:06:28 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -43,8 +43,9 @@
#define RECONNECT_TIMEOUT 3 /* Default timer for carrier loss */ #define RECONNECT_TIMEOUT 3 /* Default timer for carrier loss */
#define DIAL_TIMEOUT 30 /* Default and Max random time to redial */ #define DIAL_TIMEOUT 30 /* Default and Max random time to redial */
#define DIAL_NEXT_TIMEOUT 3 /* Default Hold time to next number redial */ #define DIAL_NEXT_TIMEOUT 3 /* Default Hold time to next number redial */
#define SCRIPT_LEN 512 /* Size of login scripts */ #define SCRIPT_LEN 512 /* Size of login/dial/hangup scripts */
#define LINE_LEN SCRIPT_LEN /* Size of login scripts */ #define LINE_LEN SCRIPT_LEN /* Size of lines */
#define DEVICE_LEN SCRIPT_LEN /* Size of individual devices */
#define AUTHLEN 100 /* Size of authname/authkey */ #define AUTHLEN 100 /* Size of authname/authkey */
#define CHAPDIGESTLEN 100 /* Maximum chap digest */ #define CHAPDIGESTLEN 100 /* Maximum chap digest */
#define CHAPCHALLENGELEN 48 /* Maximum chap challenge */ #define CHAPCHALLENGELEN 48 /* Maximum chap challenge */

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: exec.c,v 1.2 1999/05/12 09:48:49 brian Exp $ * $Id: exec.c,v 1.3 1999/05/24 16:39:10 brian Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -151,6 +151,7 @@ exec_Create(struct physical *p)
dup2(fids[1], STDOUT_FILENO); dup2(fids[1], STDOUT_FILENO);
dup2(fids[1], STDERR_FILENO); dup2(fids[1], STDERR_FILENO);
log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base);
argc = MakeArgs(p->name.base, argv, VECSIZE(argv)); argc = MakeArgs(p->name.base, argv, VECSIZE(argv));
command_Expand(argv, argc, (char const *const *)argv, command_Expand(argv, argc, (char const *const *)argv,
p->dl->bundle, 0); p->dl->bundle, 0);

View File

@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: physical.c,v 1.13 1999/05/18 01:37:46 brian Exp $ * $Id: physical.c,v 1.14 1999/05/24 16:39:12 brian Exp $
* *
*/ */
@ -529,11 +529,11 @@ iov2physical(struct datalink *dl, struct iovec *iov, int *niov, int maxiov,
p->type = PHYS_DIRECT; p->type = PHYS_DIRECT;
p->dl = dl; p->dl = dl;
len = strlen(_PATH_DEV); len = strlen(_PATH_DEV);
p->name.base = strncmp(p->name.full, _PATH_DEV, len) ?
p->name.full : p->name.full + len;
p->out = NULL; p->out = NULL;
p->connect_count = 1; p->connect_count = 1;
physical_SetDevice(p, p->name.full);
p->link.lcp.fsm.bundle = dl->bundle; p->link.lcp.fsm.bundle = dl->bundle;
p->link.lcp.fsm.link = &p->link; p->link.lcp.fsm.link = &p->link;
memset(&p->link.lcp.fsm.FsmTimer, '\0', sizeof p->link.lcp.fsm.FsmTimer); memset(&p->link.lcp.fsm.FsmTimer, '\0', sizeof p->link.lcp.fsm.FsmTimer);
@ -804,8 +804,10 @@ physical_SetDevice(struct physical *p, const char *name)
{ {
int len = strlen(_PATH_DEV); int len = strlen(_PATH_DEV);
strncpy(p->name.full, name, sizeof p->name.full - 1); if (name != p->name.full) {
p->name.full[sizeof p->name.full - 1] = '\0'; strncpy(p->name.full, name, sizeof p->name.full - 1);
p->name.full[sizeof p->name.full - 1] = '\0';
}
p->name.base = *p->name.full == '!' ? p->name.full + 1 : p->name.base = *p->name.full == '!' ? p->name.full + 1 :
strncmp(p->name.full, _PATH_DEV, len) ? strncmp(p->name.full, _PATH_DEV, len) ?
p->name.full : p->name.full + len; p->name.full : p->name.full + len;

View File

@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: physical.h,v 1.10 1999/05/12 09:48:58 brian Exp $ * $Id: physical.h,v 1.11 1999/05/24 16:39:14 brian Exp $
* *
*/ */
@ -66,7 +66,7 @@ struct physical {
} input; } input;
struct { struct {
char full[40]; /* Our current device name */ char full[DEVICE_LEN]; /* Our current device name */
char *base; char *base;
} name; } name;