version 1.1.1.2, 2013/07/22 08:44:29
|
version 1.1.1.4, 2021/03/17 00:39:23
|
Line 101
|
Line 101
|
*/ |
*/ |
|
|
/* Commands */ |
/* Commands */ |
static int ShowVersion(Context ctx, int ac, char *av[], void *arg); | static int ShowVersion(Context ctx, int ac, const char *const av[], const void *arg); |
static int ShowLayers(Context ctx, int ac, char *av[], void *arg); | static int ShowLayers(Context ctx, int ac, const char *const av[], const void *arg); |
static int ShowTypes(Context ctx, int ac, char *av[], void *arg); | static int ShowTypes(Context ctx, int ac, const char *const av[], const void *arg); |
static int ShowSummary(Context ctx, int ac, char *av[], void *arg); | static int ShowSummary(Context ctx, int ac, const char *const av[], const void *arg); |
static int ShowSessions(Context ctx, int ac, char *av[], void *arg); | static int ShowSessions(Context ctx, int ac, const char *const av[], const void *arg); |
static int ShowCustomer(Context ctx, int ac, char *av[], void *arg); | static int ShowCustomer(Context ctx, int ac, const char *const av[], const void *arg); |
static int ShowEvents(Context ctx, int ac, char *av[], void *arg); | static int ShowEvents(Context ctx, int ac, const char *const av[], const void *arg); |
static int ShowGlobal(Context ctx, int ac, char *av[], void *arg); | static int ShowGlobal(Context ctx, int ac, const char *const av[], const void *arg); |
static int OpenCommand(Context ctx, int ac, char *av[], void *arg); | static int OpenCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static int CloseCommand(Context ctx, int ac, char *av[], void *arg); | static int CloseCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static int LoadCommand(Context ctx, int ac, char *av[], void *arg); | static int LoadCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static int ExitCommand(Context ctx, int ac, char *av[], void *arg); | static int ExitCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static int QuitCommand(Context ctx, int ac, char *av[], void *arg); | static int QuitCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static int GlobalSetCommand(Context ctx, int ac, char *av[], void *arg); | static int GlobalSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
static int SetDebugCommand(Context ctx, int ac, char *av[], void *arg); | static int SetDebugCommand(Context ctx, int ac, const char *const av[], const void *arg); |
|
|
/* Other stuff */ |
/* Other stuff */ |
static Layer GetLayer(const char *name); |
static Layer GetLayer(const char *name); |
Line 124
|
Line 124
|
* INTERNAL VARIABLES |
* INTERNAL VARIABLES |
*/ |
*/ |
|
|
const struct cmdtab GlobalSetCmds[] = { | static const struct cmdtab GlobalSetCmds[] = { |
{ "enable {opt ...}", "Enable option" , |
{ "enable {opt ...}", "Enable option" , |
GlobalSetCommand, NULL, 2, (void *) SET_ENABLE }, |
GlobalSetCommand, NULL, 2, (void *) SET_ENABLE }, |
{ "disable {opt ...}", "Disable option" , |
{ "disable {opt ...}", "Disable option" , |
Line 159
|
Line 159
|
{ "filter {num} add|clear [\"{flt}\"]", "Global traffic filters management", |
{ "filter {num} add|clear [\"{flt}\"]", "Global traffic filters management", |
GlobalSetCommand, NULL, 2, (void *) SET_FILTER }, |
GlobalSetCommand, NULL, 2, (void *) SET_FILTER }, |
#endif |
#endif |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
static const struct confinfo gGlobalConfList[] = { |
static const struct confinfo gGlobalConfList[] = { |
Line 167
|
Line 167
|
{ 0, GLOBAL_CONF_TCPWRAPPER, "tcp-wrapper" }, |
{ 0, GLOBAL_CONF_TCPWRAPPER, "tcp-wrapper" }, |
#endif |
#endif |
{ 0, GLOBAL_CONF_ONESHOT, "one-shot" }, |
{ 0, GLOBAL_CONF_ONESHOT, "one-shot" }, |
|
{ 0, GLOBAL_CONF_AGENT_CID, "agent-cid" }, |
|
{ 0, GLOBAL_CONF_SESS_TIME, "session-time" }, |
{ 0, 0, NULL }, |
{ 0, 0, NULL }, |
}; |
}; |
|
|
Line 175
|
Line 177
|
LinkCreate, NULL, 2, NULL }, |
LinkCreate, NULL, 2, NULL }, |
{ "bundle [template|static] {name} {template}", "Create bundle/template", |
{ "bundle [template|static] {name} {template}", "Create bundle/template", |
BundCreate, NULL, 2, NULL }, |
BundCreate, NULL, 2, NULL }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
static const struct cmdtab DestroyCommands[] = { |
static const struct cmdtab DestroyCommands[] = { |
Line 183
|
Line 185
|
LinkDestroy, NULL, 2, NULL }, |
LinkDestroy, NULL, 2, NULL }, |
{ "bundle [{name}]", "Destroy bundle/template", |
{ "bundle [{name}]", "Destroy bundle/template", |
BundDestroy, NULL, 2, NULL }, |
BundDestroy, NULL, 2, NULL }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
static const struct cmdtab ShowSessCmds[] = { |
static const struct cmdtab ShowSessCmds[] = { |
Line 203
|
Line 205
|
ShowSessions, NULL, 0, (void *) SHOW_LINK }, |
ShowSessions, NULL, 0, (void *) SHOW_LINK }, |
{ "peer {name}", "Filter by peer name", |
{ "peer {name}", "Filter by peer name", |
ShowSessions, NULL, 0, (void *) SHOW_PEER }, |
ShowSessions, NULL, 0, (void *) SHOW_PEER }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
static const struct cmdtab ShowCommands[] = { |
static const struct cmdtab ShowCommands[] = { |
Line 280
|
Line 282
|
{ "version", "Version string", |
{ "version", "Version string", |
ShowVersion, NULL, 0, NULL }, |
ShowVersion, NULL, 0, NULL }, |
{ "sessions [ {param} {value} ]", "Active sessions", |
{ "sessions [ {param} {value} ]", "Active sessions", |
CMD_SUBMENU, NULL, 0, (void *) ShowSessCmds}, | CMD_SUBMENU, NULL, 0, ShowSessCmds}, |
{ "summary", "Daemon status summary", |
{ "summary", "Daemon status summary", |
ShowSummary, NULL, 0, NULL }, |
ShowSummary, NULL, 0, NULL }, |
#ifdef USE_NG_NETFLOW |
#ifdef USE_NG_NETFLOW |
{ "netflow", "Netflow settings", |
{ "netflow", "Netflow settings", |
ShowNetflow, NULL, 0, NULL }, |
ShowNetflow, NULL, 0, NULL }, |
#endif |
#endif |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
static const struct cmdtab UnSetCommands[] = { |
static const struct cmdtab UnSetCommands[] = { |
{ "radius ...", "RADIUS specific stuff", |
{ "radius ...", "RADIUS specific stuff", |
CMD_SUBMENU, AdmitLink, 2, (void *) RadiusUnSetCmds }, | CMD_SUBMENU, AdmitLink, 2, RadiusUnSetCmds }, |
#ifdef NG_NAT_DESC_LENGTH |
#ifdef NG_NAT_DESC_LENGTH |
{ "nat ...", "NAT specific stuff", |
{ "nat ...", "NAT specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) NatUnSetCmds }, | CMD_SUBMENU, AdmitBund, 2, NatUnSetCmds }, |
#endif |
#endif |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
static const struct cmdtab SetCommands[] = { |
static const struct cmdtab SetCommands[] = { |
{ "bundle ...", "Bundle specific stuff", |
{ "bundle ...", "Bundle specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) BundSetCmds }, | CMD_SUBMENU, AdmitBund, 2, BundSetCmds }, |
{ "link ...", "Link specific stuff", |
{ "link ...", "Link specific stuff", |
CMD_SUBMENU, AdmitLink, 2, (void *) LinkSetCmds }, | CMD_SUBMENU, AdmitLink, 2, LinkSetCmds }, |
{ "iface ...", "Interface specific stuff", |
{ "iface ...", "Interface specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) IfaceSetCmds }, | CMD_SUBMENU, AdmitBund, 2, IfaceSetCmds }, |
{ "ipcp ...", "IPCP specific stuff", |
{ "ipcp ...", "IPCP specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) IpcpSetCmds }, | CMD_SUBMENU, AdmitBund, 2, IpcpSetCmds }, |
{ "ipv6cp ...", "IPV6CP specific stuff", |
{ "ipv6cp ...", "IPV6CP specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) Ipv6cpSetCmds }, | CMD_SUBMENU, AdmitBund, 2, Ipv6cpSetCmds }, |
{ "ippool ...", "IP pool specific stuff", |
{ "ippool ...", "IP pool specific stuff", |
CMD_SUBMENU, NULL, 2, (void *) IPPoolSetCmds }, | CMD_SUBMENU, NULL, 2, IPPoolSetCmds }, |
{ "ccp ...", "CCP specific stuff", |
{ "ccp ...", "CCP specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) CcpSetCmds }, | CMD_SUBMENU, AdmitBund, 2, CcpSetCmds }, |
#ifdef CCP_MPPC |
#ifdef CCP_MPPC |
{ "mppc ...", "MPPC specific stuff", |
{ "mppc ...", "MPPC specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) MppcSetCmds }, | CMD_SUBMENU, AdmitBund, 2, MppcSetCmds }, |
#endif |
#endif |
{ "ecp ...", "ECP specific stuff", |
{ "ecp ...", "ECP specific stuff", |
CMD_SUBMENU, AdmitBund, 2, (void *) EcpSetCmds }, | CMD_SUBMENU, AdmitBund, 2, EcpSetCmds }, |
{ "eap ...", "EAP specific stuff", |
{ "eap ...", "EAP specific stuff", |
CMD_SUBMENU, AdmitLink, 2, (void *) EapSetCmds }, | CMD_SUBMENU, AdmitLink, 2, EapSetCmds }, |
{ "auth ...", "Auth specific stuff", |
{ "auth ...", "Auth specific stuff", |
CMD_SUBMENU, AdmitLink, 2, (void *) AuthSetCmds }, | CMD_SUBMENU, AdmitLink, 2, AuthSetCmds }, |
{ "radius ...", "RADIUS specific stuff", |
{ "radius ...", "RADIUS specific stuff", |
CMD_SUBMENU, AdmitLink, 2, (void *) RadiusSetCmds }, | CMD_SUBMENU, AdmitLink, 2, RadiusSetCmds }, |
#ifdef RAD_COA_REQUEST |
#ifdef RAD_COA_REQUEST |
{ "radsrv ...", "RADIUS server specific stuff", |
{ "radsrv ...", "RADIUS server specific stuff", |
CMD_SUBMENU, NULL, 2, (void *) RadsrvSetCmds }, | CMD_SUBMENU, NULL, 2, RadsrvSetCmds }, |
#endif |
#endif |
{ "console ...", "Console specific stuff", |
{ "console ...", "Console specific stuff", |
CMD_SUBMENU, NULL, 0, (void *) ConsoleSetCmds }, | CMD_SUBMENU, NULL, 0, ConsoleSetCmds }, |
#ifndef NOWEB |
#ifndef NOWEB |
{ "web ...", "Web specific stuff", |
{ "web ...", "Web specific stuff", |
CMD_SUBMENU, NULL, 2, (void *) WebSetCmds }, | CMD_SUBMENU, NULL, 2, WebSetCmds }, |
#endif |
#endif |
{ "user {name} {password} [{priv}]", "Add console user" , |
{ "user {name} {password} [{priv}]", "Add console user" , |
UserCommand, NULL, 2, NULL }, |
UserCommand, NULL, 2, NULL }, |
{ "global ...", "Global settings", |
{ "global ...", "Global settings", |
CMD_SUBMENU, NULL, 2, (void *) GlobalSetCmds }, | CMD_SUBMENU, NULL, 2, GlobalSetCmds }, |
#ifdef USE_NG_NETFLOW |
#ifdef USE_NG_NETFLOW |
{ "netflow ...", "NetFlow settings", |
{ "netflow ...", "NetFlow settings", |
CMD_SUBMENU, NULL, 2, (void *) NetflowSetCmds }, | CMD_SUBMENU, NULL, 2, NetflowSetCmds }, |
#endif |
#endif |
#ifdef USE_NG_NAT |
#ifdef USE_NG_NAT |
{ "nat ...", "Nat settings", |
{ "nat ...", "Nat settings", |
CMD_SUBMENU, NULL, 2, (void *) NatSetCmds }, | CMD_SUBMENU, NULL, 2, NatSetCmds }, |
#endif |
#endif |
{ "debug level", "Set netgraph debug level", |
{ "debug level", "Set netgraph debug level", |
SetDebugCommand, NULL, 2, NULL }, |
SetDebugCommand, NULL, 2, NULL }, |
#define _WANT_DEVICE_CMDS |
#define _WANT_DEVICE_CMDS |
#include "devices.h" |
#include "devices.h" |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
const struct cmdtab gCommands[] = { |
const struct cmdtab gCommands[] = { |
{ "authname {name}", "Choose link by auth name", | { "authname {name} [CI]", "Choose link by auth name", |
AuthnameCommand, NULL, 0, NULL }, |
AuthnameCommand, NULL, 0, NULL }, |
{ "bundle [{name}]", "Choose/list bundles", |
{ "bundle [{name}]", "Choose/list bundles", |
BundCommand, NULL, 0, NULL }, |
BundCommand, NULL, 0, NULL }, |
{ "close [{layer}]", "Close a layer", |
{ "close [{layer}]", "Close a layer", |
CloseCommand, NULL, 1, NULL }, |
CloseCommand, NULL, 1, NULL }, |
{ "create ...", "Create new item", |
{ "create ...", "Create new item", |
CMD_SUBMENU, NULL, 2, (void *) CreateCommands }, | CMD_SUBMENU, NULL, 2, CreateCommands }, |
{ "destroy ...", "Destroy item", |
{ "destroy ...", "Destroy item", |
CMD_SUBMENU, NULL, 2, (void *) DestroyCommands }, | CMD_SUBMENU, NULL, 2, DestroyCommands }, |
{ "exit", "Exit console", |
{ "exit", "Exit console", |
ExitCommand, NULL, 0, NULL }, |
ExitCommand, NULL, 0, NULL }, |
{ "iface {iface}", "Choose bundle by iface", |
{ "iface {iface}", "Choose bundle by iface", |
Line 383
|
Line 385
|
MSessionCommand, NULL, 0, NULL }, |
MSessionCommand, NULL, 0, NULL }, |
{ "open [{layer}]", "Open a layer", |
{ "open [{layer}]", "Open a layer", |
OpenCommand, NULL, 1, NULL }, |
OpenCommand, NULL, 1, NULL }, |
{ "quit", "Quit program", | { "shutdown", "Shutdown program", |
QuitCommand, NULL, 2, NULL }, |
QuitCommand, NULL, 2, NULL }, |
{ "repeater [{name}]", "Choose/list repeaters", |
{ "repeater [{name}]", "Choose/list repeaters", |
RepCommand, NULL, 0, NULL }, |
RepCommand, NULL, 0, NULL }, |
{ "session {sesid}", "Choose link by session-id", |
{ "session {sesid}", "Choose link by session-id", |
SessionCommand, NULL, 0, NULL }, |
SessionCommand, NULL, 0, NULL }, |
{ "set ...", "Set parameters", |
{ "set ...", "Set parameters", |
CMD_SUBMENU, NULL, 0, (void *) SetCommands }, | CMD_SUBMENU, NULL, 0, SetCommands }, |
{ "unset ...", "Unset parameters", |
{ "unset ...", "Unset parameters", |
CMD_SUBMENU, NULL, 0, (void *) UnSetCommands }, | CMD_SUBMENU, NULL, 0, UnSetCommands }, |
{ "show ...", "Show status", |
{ "show ...", "Show status", |
CMD_SUBMENU, NULL, 0, (void *) ShowCommands }, | CMD_SUBMENU, NULL, 0, ShowCommands }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
|
|
Line 404
|
Line 406
|
* Layers |
* Layers |
*/ |
*/ |
|
|
struct layer gLayers[] = { | static struct layer gLayers[] = { |
{ "iface", |
{ "iface", |
IfaceOpenCmd, |
IfaceOpenCmd, |
IfaceCloseCmd, |
IfaceCloseCmd, |
Line 464
|
Line 466
|
*/ |
*/ |
|
|
int |
int |
DoCommand(Context ctx, int ac, char *av[], const char *file, int line) | DoCommand(Context ctx, int ac, const char *const av[], const char *file, int line) |
{ |
{ |
int rtn, i; |
int rtn, i; |
char filebuf[100], cmd[256]; |
char filebuf[100], cmd[256]; |
Line 528 DoCommand(Context ctx, int ac, char *av[], const char
|
Line 530 DoCommand(Context ctx, int ac, char *av[], const char
|
*/ |
*/ |
|
|
int |
int |
DoCommandTab(Context ctx, CmdTab cmdlist, int ac, char *av[]) | DoCommandTab(Context ctx, CmdTab cmdlist, int ac, const char *const av[]) |
{ |
{ |
CmdTab cmd; |
CmdTab cmd; |
int rtn = 0; |
int rtn = 0; |
Line 565 DoCommandTab(Context ctx, CmdTab cmdlist, int ac, char
|
Line 567 DoCommandTab(Context ctx, CmdTab cmdlist, int ac, char
|
*/ |
*/ |
|
|
int |
int |
FindCommand(Context ctx, CmdTab cmds, char *str, CmdTab *cmdp) | FindCommand(Context ctx, CmdTab cmds, const char *str, CmdTab *cmdp) |
{ |
{ |
int nmatch; |
int nmatch; |
int len = strlen(str); |
int len = strlen(str); |
Line 595 FindCommand(Context ctx, CmdTab cmds, char *str, CmdTa
|
Line 597 FindCommand(Context ctx, CmdTab cmds, char *str, CmdTa
|
*/ |
*/ |
|
|
static int |
static int |
GlobalSetCommand(Context ctx, int ac, char *av[], void *arg) | GlobalSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
int val; |
int val; |
|
|
Line 675 GlobalSetCommand(Context ctx, int ac, char *av[], void
|
Line 677 GlobalSetCommand(Context ctx, int ac, char *av[], void
|
if (val < 0 || val > 65536) |
if (val < 0 || val > 65536) |
Error("Incorrect L2TP call limit"); |
Error("Incorrect L2TP call limit"); |
else |
else |
gL2TPtunlimit = val; | gL2TPtunlimit = (unsigned)val; |
break; |
break; |
#endif |
#endif |
|
|
Line 693 GlobalSetCommand(Context ctx, int ac, char *av[], void
|
Line 695 GlobalSetCommand(Context ctx, int ac, char *av[], void
|
if (val <= 0 || val > 65536) |
if (val <= 0 || val > 65536) |
Error("Incorrect PPTP call limit"); |
Error("Incorrect PPTP call limit"); |
else |
else |
gPPTPtunlimit = val; | gPPTPtunlimit = (unsigned)val; |
break; |
break; |
#endif |
#endif |
|
|
Line 789 GlobalSetCommand(Context ctx, int ac, char *av[], void
|
Line 791 GlobalSetCommand(Context ctx, int ac, char *av[], void
|
*/ |
*/ |
|
|
int |
int |
HelpCommand(Context ctx, int ac, char *av[], void *arg) | HelpCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
int depth, i; |
int depth, i; |
CmdTab menu, cmd; |
CmdTab menu, cmd; |
Line 812 HelpCommand(Context ctx, int ac, char *av[], void *arg
|
Line 814 HelpCommand(Context ctx, int ac, char *av[], void *arg
|
else |
else |
errfmt = "%sUnknown command: '%s'.\r\n"; |
errfmt = "%sUnknown command: '%s'.\r\n"; |
if (arg) { |
if (arg) { |
Printf(errfmt, (char*)arg, buf); | Printf(errfmt, (const char*)arg, buf); |
} else { |
} else { |
Printf(errfmt, "", buf); |
Printf(errfmt, "", buf); |
} |
} |
Line 856 HelpCommand(Context ctx, int ac, char *av[], void *arg
|
Line 858 HelpCommand(Context ctx, int ac, char *av[], void *arg
|
*/ |
*/ |
|
|
static int |
static int |
SetDebugCommand(Context ctx, int ac, char *av[], void *arg) | SetDebugCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
|
(void)arg; |
|
(void)ctx; |
|
|
switch (ac) { |
switch (ac) { |
case 1: |
case 1: |
NgSetDebug(atoi(av[0])); |
NgSetDebug(atoi(av[0])); |
Line 873 SetDebugCommand(Context ctx, int ac, char *av[], void
|
Line 878 SetDebugCommand(Context ctx, int ac, char *av[], void
|
*/ |
*/ |
|
|
static int |
static int |
ShowVersion(Context ctx, int ac, char *av[], void *arg) | ShowVersion(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("MPD version: %s\r\n", gVersion); |
Printf("MPD version: %s\r\n", gVersion); |
Printf(" Available features:\r\n"); |
Printf(" Available features:\r\n"); |
#ifdef USE_IPFW |
#ifdef USE_IPFW |
Line 887 ShowVersion(Context ctx, int ac, char *av[], void *arg
|
Line 896 ShowVersion(Context ctx, int ac, char *av[], void *arg
|
#else |
#else |
Printf(" config fetch : no\r\n"); |
Printf(" config fetch : no\r\n"); |
#endif |
#endif |
|
#ifdef USE_BACKTRACE |
|
Printf(" backtrace() : yes\r\n"); |
|
#else |
|
Printf(" backtrace() : no\r\n"); |
|
#endif |
#ifdef USE_NG_BPF |
#ifdef USE_NG_BPF |
Printf(" ng_bpf : yes\r\n"); |
Printf(" ng_bpf : yes\r\n"); |
#else |
#else |
Line 952 ShowVersion(Context ctx, int ac, char *av[], void *arg
|
Line 966 ShowVersion(Context ctx, int ac, char *av[], void *arg
|
*/ |
*/ |
|
|
static int |
static int |
ShowEvents(Context ctx, int ac, char *av[], void *arg) | ShowEvents(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
EventDump(ctx, "mpd events"); | (void)ac; |
| (void)av; |
| (void)arg; |
| |
| EventDump(ctx); |
return(0); |
return(0); |
} |
} |
|
|
Line 963 ShowEvents(Context ctx, int ac, char *av[], void *arg)
|
Line 981 ShowEvents(Context ctx, int ac, char *av[], void *arg)
|
*/ |
*/ |
|
|
static int |
static int |
ShowGlobal(Context ctx, int ac, char *av[], void *arg) | ShowGlobal(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
#ifdef USE_NG_BPF |
#ifdef USE_NG_BPF |
int k; |
int k; |
#endif |
#endif |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("Global settings:\r\n"); |
Printf("Global settings:\r\n"); |
#ifdef USE_IPFW |
#ifdef USE_IPFW |
Printf(" startrule : %d\r\n", rule_pool_start); |
Printf(" startrule : %d\r\n", rule_pool_start); |
Line 978 ShowGlobal(Context ctx, int ac, char *av[], void *arg)
|
Line 1000 ShowGlobal(Context ctx, int ac, char *av[], void *arg)
|
#endif |
#endif |
#ifdef PHYSTYPE_L2TP |
#ifdef PHYSTYPE_L2TP |
Printf(" l2tptimeout : %d\r\n", gL2TPto); |
Printf(" l2tptimeout : %d\r\n", gL2TPto); |
Printf(" l2tplimit : %d\r\n", gL2TPtunlimit); | Printf(" l2tplimit : %u\r\n", gL2TPtunlimit); |
#endif |
#endif |
#ifdef PHYSTYPE_PPTP |
#ifdef PHYSTYPE_PPTP |
Printf(" pptptimeout : %d\r\n", gPPTPto); |
Printf(" pptptimeout : %d\r\n", gPPTPto); |
Printf(" pptplimit : %d\r\n", gPPTPtunlimit); | Printf(" pptplimit : %u\r\n", gPPTPtunlimit); |
#endif |
#endif |
Printf(" max-children : %d\r\n", gMaxChildren); |
Printf(" max-children : %d\r\n", gMaxChildren); |
Printf(" qthreshold : %d %d\r\n", gQThresMin, gQThresMax); |
Printf(" qthreshold : %d %d\r\n", gQThresMin, gQThresMax); |
Line 1009 ShowGlobal(Context ctx, int ac, char *av[], void *arg)
|
Line 1031 ShowGlobal(Context ctx, int ac, char *av[], void *arg)
|
*/ |
*/ |
|
|
static int |
static int |
ExitCommand(Context ctx, int ac, char *av[], void *arg) | ExitCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
if (ctx->cs) |
if (ctx->cs) |
ctx->cs->exit = TRUE; |
ctx->cs->exit = TRUE; |
return(0); |
return(0); |
Line 1021 ExitCommand(Context ctx, int ac, char *av[], void *arg
|
Line 1048 ExitCommand(Context ctx, int ac, char *av[], void *arg
|
*/ |
*/ |
|
|
static int |
static int |
QuitCommand(Context ctx, int ac, char *av[], void *arg) | QuitCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
if (ctx->cs) |
if (ctx->cs) |
ctx->cs->exit = TRUE; |
ctx->cs->exit = TRUE; |
SendSignal(SIGTERM); |
SendSignal(SIGTERM); |
Line 1034 QuitCommand(Context ctx, int ac, char *av[], void *arg
|
Line 1065 QuitCommand(Context ctx, int ac, char *av[], void *arg
|
*/ |
*/ |
|
|
static int |
static int |
LoadCommand(Context ctx, int ac, char *av[], void *arg) | LoadCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
char filename[128]; |
char filename[128]; |
#ifdef USE_FETCH |
#ifdef USE_FETCH |
Line 1044 LoadCommand(Context ctx, int ac, char *av[], void *arg
|
Line 1075 LoadCommand(Context ctx, int ac, char *av[], void *arg
|
int fetch = 0; |
int fetch = 0; |
#endif |
#endif |
|
|
|
(void)arg; |
if (ac < 1 || ac > 2) |
if (ac < 1 || ac > 2) |
return(-1); |
return(-1); |
else { |
else { |
Line 1100 out: if (fetch)
|
Line 1132 out: if (fetch)
|
*/ |
*/ |
|
|
static int |
static int |
OpenCommand(Context ctx, int ac, char *av[], void *arg) | OpenCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
Layer layer; |
Layer layer; |
const char *name; |
const char *name; |
|
|
|
(void)arg; |
switch (ac) { |
switch (ac) { |
case 0: |
case 0: |
name = DEFAULT_OPEN_LAYER; |
name = DEFAULT_OPEN_LAYER; |
Line 1130 OpenCommand(Context ctx, int ac, char *av[], void *arg
|
Line 1163 OpenCommand(Context ctx, int ac, char *av[], void *arg
|
*/ |
*/ |
|
|
static int |
static int |
CloseCommand(Context ctx, int ac, char *av[], void *arg) | CloseCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
Layer layer; |
Layer layer; |
const char *name; |
const char *name; |
|
|
|
(void)arg; |
switch (ac) { |
switch (ac) { |
case 0: |
case 0: |
name = DEFAULT_OPEN_LAYER; |
name = DEFAULT_OPEN_LAYER; |
Line 1162 CloseCommand(Context ctx, int ac, char *av[], void *ar
|
Line 1196 CloseCommand(Context ctx, int ac, char *av[], void *ar
|
static Layer |
static Layer |
GetLayer(const char *name) |
GetLayer(const char *name) |
{ |
{ |
int k, found; | size_t k; |
| int found; |
|
|
if (name == NULL) |
if (name == NULL) |
name = "iface"; |
name = "iface"; |
Line 1187 GetLayer(const char *name)
|
Line 1222 GetLayer(const char *name)
|
*/ |
*/ |
|
|
static int |
static int |
ShowLayers(Context ctx, int ac, char *av[], void *arg) | ShowLayers(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
int k; | size_t k; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("\tName\t\tDescription\r\n"); |
Printf("\tName\t\tDescription\r\n"); |
Printf("\t----\t\t-----------\r\n"); |
Printf("\t----\t\t-----------\r\n"); |
for (k = 0; k < NUM_LAYERS; k++) |
for (k = 0; k < NUM_LAYERS; k++) |
Line 1203 ShowLayers(Context ctx, int ac, char *av[], void *arg)
|
Line 1242 ShowLayers(Context ctx, int ac, char *av[], void *arg)
|
*/ |
*/ |
|
|
static int |
static int |
ShowTypes(Context ctx, int ac, char *av[], void *arg) | ShowTypes(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
PhysType pt; | const struct phystype *pt; |
int k; |
int k; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("\tName\t\tDescription\r\n"); |
Printf("\tName\t\tDescription\r\n"); |
Printf("\t----\t\t-----------\r\n"); |
Printf("\t----\t\t-----------\r\n"); |
for (k = 0; (pt = gPhysTypes[k]); k++) |
for (k = 0; (pt = gPhysTypes[k]); k++) |
Line 1220 ShowTypes(Context ctx, int ac, char *av[], void *arg)
|
Line 1263 ShowTypes(Context ctx, int ac, char *av[], void *arg)
|
*/ |
*/ |
|
|
static int |
static int |
ShowSummary(Context ctx, int ac, char *av[], void *arg) | ShowSummary(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
int b, l, f; |
int b, l, f; |
Bund B; |
Bund B; |
Line 1228 ShowSummary(Context ctx, int ac, char *av[], void *arg
|
Line 1271 ShowSummary(Context ctx, int ac, char *av[], void *arg
|
Rep R; |
Rep R; |
char buf[64]; |
char buf[64]; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("Current daemon status summary\r\n"); |
Printf("Current daemon status summary\r\n"); |
Printf("Iface\tBund\t\tLink\tLCP\tDevice\t\tUser\t\tFrom\r\n"); |
Printf("Iface\tBund\t\tLink\tLCP\tDevice\t\tUser\t\tFrom\r\n"); |
for (b = 0; b<gNumLinks; b++) { |
for (b = 0; b<gNumLinks; b++) { |
Line 1306 ShowSummary(Context ctx, int ac, char *av[], void *arg
|
Line 1353 ShowSummary(Context ctx, int ac, char *av[], void *arg
|
*/ |
*/ |
|
|
static int |
static int |
ShowSessions(Context ctx, int ac, char *av[], void *arg) | ShowSessions(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
int l; |
int l; |
Bund B; |
Bund B; |
Link L; |
Link L; |
char peer[64], addr[64]; | char peer[64], addr[64], buf[64]; |
|
|
if (ac != 0 && ac != 1) |
if (ac != 0 && ac != 1) |
return (-1); |
return (-1); |
Line 1365 ShowSessions(Context ctx, int ac, char *av[], void *ar
|
Line 1412 ShowSessions(Context ctx, int ac, char *av[], void *ar
|
case SHOW_PEER: |
case SHOW_PEER: |
if (strcmp(av[0], peer)) |
if (strcmp(av[0], peer)) |
continue; |
continue; |
break; | break; |
default: |
default: |
return (-1); |
return (-1); |
} |
} |
Line 1379 out:
|
Line 1426 out:
|
L->lcp.auth.params.authname, |
L->lcp.auth.params.authname, |
peer |
peer |
); |
); |
|
if (Enabled(&gGlobalConf.options, GLOBAL_CONF_AGENT_CID)) { |
|
PhysGetSelfName(L, buf, sizeof(buf)); |
|
Printf("\t%s", buf); |
|
} |
|
if (Enabled(&gGlobalConf.options, GLOBAL_CONF_SESS_TIME)) { |
|
if (L->state == PHYS_STATE_UP) |
|
Printf("\t%ld", (long int)(time(NULL) - L->last_up)); |
|
} |
Printf("\r\n"); |
Printf("\r\n"); |
} |
} |
} |
} |
Line 1390 out:
|
Line 1445 out:
|
*/ |
*/ |
|
|
static int |
static int |
ShowCustomer(Context ctx, int ac, char *av[], void *arg) | ShowCustomer(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
Link l = ctx->lnk; |
Link l = ctx->lnk; |
Bund b = ctx->bund; |
Bund b = ctx->bund; |
Line 1402 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1457 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
struct acl *a; |
struct acl *a; |
#endif |
#endif |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
if (b && b->iface.ifname[0]) { |
if (b && b->iface.ifname[0]) { |
iface = &b->iface; |
iface = &b->iface; |
Printf("Interface:\r\n"); |
Printf("Interface:\r\n"); |
Line 1430 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1489 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
if (!SLIST_EMPTY(&iface->routes) || !SLIST_EMPTY(&b->params.routes)) { |
if (!SLIST_EMPTY(&iface->routes) || !SLIST_EMPTY(&b->params.routes)) { |
Printf("\tRoutes via peer :\r\n"); |
Printf("\tRoutes via peer :\r\n"); |
SLIST_FOREACH(r, &iface->routes, next) |
SLIST_FOREACH(r, &iface->routes, next) |
Printf("\t\t%s\r\n", u_rangetoa(&r->dest,buf,sizeof(buf))); | Printf("\t\t: %s\r\n", u_rangetoa(&r->dest,buf,sizeof(buf))); |
SLIST_FOREACH(r, &b->params.routes, next) |
SLIST_FOREACH(r, &b->params.routes, next) |
Printf("\t\t%s\r\n", u_rangetoa(&r->dest,buf,sizeof(buf))); | Printf("\t\t: %s\r\n", u_rangetoa(&r->dest,buf,sizeof(buf))); |
} |
} |
#ifdef USE_IPFW |
#ifdef USE_IPFW |
if (b->params.acl_pipe) { |
if (b->params.acl_pipe) { |
Printf("\tIPFW pipes :\r\n"); |
Printf("\tIPFW pipes :\r\n"); |
a = b->params.acl_pipe; |
a = b->params.acl_pipe; |
while (a) { |
while (a) { |
Printf("\t\t%d (%d)\t'%s'\r\n", a->number, a->real_number, a->rule); | Printf("\t\t%d (%d)\t: '%s'\r\n", a->number, a->real_number, a->rule); |
a = a->next; |
a = a->next; |
} |
} |
} |
} |
Line 1447 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1506 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Printf("\tIPFW queues :\r\n"); |
Printf("\tIPFW queues :\r\n"); |
a = b->params.acl_queue; |
a = b->params.acl_queue; |
while (a) { |
while (a) { |
Printf("\t\t%d (%d)\t'%s'\r\n", a->number, a->real_number, a->rule); | Printf("\t\t%d (%d)\t: '%s'\r\n", a->number, a->real_number, a->rule); |
a = a->next; |
a = a->next; |
} |
} |
} |
} |
Line 1456 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1515 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
a = b->params.acl_table; |
a = b->params.acl_table; |
while (a) { |
while (a) { |
if (a->number != 0) |
if (a->number != 0) |
Printf("\t\t%d (%d)\t'%s'\r\n", a->number, a->real_number, a->rule); | Printf("\t\t%d (%d)\t: '%s'\r\n", a->number, a->real_number, a->rule); |
else |
else |
Printf("\t\t(%d)\t'%s'\r\n", a->real_number, a->rule); | Printf("\t\t(%d)\t: '%s'\r\n", a->real_number, a->rule); |
a = a->next; |
a = a->next; |
} |
} |
} |
} |
Line 1466 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1525 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Printf("\tIPFW rules :\r\n"); |
Printf("\tIPFW rules :\r\n"); |
a = b->params.acl_rule; |
a = b->params.acl_rule; |
while (a) { |
while (a) { |
Printf("\t\t%d (%d)\t'%s'\r\n", a->number, a->real_number, a->rule); | Printf("\t\t%d (%d)\t: '%s'\r\n", a->number, a->real_number, a->rule); |
a = a->next; |
a = a->next; |
} |
} |
} |
} |
Line 1480 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1539 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
if (a == NULL) |
if (a == NULL) |
a = acl_filters[k]; |
a = acl_filters[k]; |
while (a) { |
while (a) { |
Printf("\t\t%d#%d\t'%s'\r\n", (k + 1), a->number, a->rule); | Printf("\t\t%d#%d\t: '%s'\r\n", (k + 1), a->number, a->rule); |
a = a->next; |
a = a->next; |
} |
} |
} |
} |
Line 1488 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1547 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
for (k = 0; k < 2; k++) { |
for (k = 0; k < 2; k++) { |
a = b->params.acl_limits[k]; |
a = b->params.acl_limits[k]; |
while (a) { |
while (a) { |
Printf("\t\t%s#%d%s%s\t'%s'\r\n", (k?"out":"in"), a->number, | Printf("\t\t%s#%d%s%s\t: '%s'\r\n", (k?"out":"in"), a->number, |
((a->name[0])?"#":""), a->name, a->rule); |
((a->name[0])?"#":""), a->name, a->rule); |
a = a->next; |
a = a->next; |
} |
} |
Line 1530 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1589 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
else if (j != 0) |
else if (j != 0) |
l = NULL; |
l = NULL; |
if (l) { |
if (l) { |
char buf[64]; |
|
Printf("Link %s:\r\n", l->name); |
Printf("Link %s:\r\n", l->name); |
Printf("\tDevice type : %s\r\n", l->type?l->type->name:""); |
Printf("\tDevice type : %s\r\n", l->type?l->type->name:""); |
Printf("\tStatus : %s/%s\r\n", |
Printf("\tStatus : %s/%s\r\n", |
Line 1581 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
Line 1639 ShowCustomer(Context ctx, int ac, char *av[], void *ar
|
int |
int |
AdmitBund(Context ctx, CmdTab cmd) |
AdmitBund(Context ctx, CmdTab cmd) |
{ |
{ |
|
(void)cmd; |
if (!ctx->bund) |
if (!ctx->bund) |
return(FALSE); |
return(FALSE); |
return(TRUE); |
return(TRUE); |
Line 1593 AdmitBund(Context ctx, CmdTab cmd)
|
Line 1652 AdmitBund(Context ctx, CmdTab cmd)
|
int |
int |
AdmitLink(Context ctx, CmdTab cmd) |
AdmitLink(Context ctx, CmdTab cmd) |
{ |
{ |
|
(void)cmd; |
if (!ctx->lnk) |
if (!ctx->lnk) |
return(FALSE); |
return(FALSE); |
return(TRUE); |
return(TRUE); |
Line 1605 AdmitLink(Context ctx, CmdTab cmd)
|
Line 1665 AdmitLink(Context ctx, CmdTab cmd)
|
int |
int |
AdmitRep(Context ctx, CmdTab cmd) |
AdmitRep(Context ctx, CmdTab cmd) |
{ |
{ |
|
(void)cmd; |
if (!ctx->rep) |
if (!ctx->rep) |
return(FALSE); |
return(FALSE); |
return(TRUE); |
return(TRUE); |