version 1.1.1.4, 2021/03/17 00:39:23
|
version 1.1.1.4.2.1, 2023/09/27 11:08:00
|
Line 52
|
Line 52
|
SET_NO |
SET_NO |
}; |
}; |
|
|
|
/* Used to prevent auto-up on links closed manually */ |
|
enum { |
|
LINK_ADMINSTATE_DOWN = 0, |
|
LINK_ADMINSTATE_OPERATIONAL |
|
}; |
|
|
|
static const char *linkAdminStateNames[] = { |
|
"DOWN", |
|
"OPERATIONAL" |
|
}; |
|
|
#define RBUF_SIZE 100 |
#define RBUF_SIZE 100 |
|
|
/* |
/* |
Line 185 LinksShutdown(void)
|
Line 196 LinksShutdown(void)
|
} |
} |
|
|
/* |
/* |
|
* LinkOpenAdm() |
|
*/ |
|
|
|
void |
|
LinkOpenAdm(Link l) |
|
{ |
|
l->admin_state = LINK_ADMINSTATE_OPERATIONAL; |
|
RecordLinkUpDownReason(NULL, l, 1, STR_MANUALLY, NULL); |
|
LinkOpen(l); |
|
} |
|
|
|
/* |
* LinkOpenCmd() |
* LinkOpenCmd() |
*/ |
*/ |
|
|
Line 193 LinkOpenCmd(Context ctx)
|
Line 216 LinkOpenCmd(Context ctx)
|
{ |
{ |
if (ctx->lnk->tmpl) |
if (ctx->lnk->tmpl) |
Error("impossible to open template"); |
Error("impossible to open template"); |
RecordLinkUpDownReason(NULL, ctx->lnk, 1, STR_MANUALLY, NULL); | LinkOpenAdm(ctx->lnk); |
LinkOpen(ctx->lnk); | |
return (0); |
return (0); |
} |
} |
|
|
/* |
/* |
|
* LinkCloseAdm() |
|
*/ |
|
|
|
void |
|
LinkCloseAdm(Link l) |
|
{ |
|
l->admin_state = LINK_ADMINSTATE_DOWN; |
|
RecordLinkUpDownReason(NULL, l, 0, STR_MANUALLY, NULL); |
|
LinkClose(l); |
|
} |
|
|
|
/* |
* LinkCloseCmd() |
* LinkCloseCmd() |
*/ |
*/ |
|
|
Line 207 LinkCloseCmd(Context ctx)
|
Line 241 LinkCloseCmd(Context ctx)
|
{ |
{ |
if (ctx->lnk->tmpl) |
if (ctx->lnk->tmpl) |
Error("impossible to close template"); |
Error("impossible to close template"); |
|
ctx->lnk->admin_state = LINK_ADMINSTATE_DOWN; |
RecordLinkUpDownReason(NULL, ctx->lnk, 0, STR_MANUALLY, NULL); |
RecordLinkUpDownReason(NULL, ctx->lnk, 0, STR_MANUALLY, NULL); |
LinkClose(ctx->lnk); |
LinkClose(ctx->lnk); |
return (0); |
return (0); |
Line 258 LinkDown(Link l)
|
Line 293 LinkDown(Link l)
|
{ |
{ |
Log(LG_LINK, ("[%s] Link: DOWN event", l->name)); |
Log(LG_LINK, ("[%s] Link: DOWN event", l->name)); |
|
|
if (OPEN_STATE(l->lcp.fsm.state)) { | if (OPEN_STATE(l->lcp.fsm.state) || l->admin_state != LINK_ADMINSTATE_DOWN) { |
if (((l->conf.max_redial != 0) && (l->num_redial >= l->conf.max_redial)) || |
if (((l->conf.max_redial != 0) && (l->num_redial >= l->conf.max_redial)) || |
gShutdownInProgress) { |
gShutdownInProgress) { |
if (l->conf.max_redial >= 0) { |
if (l->conf.max_redial >= 0) { |
Line 307 LinkReopenTimeout(void *arg)
|
Line 342 LinkReopenTimeout(void *arg)
|
Log(LG_LINK, ("[%s] Link: reconnection attempt %hu", |
Log(LG_LINK, ("[%s] Link: reconnection attempt %hu", |
l->name, l->num_redial)); |
l->name, l->num_redial)); |
RecordLinkUpDownReason(NULL, l, 1, STR_REDIAL, NULL); |
RecordLinkUpDownReason(NULL, l, 1, STR_REDIAL, NULL); |
|
if (!OPEN_STATE(l->lcp.fsm.state)) |
|
LinkOpen(l); |
PhysOpen(l); |
PhysOpen(l); |
} |
} |
|
|
Line 411 LinkCreate(Context ctx, int ac, const char *const av[]
|
Line 448 LinkCreate(Context ctx, int ac, const char *const av[]
|
strlcpy(l->name, av[0 + stay], sizeof(l->name)); |
strlcpy(l->name, av[0 + stay], sizeof(l->name)); |
l->type = pt; |
l->type = pt; |
l->tmpl = tmpl; |
l->tmpl = tmpl; |
|
l->admin_state = LINK_ADMINSTATE_OPERATIONAL; |
l->stay = stay; |
l->stay = stay; |
l->parent = -1; |
l->parent = -1; |
SLIST_INIT(&l->actions); |
SLIST_INIT(&l->actions); |
|
|
/* Initialize link configuration with defaults */ |
/* Initialize link configuration with defaults */ |
l->conf.mru = LCP_DEFAULT_MRU; |
l->conf.mru = LCP_DEFAULT_MRU; |
l->conf.mtu = LCP_DEFAULT_MRU; | /* Do not assume any MTU value for this moment */ |
| l->conf.mtu = 0; |
l->conf.mrru = MP_DEFAULT_MRRU; |
l->conf.mrru = MP_DEFAULT_MRRU; |
l->conf.accmap = 0x000a0000; |
l->conf.accmap = 0x000a0000; |
l->conf.max_redial = -1; |
l->conf.max_redial = -1; |
Line 551 LinkInst(Link lt, const char *name, int tmpl, int stay
|
Line 590 LinkInst(Link lt, const char *name, int tmpl, int stay
|
SLIST_INSERT_AFTER(ap, a, next); |
SLIST_INSERT_AFTER(ap, a, next); |
ap = a; |
ap = a; |
} |
} |
|
l->admin_state = LINK_ADMINSTATE_OPERATIONAL; |
l->tmpl = tmpl; |
l->tmpl = tmpl; |
l->stay = stay; |
l->stay = stay; |
/* Count link as one more child of parent. */ |
/* Count link as one more child of parent. */ |
Line 1321 LinkStat(Context ctx, int ac, const char *const av[],
|
Line 1361 LinkStat(Context ctx, int ac, const char *const av[],
|
Printf("\tChildren : %d\r\n", l->children); |
Printf("\tChildren : %d\r\n", l->children); |
else { |
else { |
Printf("\tState : %s\r\n", gPhysStateNames[l->state]); |
Printf("\tState : %s\r\n", gPhysStateNames[l->state]); |
|
Printf("\tAdmin. state : %s\r\n", linkAdminStateNames[l->admin_state]); |
Printf("\tSession Id : %s\r\n", l->session_id); |
Printf("\tSession Id : %s\r\n", l->session_id); |
Printf("\tPeer ident : %s\r\n", l->lcp.peer_ident); |
Printf("\tPeer ident : %s\r\n", l->lcp.peer_ident); |
if (l->state == PHYS_STATE_UP) |
if (l->state == PHYS_STATE_UP) |
Line 1529 LinkSetCommand(Context ctx, int ac, const char *const
|
Line 1570 LinkSetCommand(Context ctx, int ac, const char *const
|
name = ((intptr_t)arg == SET_MTU) ? "MTU" : "MRU"; |
name = ((intptr_t)arg == SET_MTU) ? "MTU" : "MRU"; |
if (val < LCP_MIN_MRU) |
if (val < LCP_MIN_MRU) |
Error("min %s is %d", name, LCP_MIN_MRU); |
Error("min %s is %d", name, LCP_MIN_MRU); |
else if (l->type && (val > l->type->mru)) { | else if (l->type && (val > l->type->mtu)) { |
Error("max %s on type \"%s\" links is %d", |
Error("max %s on type \"%s\" links is %d", |
name, l->type->name, l->type->mru); | name, l->type->name, l->type->mtu); |
} else if ((intptr_t)arg == SET_MTU) |
} else if ((intptr_t)arg == SET_MTU) |
l->conf.mtu = val; |
l->conf.mtu = val; |
else |
else |