|
|
| version 1.1.1.1, 2012/02/21 23:32:47 | version 1.1.1.2, 2013/07/22 08:44:29 |
|---|---|
| Line 11 | Line 11 |
| * See ``COPYRIGHT.whistle'' | * See ``COPYRIGHT.whistle'' |
| */ | */ |
| #include "msg.h" | |
| #include "ppp.h" | #include "ppp.h" |
| #include "console.h" | #include "console.h" |
| #ifndef NOWEB | #ifndef NOWEB |
| Line 40 | Line 41 |
| #ifdef USE_FETCH | #ifdef USE_FETCH |
| #include <fetch.h> | #include <fetch.h> |
| #endif | #endif |
| #ifdef USE_NG_NETFLOW | |
| #include <netgraph/netflow/ng_netflow.h> | |
| #endif | |
| /* | /* |
| * DEFINITIONS | * DEFINITIONS |
| Line 75 | Line 79 |
| SET_L2TPLIMIT, | SET_L2TPLIMIT, |
| #endif | #endif |
| SET_MAX_CHILDREN, | SET_MAX_CHILDREN, |
| SET_QTHRESHOLD, | |
| #ifdef USE_NG_BPF | #ifdef USE_NG_BPF |
| SET_FILTER | SET_FILTER |
| #endif | #endif |
| Line 148 | Line 153 |
| #endif | #endif |
| { "max-children {num}", "Max number of children", | { "max-children {num}", "Max number of children", |
| GlobalSetCommand, NULL, 2, (void *) SET_MAX_CHILDREN }, | GlobalSetCommand, NULL, 2, (void *) SET_MAX_CHILDREN }, |
| { "qthreshold {min} {max}", "Message queue limit thresholds", | |
| GlobalSetCommand, NULL, 2, (void *) SET_QTHRESHOLD }, | |
| #ifdef USE_NG_BPF | #ifdef USE_NG_BPF |
| { "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 }, |
| Line 181 | Line 188 |
| static const struct cmdtab ShowSessCmds[] = { | static const struct cmdtab ShowSessCmds[] = { |
| { "iface {name}", "Filter by iface name", | { "iface {name}", "Filter by iface name", |
| ShowSessions, NULL, 2, (void *) SHOW_IFACE }, | ShowSessions, NULL, 0, (void *) SHOW_IFACE }, |
| { "ip {ip}", "Filter by IP address", | { "ip {ip}", "Filter by IP address", |
| ShowSessions, NULL, 2, (void *) SHOW_IP }, | ShowSessions, NULL, 0, (void *) SHOW_IP }, |
| { "user {name}", "Filter by user name", | { "user {name}", "Filter by user name", |
| ShowSessions, NULL, 2, (void *) SHOW_USER }, | ShowSessions, NULL, 0, (void *) SHOW_USER }, |
| { "session {ID}", "Filter by session ID", | { "session {ID}", "Filter by session ID", |
| ShowSessions, NULL, 2, (void *) SHOW_SESSION }, | ShowSessions, NULL, 0, (void *) SHOW_SESSION }, |
| { "msession {ID}", "Filter by msession ID", | { "msession {ID}", "Filter by msession ID", |
| ShowSessions, NULL, 2, (void *) SHOW_MSESSION }, | ShowSessions, NULL, 0, (void *) SHOW_MSESSION }, |
| { "bundle {name}", "Filter by bundle name", | { "bundle {name}", "Filter by bundle name", |
| ShowSessions, NULL, 2, (void *) SHOW_BUNDLE }, | ShowSessions, NULL, 0, (void *) SHOW_BUNDLE }, |
| { "link {name}", "Filter by link name", | { "link {name}", "Filter by link name", |
| ShowSessions, NULL, 2, (void *) SHOW_LINK }, | ShowSessions, NULL, 0, (void *) SHOW_LINK }, |
| { "peer {name}", "Filter by peer name", | { "peer {name}", "Filter by peer name", |
| ShowSessions, NULL, 2, (void *) SHOW_PEER }, | ShowSessions, NULL, 0, (void *) SHOW_PEER }, |
| { NULL }, | { NULL }, |
| }; | }; |
| Line 273 | Line 280 |
| { "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, 2, (void *) ShowSessCmds}, | CMD_SUBMENU, NULL, 0, (void *) ShowSessCmds}, |
| { "summary", "Daemon status summary", | { "summary", "Daemon status summary", |
| ShowSummary, NULL, 0, NULL }, | ShowSummary, NULL, 0, NULL }, |
| #ifdef USE_NG_NETFLOW | |
| { "netflow", "Netflow settings", | |
| ShowNetflow, NULL, 0, NULL }, | |
| #endif | |
| { NULL }, | { NULL }, |
| }; | }; |
| static const struct cmdtab UnSetCommands[] = { | |
| { "radius ...", "RADIUS specific stuff", | |
| CMD_SUBMENU, AdmitLink, 2, (void *) RadiusUnSetCmds }, | |
| #ifdef NG_NAT_DESC_LENGTH | |
| { "nat ...", "NAT specific stuff", | |
| CMD_SUBMENU, AdmitBund, 2, (void *) NatUnSetCmds }, | |
| #endif | |
| { 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, (void *) BundSetCmds }, |
| Line 370 | Line 391 |
| SessionCommand, NULL, 0, NULL }, | SessionCommand, NULL, 0, NULL }, |
| { "set ...", "Set parameters", | { "set ...", "Set parameters", |
| CMD_SUBMENU, NULL, 0, (void *) SetCommands }, | CMD_SUBMENU, NULL, 0, (void *) SetCommands }, |
| { "unset ...", "Unset parameters", | |
| CMD_SUBMENU, NULL, 0, (void *) UnSetCommands }, | |
| { "show ...", "Show status", | { "show ...", "Show status", |
| CMD_SUBMENU, NULL, 0, (void *) ShowCommands }, | CMD_SUBMENU, NULL, 0, (void *) ShowCommands }, |
| { NULL }, | { NULL }, |
| Line 734 GlobalSetCommand(Context ctx, int ac, char *av[], void | Line 757 GlobalSetCommand(Context ctx, int ac, char *av[], void |
| break; | break; |
| #endif /* USE_NG_BPF */ | #endif /* USE_NG_BPF */ |
| case SET_QTHRESHOLD: | |
| if (ac == 2) { | |
| int val_max; | |
| val = atoi(av[0]); | |
| if (val < 0 || val >= MSG_QUEUE_LEN-1) | |
| Error("Incorrect minimum threshold for message queue, " | |
| "must be between 0 and %d", MSG_QUEUE_LEN-1); | |
| val_max = atoi(av[1]); | |
| if (val_max <= val || val_max >= MSG_QUEUE_LEN) | |
| Error("Incorrect maximum threshold for message queue, " | |
| "must be greater than minimum and less than %d", | |
| MSG_QUEUE_LEN); | |
| gQThresMin = val; | |
| gQThresMax = val_max; | |
| gQThresDiff = val_max - val; | |
| } | |
| else | |
| return (-1); | |
| break; | |
| default: | default: |
| return(-1); | return(-1); |
| } | } |
| Line 883 ShowVersion(Context ctx, int ac, char *av[], void *arg | Line 926 ShowVersion(Context ctx, int ac, char *av[], void *arg |
| #endif | #endif |
| #ifdef USE_NG_NETFLOW | #ifdef USE_NG_NETFLOW |
| Printf(" ng_netflow : yes\r\n"); | Printf(" ng_netflow : yes\r\n"); |
| #if NGM_NETFLOW_COOKIE >= 1309868867 | |
| Printf(" netflow v9 : yes\r\n"); | |
| #else | #else |
| Printf(" netflow v9 : no\r\n"); | |
| #endif | |
| #else | |
| Printf(" ng_netflow : no\r\n"); | Printf(" ng_netflow : no\r\n"); |
| #endif | #endif |
| #ifdef USE_NG_PRED1 | #ifdef USE_NG_PRED1 |
| Line 937 ShowGlobal(Context ctx, int ac, char *av[], void *arg) | Line 985 ShowGlobal(Context ctx, int ac, char *av[], void *arg) |
| Printf(" pptplimit : %d\r\n", gPPTPtunlimit); | Printf(" pptplimit : %d\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("Global options:\r\n"); | Printf("Global options:\r\n"); |
| OptStat(ctx, &gGlobalConf.options, gGlobalConfList); | OptStat(ctx, &gGlobalConf.options, gGlobalConfList); |
| #ifdef USE_NG_BPF | #ifdef USE_NG_BPF |
| Line 949 ShowGlobal(Context ctx, int ac, char *av[], void *arg) | Line 998 ShowGlobal(Context ctx, int ac, char *av[], void *arg) |
| } | } |
| } | } |
| #endif | #endif |
| Printf("Global state:\r\n"); | |
| Printf(" children : %d\r\n", gChildren); | |
| return 0; | return 0; |
| } | } |