|
version 1.1, 2012/02/21 23:32:47
|
version 1.1.1.5.2.1, 2023/09/27 11:08:00
|
|
Line 72
|
Line 72
|
| static void BundBmTimeout(void *arg); |
static void BundBmTimeout(void *arg); |
| |
|
| static void BundReasses(Bund b); |
static void BundReasses(Bund b); |
| static int BundSetCommand(Context ctx, int ac, char *av[], void *arg); | static int BundSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
| |
|
| static void BundNcpsUp(Bund b); |
static void BundNcpsUp(Bund b); |
| static void BundNcpsDown(Bund b); |
static void BundNcpsDown(Bund b); |
|
Line 115
|
Line 115
|
| BundSetCommand, NULL, 2, (void *) SET_YES }, |
BundSetCommand, NULL, 2, (void *) SET_YES }, |
| { "no {opt ...}", "Disable and deny option", |
{ "no {opt ...}", "Disable and deny option", |
| BundSetCommand, NULL, 2, (void *) SET_NO }, |
BundSetCommand, NULL, 2, (void *) SET_NO }, |
| { NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
| }; |
}; |
| |
|
| /* |
/* |
|
Line 328 BundJoin(Link l)
|
Line 328 BundJoin(Link l)
|
| |
|
| /* Configure this link */ |
/* Configure this link */ |
| b->pppConfig.links[l->bundleIndex].enableLink = 1; |
b->pppConfig.links[l->bundleIndex].enableLink = 1; |
| b->pppConfig.links[l->bundleIndex].mru = lcp->peer_mru; | b->pppConfig.links[l->bundleIndex].mru = b->iface.mtu_override ? |
| | b->iface.mtu_override : lcp->peer_mru; |
| b->pppConfig.links[l->bundleIndex].enableACFComp = lcp->peer_acfcomp; |
b->pppConfig.links[l->bundleIndex].enableACFComp = lcp->peer_acfcomp; |
| b->pppConfig.links[l->bundleIndex].enableProtoComp = lcp->peer_protocomp; |
b->pppConfig.links[l->bundleIndex].enableProtoComp = lcp->peer_protocomp; |
| b->pppConfig.links[l->bundleIndex].bandwidth = |
b->pppConfig.links[l->bundleIndex].bandwidth = |
|
Line 891 BundUpdateParams(Bund b)
|
Line 892 BundUpdateParams(Bund b)
|
| |
|
| } else if (!b->peer_mrru) { /* If no multilink, use peer MRU */ |
} else if (!b->peer_mrru) { /* If no multilink, use peer MRU */ |
| mtu = MIN(b->links[the_link]->lcp.peer_mru, |
mtu = MIN(b->links[the_link]->lcp.peer_mru, |
| b->links[the_link]->type->mtu); | PhysGetMtu(b->links[the_link], 0)); |
| |
|
| } else { /* Multilink, use peer MRRU */ |
} else { /* Multilink, use peer MRRU */ |
| mtu = MIN(b->peer_mrru, MP_MAX_MRRU); |
mtu = MIN(b->peer_mrru, MP_MAX_MRRU); |
|
Line 899 BundUpdateParams(Bund b)
|
Line 900 BundUpdateParams(Bund b)
|
| |
|
| /* Subtract to make room for various frame-bloating protocols */ |
/* Subtract to make room for various frame-bloating protocols */ |
| if (b->n_up > 0) { |
if (b->n_up > 0) { |
| if (Enabled(&b->conf.options, BUND_CONF_COMPRESSION)) | if (Enabled(&b->conf.options, BUND_CONF_COMPRESSION) && |
| | b->pppConfig.bund.enableCompression) |
| mtu = CcpSubtractBloat(b, mtu); |
mtu = CcpSubtractBloat(b, mtu); |
| if (Enabled(&b->conf.options, BUND_CONF_ENCRYPTION)) | if (Enabled(&b->conf.options, BUND_CONF_ENCRYPTION) && |
| | b->pppConfig.bund.enableEncryption) |
| mtu = EcpSubtractBloat(b, mtu); |
mtu = EcpSubtractBloat(b, mtu); |
| } |
} |
| |
|
|
Line 917 BundUpdateParams(Bund b)
|
Line 920 BundUpdateParams(Bund b)
|
| */ |
*/ |
| |
|
| int |
int |
| BundCommand(Context ctx, int ac, char *av[], void *arg) | BundCommand(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| Bund sb; |
Bund sb; |
| int j, k; |
int j, k; |
| |
|
| |
(void)arg; |
| |
|
| if (ac > 1) |
if (ac > 1) |
| return (-1); |
return (-1); |
| |
|
|
Line 961 BundCommand(Context ctx, int ac, char *av[], void *arg
|
Line 966 BundCommand(Context ctx, int ac, char *av[], void *arg
|
| */ |
*/ |
| |
|
| int |
int |
| MSessionCommand(Context ctx, int ac, char *av[], void *arg) | MSessionCommand(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| int k; |
int k; |
| |
|
| |
(void)arg; |
| |
|
| if (ac > 1) |
if (ac > 1) |
| return (-1); |
return (-1); |
| |
|
|
Line 1005 MSessionCommand(Context ctx, int ac, char *av[], void
|
Line 1012 MSessionCommand(Context ctx, int ac, char *av[], void
|
| */ |
*/ |
| |
|
| int |
int |
| IfaceCommand(Context ctx, int ac, char *av[], void *arg) | IfaceCommand(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| int k; |
int k; |
| |
|
| |
(void)arg; |
| |
|
| if (ac > 1) |
if (ac > 1) |
| return (-1); |
return (-1); |
| |
|
|
Line 1049 IfaceCommand(Context ctx, int ac, char *av[], void *ar
|
Line 1058 IfaceCommand(Context ctx, int ac, char *av[], void *ar
|
| */ |
*/ |
| |
|
| int |
int |
| BundCreate(Context ctx, int ac, char *av[], void *arg) | BundCreate(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| Bund b, bt = NULL; |
Bund b, bt = NULL; |
| u_char tmpl = 0; |
u_char tmpl = 0; |
| u_char stay = 0; |
u_char stay = 0; |
| int k; |
int k; |
| |
|
| |
(void)arg; |
| |
|
| RESETREF(ctx->lnk, NULL); |
RESETREF(ctx->lnk, NULL); |
| RESETREF(ctx->bund, NULL); |
RESETREF(ctx->bund, NULL); |
| RESETREF(ctx->rep, NULL); |
RESETREF(ctx->rep, NULL); |
|
Line 1135 BundCreate(Context ctx, int ac, char *av[], void *arg)
|
Line 1146 BundCreate(Context ctx, int ac, char *av[], void *arg)
|
| /* Setup netgraph stuff */ |
/* Setup netgraph stuff */ |
| if (BundNgInit(b) < 0) { |
if (BundNgInit(b) < 0) { |
| gBundles[b->id] = NULL; |
gBundles[b->id] = NULL; |
| |
IfaceDestroy(b); |
| Freee(b); |
Freee(b); |
| Error("Bundle netgraph initialization failed"); |
Error("Bundle netgraph initialization failed"); |
| } |
} |
|
Line 1152 BundCreate(Context ctx, int ac, char *av[], void *arg)
|
Line 1164 BundCreate(Context ctx, int ac, char *av[], void *arg)
|
| */ |
*/ |
| |
|
| int |
int |
| BundDestroy(Context ctx, int ac, char *av[], void *arg) | BundDestroy(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| Bund b; |
Bund b; |
| |
|
| |
(void)arg; |
| |
|
| if (ac > 1) |
if (ac > 1) |
| return(-1); |
return(-1); |
| |
|
|
Line 1190 BundDestroy(Context ctx, int ac, char *av[], void *arg
|
Line 1204 BundDestroy(Context ctx, int ac, char *av[], void *arg
|
| */ |
*/ |
| |
|
| Bund |
Bund |
| BundInst(Bund bt, char *name, int tmpl, int stay) | BundInst(Bund bt, const char *name, int tmpl, int stay) |
| { |
{ |
| Bund b; |
Bund b; |
| int k; |
int k; |
|
Line 1274 BundShutdown(Bund b)
|
Line 1288 BundShutdown(Bund b)
|
| */ |
*/ |
| |
|
| int |
int |
| BundStat(Context ctx, int ac, char *av[], void *arg) | BundStat(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| Bund sb; |
Bund sb; |
| int k, bw, tbw, nup; |
int k, bw, tbw, nup; |
| char buf[64]; |
char buf[64]; |
| |
|
| |
(void)arg; |
| |
|
| /* Find bundle they're talking about */ |
/* Find bundle they're talking about */ |
| switch (ac) { |
switch (ac) { |
| case 0: |
case 0: |
|
Line 1317 BundStat(Context ctx, int ac, char *av[], void *arg)
|
Line 1333 BundStat(Context ctx, int ac, char *av[], void *arg)
|
| |
|
| /* Show configuration */ |
/* Show configuration */ |
| Printf("Configuration:\r\n"); |
Printf("Configuration:\r\n"); |
| |
#ifdef SIOCSIFDESCR |
| |
Printf("\tDesc. template : %s\r\n", |
| |
sb->iface.conf.ifdescr ? sb->iface.conf.ifdescr : "<none>"); |
| |
Printf("\tDescription : %s\r\n", |
| |
sb->iface.ifdescr ? sb->iface.ifdescr : "<none>"); |
| |
#endif |
| Printf("\tRetry timeout : %d seconds\r\n", sb->conf.retry_timeout); |
Printf("\tRetry timeout : %d seconds\r\n", sb->conf.retry_timeout); |
| Printf("\tBW-manage:\r\n"); |
Printf("\tBW-manage:\r\n"); |
| Printf("\t Period : %d seconds\r\n", sb->conf.bm_S); |
Printf("\t Period : %d seconds\r\n", sb->conf.bm_S); |
|
Line 1387 BundUpdateStats(Bund b)
|
Line 1409 BundUpdateStats(Bund b)
|
| b->stats.runts += abs(stats.runts - b->oldStats.runts); |
b->stats.runts += abs(stats.runts - b->oldStats.runts); |
| b->stats.dupFragments += abs(stats.dupFragments - b->oldStats.dupFragments); |
b->stats.dupFragments += abs(stats.dupFragments - b->oldStats.dupFragments); |
| b->stats.dropFragments += abs(stats.dropFragments - b->oldStats.dropFragments); |
b->stats.dropFragments += abs(stats.dropFragments - b->oldStats.dropFragments); |
| |
b->oldStats = stats; |
| } |
} |
| |
|
| b->oldStats = stats; |
|
| #else |
#else |
| NgFuncGetStats64(b, l, &b->stats); |
NgFuncGetStats64(b, l, &b->stats); |
| #endif |
#endif |
|
Line 1542 BundBmTimeout(void *arg)
|
Line 1564 BundBmTimeout(void *arg)
|
| if (b->links[k] && b->links[k]->joined_bund) { |
if (b->links[k] && b->links[k]->joined_bund) { |
| Link const l = b->links[k]; |
Link const l = b->links[k]; |
| |
|
| |
#ifndef NG_PPP_STATS64 |
| struct ng_ppp_link_stat oldStats; |
struct ng_ppp_link_stat oldStats; |
| |
#else |
| |
struct ng_ppp_link_stat64 oldStats; |
| |
#endif |
| |
|
| /* Get updated link traffic statistics */ |
/* Get updated link traffic statistics */ |
| oldStats = l->bm.idleStats; |
oldStats = l->bm.idleStats; |
| |
#ifndef NG_PPP_STATS64 |
| NgFuncGetStats(l->bund, l->bundleIndex, &l->bm.idleStats); |
NgFuncGetStats(l->bund, l->bundleIndex, &l->bm.idleStats); |
| |
#else |
| |
NgFuncGetStats64(l->bund, l->bundleIndex, &l->bm.idleStats); |
| |
#endif |
| b->bm.traffic[0][0] += l->bm.idleStats.recvOctets - oldStats.recvOctets; |
b->bm.traffic[0][0] += l->bm.idleStats.recvOctets - oldStats.recvOctets; |
| b->bm.traffic[1][0] += l->bm.idleStats.xmitOctets - oldStats.xmitOctets; |
b->bm.traffic[1][0] += l->bm.idleStats.xmitOctets - oldStats.xmitOctets; |
| } |
} |
|
Line 1696 BundNgInit(Bund b)
|
Line 1726 BundNgInit(Bund b)
|
| newPpp = 1; |
newPpp = 1; |
| |
|
| /* Get PPP node ID */ |
/* Get PPP node ID */ |
| b->nodeID = NgGetNodeID(gLinksCsock, b->hook); | if ((b->nodeID = NgGetNodeID(gLinksCsock, b->hook)) == 0) { |
| | Perror("[%s] Cannot get %s node id", b->name, NG_PPP_NODE_TYPE); |
| | goto fail; |
| | } |
| |
|
| /* Give it a name */ |
/* Give it a name */ |
| memset(&nm, 0, sizeof(nm)); |
memset(&nm, 0, sizeof(nm)); |
|
Line 1741 BundNgShutdown(Bund b, int iface, int ppp)
|
Line 1774 BundNgShutdown(Bund b, int iface, int ppp)
|
| */ |
*/ |
| |
|
| static int |
static int |
| BundSetCommand(Context ctx, int ac, char *av[], void *arg) | BundSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
| { |
{ |
| Bund b = ctx->bund; |
Bund b = ctx->bund; |
| int i, val; |
int i, val; |