--- embedaddon/mpd/src/bund.c 2019/10/22 13:49:55 1.1.1.4 +++ embedaddon/mpd/src/bund.c 2021/03/17 00:39:23 1.1.1.5 @@ -72,7 +72,7 @@ static void BundBmTimeout(void *arg); 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 BundNcpsDown(Bund b); @@ -115,7 +115,7 @@ BundSetCommand, NULL, 2, (void *) SET_YES }, { "no {opt ...}", "Disable and deny option", BundSetCommand, NULL, 2, (void *) SET_NO }, - { NULL }, + { NULL, NULL, NULL, NULL, 0, NULL }, }; /* @@ -918,11 +918,13 @@ BundUpdateParams(Bund b) */ int -BundCommand(Context ctx, int ac, char *av[], void *arg) +BundCommand(Context ctx, int ac, const char *const av[], const void *arg) { Bund sb; int j, k; + (void)arg; + if (ac > 1) return (-1); @@ -962,10 +964,12 @@ BundCommand(Context ctx, int ac, char *av[], void *arg */ int -MSessionCommand(Context ctx, int ac, char *av[], void *arg) +MSessionCommand(Context ctx, int ac, const char *const av[], const void *arg) { int k; + (void)arg; + if (ac > 1) return (-1); @@ -1006,10 +1010,12 @@ MSessionCommand(Context ctx, int ac, char *av[], void */ int -IfaceCommand(Context ctx, int ac, char *av[], void *arg) +IfaceCommand(Context ctx, int ac, const char *const av[], const void *arg) { int k; + (void)arg; + if (ac > 1) return (-1); @@ -1050,13 +1056,15 @@ IfaceCommand(Context ctx, int ac, char *av[], void *ar */ 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; u_char tmpl = 0; u_char stay = 0; int k; + (void)arg; + RESETREF(ctx->lnk, NULL); RESETREF(ctx->bund, NULL); RESETREF(ctx->rep, NULL); @@ -1154,10 +1162,12 @@ BundCreate(Context ctx, int ac, char *av[], void *arg) */ int -BundDestroy(Context ctx, int ac, char *av[], void *arg) +BundDestroy(Context ctx, int ac, const char *const av[], const void *arg) { Bund b; + (void)arg; + if (ac > 1) return(-1); @@ -1192,7 +1202,7 @@ BundDestroy(Context ctx, int ac, char *av[], void *arg */ Bund -BundInst(Bund bt, char *name, int tmpl, int stay) +BundInst(Bund bt, const char *name, int tmpl, int stay) { Bund b; int k; @@ -1276,12 +1286,14 @@ BundShutdown(Bund b) */ int -BundStat(Context ctx, int ac, char *av[], void *arg) +BundStat(Context ctx, int ac, const char *const av[], const void *arg) { Bund sb; int k, bw, tbw, nup; char buf[64]; + (void)arg; + /* Find bundle they're talking about */ switch (ac) { case 0: @@ -1550,11 +1562,19 @@ BundBmTimeout(void *arg) if (b->links[k] && b->links[k]->joined_bund) { Link const l = b->links[k]; +#ifndef NG_PPP_STATS64 struct ng_ppp_link_stat oldStats; +#else + struct ng_ppp_link_stat64 oldStats; +#endif /* Get updated link traffic statistics */ oldStats = l->bm.idleStats; +#ifndef NG_PPP_STATS64 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[1][0] += l->bm.idleStats.xmitOctets - oldStats.xmitOctets; } @@ -1704,7 +1724,10 @@ BundNgInit(Bund b) newPpp = 1; /* 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 */ memset(&nm, 0, sizeof(nm)); @@ -1749,7 +1772,7 @@ BundNgShutdown(Bund b, int iface, int ppp) */ 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; int i, val;