- }
-
- // Show tunnel summary
- fprintf(w, "%s %s %s %s\r\n",
- "TID",
- "Hostname",
- "IP",
- "Sessions");
- for (i = 0; i < MAXTUNNEL; i++)
- {
- int sessions = 0;
- if (!tunnel[i].ip || tunnel[i].die || !tunnel[i].hostname[0]) continue;
-
- for (x = 0; x < MAXSESSION; x++) if (session[x].tunnel == i && session[x].opened && !session[x].die) sessions++;
- fprintf(w, "%d %s %s %d\r\n",
- i,
- tunnel[i].hostname,
- inet_toa(htonl(tunnel[i].ip)),
- sessions);
- }
- return CLI_OK;
-}
-
-int cmd_show_users(struct cli_def *cli, FILE *w, char *command, char **argv, int argc)
-{
- int i;
- for (i = 0; i < MAXSESSION; i++)
- {
- if (!session[i].opened) continue;
- if (!session[i].user[0]) continue;
- fprintf(w, "%s\r\n",
- session[i].user);
- }
- return CLI_OK;
-}
-
-int cmd_show_counters(struct cli_def *cli, FILE *w, char *command, char **argv, int argc)
-{
- fprintf(w, "%-10s %-8s %-10s %-8s\r\n", "Ethernet", "Bytes", "Packets", "Errors");
- fprintf(w, "%-10s %8lu %8lu %8lu\r\n", "RX",
- GET_STAT(tap_rx_bytes),
- GET_STAT(tap_rx_packets),
- GET_STAT(tap_rx_errors));
- fprintf(w, "%-10s %8lu %8lu %8lu\r\n", "TX",
- GET_STAT(tap_tx_bytes),
- GET_STAT(tap_tx_packets),
- GET_STAT(tap_tx_errors));
- fprintf(w, "\r\n");
-
- fprintf(w, "%-10s %-8s %-10s %-8s %-8s\r\n", "Tunnel", "Bytes", "Packets", "Errors", "Retries");
- fprintf(w, "%-10s %8lu %8lu %8lu %8lu\r\n", "RX",
- GET_STAT(tunnel_rx_bytes),
- GET_STAT(tunnel_rx_packets),
- GET_STAT(tunnel_rx_errors),
- 0L);
- fprintf(w, "%-10s %8lu %8lu %8lu %8lu\r\n", "TX",
- GET_STAT(tunnel_tx_bytes),
- GET_STAT(tunnel_tx_packets),
- GET_STAT(tunnel_rx_errors),
- GET_STAT(tunnel_retries));
- fprintf(w, "\r\n");
-
- fprintf(w, "%-30s%-10s\r\n", "Counter", "Value");
- fprintf(w, "-----------------------------------------\r\n");
- fprintf(w, "%-30s%lu\r\n", "radius_retries", GET_STAT(radius_retries));
- fprintf(w, "%-30s%lu\r\n", "arp_errors", GET_STAT(arp_errors));
- fprintf(w, "%-30s%lu\r\n", "arp_replies", GET_STAT(arp_replies));
- fprintf(w, "%-30s%lu\r\n", "arp_discarded", GET_STAT(arp_discarded));
- fprintf(w, "%-30s%lu\r\n", "arp_sent", GET_STAT(arp_sent));
- fprintf(w, "%-30s%lu\r\n", "arp_recv", GET_STAT(arp_recv));
- fprintf(w, "%-30s%lu\r\n", "packets_snooped", GET_STAT(packets_snooped));
- fprintf(w, "%-30s%lu\r\n", "tunnel_created", GET_STAT(tunnel_created));
- fprintf(w, "%-30s%lu\r\n", "session_created", GET_STAT(session_created));
- fprintf(w, "%-30s%lu\r\n", "tunnel_timeout", GET_STAT(tunnel_timeout));
- fprintf(w, "%-30s%lu\r\n", "session_timeout", GET_STAT(session_timeout));
- fprintf(w, "%-30s%lu\r\n", "radius_timeout", GET_STAT(radius_timeout));
- fprintf(w, "%-30s%lu\r\n", "radius_overflow", GET_STAT(radius_overflow));
- fprintf(w, "%-30s%lu\r\n", "tunnel_overflow", GET_STAT(tunnel_overflow));
- fprintf(w, "%-30s%lu\r\n", "session_overflow", GET_STAT(session_overflow));
- fprintf(w, "%-30s%lu\r\n", "ip_allocated", GET_STAT(ip_allocated));
- fprintf(w, "%-30s%lu\r\n", "ip_freed", GET_STAT(ip_freed));
-
-#ifdef STAT_CALLS
- fprintf(w, "\n%-30s%-10s\r\n", "Counter", "Value");
- fprintf(w, "-----------------------------------------\r\n");
- fprintf(w, "%-30s%lu\r\n", "call_processtap", GET_STAT(call_processtap));
- fprintf(w, "%-30s%lu\r\n", "call_processarp", GET_STAT(call_processarp));
- fprintf(w, "%-30s%lu\r\n", "call_processipout", GET_STAT(call_processipout));
- fprintf(w, "%-30s%lu\r\n", "call_processudp", GET_STAT(call_processudp));
- fprintf(w, "%-30s%lu\r\n", "call_processpap", GET_STAT(call_processpap));
- fprintf(w, "%-30s%lu\r\n", "call_processchap", GET_STAT(call_processchap));
- fprintf(w, "%-30s%lu\r\n", "call_processlcp", GET_STAT(call_processlcp));
- fprintf(w, "%-30s%lu\r\n", "call_processipcp", GET_STAT(call_processipcp));
- fprintf(w, "%-30s%lu\r\n", "call_processipin", GET_STAT(call_processipin));
- fprintf(w, "%-30s%lu\r\n", "call_processccp", GET_STAT(call_processccp));
- fprintf(w, "%-30s%lu\r\n", "call_processrad", GET_STAT(call_processrad));
- fprintf(w, "%-30s%lu\r\n", "call_sendarp", GET_STAT(call_sendarp));
- fprintf(w, "%-30s%lu\r\n", "call_sendipcp", GET_STAT(call_sendipcp));
- fprintf(w, "%-30s%lu\r\n", "call_sendchap", GET_STAT(call_sendchap));
- fprintf(w, "%-30s%lu\r\n", "call_sessionbyip", GET_STAT(call_sessionbyip));
- fprintf(w, "%-30s%lu\r\n", "call_sessionbyuser", GET_STAT(call_sessionbyuser));
- fprintf(w, "%-30s%lu\r\n", "call_tunnelsend", GET_STAT(call_tunnelsend));
- fprintf(w, "%-30s%lu\r\n", "call_tunnelkill", GET_STAT(call_tunnelkill));
- fprintf(w, "%-30s%lu\r\n", "call_tunnelshutdown", GET_STAT(call_tunnelshutdown));
- fprintf(w, "%-30s%lu\r\n", "call_sessionkill", GET_STAT(call_sessionkill));
- fprintf(w, "%-30s%lu\r\n", "call_sessionshutdown", GET_STAT(call_sessionshutdown));
- fprintf(w, "%-30s%lu\r\n", "call_sessionsetup", GET_STAT(call_sessionsetup));
- fprintf(w, "%-30s%lu\r\n", "call_assign_ip_address",GET_STAT(call_assign_ip_address));
- fprintf(w, "%-30s%lu\r\n", "call_free_ip_address", GET_STAT(call_free_ip_address));
- fprintf(w, "%-30s%lu\r\n", "call_dump_acct_info", GET_STAT(call_dump_acct_info));
- fprintf(w, "%-30s%lu\r\n", "call_radiussend", GET_STAT(call_radiussend));
- fprintf(w, "%-30s%lu\r\n", "call_radiusretry", GET_STAT(call_radiusretry));
-#endif
- return CLI_OK;