version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.3, 2019/10/22 13:49:55
|
Line 145
|
Line 145
|
{ 0, LINK_CONF_TIMEREMAIN, "time-remain" }, |
{ 0, LINK_CONF_TIMEREMAIN, "time-remain" }, |
{ 0, LINK_CONF_PEER_AS_CALLING, "peer-as-calling" }, |
{ 0, LINK_CONF_PEER_AS_CALLING, "peer-as-calling" }, |
{ 0, LINK_CONF_REPORT_MAC, "report-mac" }, |
{ 0, LINK_CONF_REPORT_MAC, "report-mac" }, |
|
{ 0, LINK_CONF_REMOVE_TEE, "remove-tee" }, |
{ 0, 0, NULL }, |
{ 0, 0, NULL }, |
}; |
}; |
|
|
Line 428 LinkCreate(Context ctx, int ac, char *av[], void *arg)
|
Line 429 LinkCreate(Context ctx, int ac, char *av[], void *arg)
|
l->upReasonValid = 0; |
l->upReasonValid = 0; |
l->downReason = NULL; |
l->downReason = NULL; |
l->downReasonValid = 0; |
l->downReasonValid = 0; |
|
l->tee_removed = 0; |
|
|
Disable(&l->conf.options, LINK_CONF_CHAPMD5); |
Disable(&l->conf.options, LINK_CONF_CHAPMD5); |
Accept(&l->conf.options, LINK_CONF_CHAPMD5); |
Accept(&l->conf.options, LINK_CONF_CHAPMD5); |
Line 717 LinkNgJoin(Link l)
|
Line 719 LinkNgJoin(Link l)
|
} |
} |
|
|
NgFuncDisconnect(gLinksCsock, l->name, path, NG_TEE_HOOK_LEFT2RIGHT); |
NgFuncDisconnect(gLinksCsock, l->name, path, NG_TEE_HOOK_LEFT2RIGHT); |
|
|
|
if (Enabled(&l->conf.options, LINK_CONF_REMOVE_TEE)) { |
|
if (l->stay == 0) { |
|
Log(LG_LINK, ("[%s] Link: Removing ng_tee node", l->name)); |
|
NgFuncShutdownNode(gLinksCsock, NG_TEE_NODE_TYPE, path); |
|
l->tee_removed = 1; |
|
} else |
|
Log(LG_LINK, ("[%s] Link: Can't remove ng_tee node on static link", |
|
l->name)); |
|
} |
return (0); |
return (0); |
} |
} |
|
|
Line 730 LinkNgLeave(Link l)
|
Line 742 LinkNgLeave(Link l)
|
char path[NG_PATHSIZ]; |
char path[NG_PATHSIZ]; |
struct ngm_connect cn; |
struct ngm_connect cn; |
|
|
|
/* ng_tee is already removed */ |
|
if (l->tee_removed == 1) |
|
return(0); |
|
|
memset(&cn, 0, sizeof(cn)); |
memset(&cn, 0, sizeof(cn)); |
snprintf(cn.path, sizeof(cn.path), "[%lx]:", (u_long)l->nodeID); |
snprintf(cn.path, sizeof(cn.path), "[%lx]:", (u_long)l->nodeID); |
strcpy(cn.ourhook, l->hook); |
strcpy(cn.ourhook, l->hook); |
Line 818 LinkNgDataEvent(int type, void *cookie)
|
Line 834 LinkNgDataEvent(int type, void *cookie)
|
mbfree(bp); |
mbfree(bp); |
if (errno == EAGAIN) |
if (errno == EAGAIN) |
return; |
return; |
Log(LG_LINK, ("Link socket read error: %s", strerror(errno))); | Perror("Link: Link socket read error"); |
return; |
return; |
} |
} |
num++; |
num++; |
Line 829 LinkNgDataEvent(int type, void *cookie)
|
Line 845 LinkNgDataEvent(int type, void *cookie)
|
name++; |
name++; |
id = strtol(name, &rest, 10); |
id = strtol(name, &rest, 10); |
if (rest[0] != 0 || !gLinks[id]) { |
if (rest[0] != 0 || !gLinks[id]) { |
Log(LG_ERR, ("Link: packet from unexisting link \"%s\"", | Log(LG_ERR, ("Link: Packet from unexisting link \"%s\"", |
name)); |
name)); |
mbfree(bp); |
mbfree(bp); |
continue; |
continue; |
Line 851 LinkNgDataEvent(int type, void *cookie)
|
Line 867 LinkNgDataEvent(int type, void *cookie)
|
|
|
if (MBLEN(bp) <= ptr) { |
if (MBLEN(bp) <= ptr) { |
LogDumpBp(LG_FRAME|LG_ERR, bp, |
LogDumpBp(LG_FRAME|LG_ERR, bp, |
"[%s] rec'd truncated %d bytes frame from link", | "[%s] rec'd truncated %zu bytes frame from link", |
l->name, MBLEN(bp)); |
l->name, MBLEN(bp)); |
mbfree(bp); |
mbfree(bp); |
continue; |
continue; |
Line 859 LinkNgDataEvent(int type, void *cookie)
|
Line 875 LinkNgDataEvent(int type, void *cookie)
|
|
|
/* Debugging */ |
/* Debugging */ |
LogDumpBp(LG_FRAME, bp, |
LogDumpBp(LG_FRAME, bp, |
"[%s] rec'd %d bytes frame from link proto=0x%04x", | "[%s] rec'd %zu bytes frame from link proto=0x%04x", |
l->name, MBLEN(bp), proto); |
l->name, MBLEN(bp), proto); |
|
|
bp = mbadj(bp, ptr); |
bp = mbadj(bp, ptr); |
Line 894 LinkNgDataEvent(int type, void *cookie)
|
Line 910 LinkNgDataEvent(int type, void *cookie)
|
|
|
if (MBLEN(bp) <= 4) { |
if (MBLEN(bp) <= 4) { |
LogDumpBp(LG_FRAME|LG_ERR, bp, |
LogDumpBp(LG_FRAME|LG_ERR, bp, |
"[%s] rec'd truncated %d bytes frame", | "[%s] rec'd truncated %zu bytes frame", |
b->name, MBLEN(bp)); |
b->name, MBLEN(bp)); |
continue; |
continue; |
} |
} |
Line 907 LinkNgDataEvent(int type, void *cookie)
|
Line 923 LinkNgDataEvent(int type, void *cookie)
|
|
|
/* Debugging */ |
/* Debugging */ |
LogDumpBp(LG_FRAME, bp, |
LogDumpBp(LG_FRAME, bp, |
"[%s] rec'd %d bytes bypass frame link=%d proto=0x%04x", | "[%s] rec'd %zu bytes bypass frame link=%d proto=0x%04x", |
b->name, MBLEN(bp), (int16_t)linkNum, proto); |
b->name, MBLEN(bp), (int16_t)linkNum, proto); |
|
|
/* Set link */ |
/* Set link */ |
Line 924 LinkNgDataEvent(int type, void *cookie)
|
Line 940 LinkNgDataEvent(int type, void *cookie)
|
|
|
/* Debugging */ |
/* Debugging */ |
LogDumpBp(LG_FRAME, bp, |
LogDumpBp(LG_FRAME, bp, |
"[%s] rec'd %d bytes frame on %s hook", b->name, MBLEN(bp), naddr.sg_data); | "[%s] rec'd %zu bytes frame on %s hook", b->name, MBLEN(bp), naddr.sg_data); |
|
|
#ifndef USE_NG_TCPMSS |
#ifndef USE_NG_TCPMSS |
/* A snooped, outgoing TCP SYN frame */ |
/* A snooped, outgoing TCP SYN frame */ |
Line 1088 AuthnameCommand(Context ctx, int ac, char *av[], void
|
Line 1104 AuthnameCommand(Context ctx, int ac, char *av[], void
|
{ |
{ |
int k; |
int k; |
|
|
if (ac > 1) | if (ac > 2) |
return (-1); |
return (-1); |
|
|
if (ac == 0) { |
if (ac == 0) { |
Line 1100 AuthnameCommand(Context ctx, int ac, char *av[], void
|
Line 1116 AuthnameCommand(Context ctx, int ac, char *av[], void
|
return (0); |
return (0); |
} |
} |
|
|
/* Find link */ | if (ac == 2 && strcasecmp(av[1], "ci") == 0) { |
for (k = 0; | /* Find link */ |
k < gNumLinks && (gLinks[k] == NULL || | for (k = 0; |
strcmp(gLinks[k]->lcp.auth.params.authname, av[0])); | k < gNumLinks && (gLinks[k] == NULL || |
k++); | strcasecmp(gLinks[k]->lcp.auth.params.authname, av[0])); |
| k++); |
| } else { |
| /* Find link */ |
| for (k = 0; |
| k < gNumLinks && (gLinks[k] == NULL || |
| strcmp(gLinks[k]->lcp.auth.params.authname, av[0])); |
| k++); |
| } |
if (k == gNumLinks) { |
if (k == gNumLinks) { |
/* Change default link and bundle */ |
/* Change default link and bundle */ |
RESETREF(ctx->lnk, NULL); |
RESETREF(ctx->lnk, NULL); |
Line 1335 LinkUpdateStats(Link l)
|
Line 1359 LinkUpdateStats(Link l)
|
l->stats.runts += abs(stats.runts - l->oldStats.runts); |
l->stats.runts += abs(stats.runts - l->oldStats.runts); |
l->stats.dupFragments += abs(stats.dupFragments - l->oldStats.dupFragments); |
l->stats.dupFragments += abs(stats.dupFragments - l->oldStats.dupFragments); |
l->stats.dropFragments += abs(stats.dropFragments - l->oldStats.dropFragments); |
l->stats.dropFragments += abs(stats.dropFragments - l->oldStats.dropFragments); |
|
l->oldStats = stats; |
} |
} |
|
|
l->oldStats = stats; |
|
#else |
#else |
NgFuncGetStats64(l->bund, l->bundleIndex, &l->stats); |
NgFuncGetStats64(l->bund, l->bundleIndex, &l->stats); |
#endif |
#endif |