summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
19b97e7)
Much more detailed statistics are now kept per node, which can be queried at
any time, which makes the device statistics obsolete.
12 files changed:
char *device = NULL;
char *iface = NULL;
static char *device_info = NULL;
char *device = NULL;
char *iface = NULL;
static char *device_info = NULL;
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
#if defined(ENABLE_TUNEMU)
static device_type_t device_type = DEVICE_TYPE_TUNEMU;
#elif defined(HAVE_OPENBSD) || defined(HAVE_FREEBSD) || defined(HAVE_DRAGONFLY)
#if defined(ENABLE_TUNEMU)
static device_type_t device_type = DEVICE_TYPE_TUNEMU;
#elif defined(HAVE_OPENBSD) || defined(HAVE_FREEBSD) || defined(HAVE_DRAGONFLY)
- device_total_in += packet->len;
-
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s",
packet->len, device_info);
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s",
packet->len, device_info);
- device_total_out += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
char *iface = NULL;
static char *device_info = NULL;
char *iface = NULL;
static char *device_info = NULL;
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
-
static pid_t reader_pid;
static int sp[2];
static pid_t reader_pid;
static int sp[2];
- device_total_in += packet->len;
-
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
- device_total_out += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
void (*close)(void);
bool (*read)(struct vpn_packet_t *);
bool (*write)(struct vpn_packet_t *);
void (*close)(void);
bool (*read)(struct vpn_packet_t *);
bool (*write)(struct vpn_packet_t *);
- void (*dump_stats)(void);
} devops_t;
extern const devops_t os_devops;
} devops_t;
extern const devops_t os_devops;
static char *device_info = "dummy device";
static char *device_info = "dummy device";
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
-
static bool setup_device(void) {
device = "dummy";
iface = "dummy";
static bool setup_device(void) {
device = "dummy";
iface = "dummy";
}
static bool write_packet(vpn_packet_t *packet) {
}
static bool write_packet(vpn_packet_t *packet) {
- device_total_out += packet->len;
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t dummy_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t dummy_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
static char ifrname[IFNAMSIZ];
static char *device_info;
static char ifrname[IFNAMSIZ];
static char *device_info;
-uint64_t device_in_packets = 0;
-uint64_t device_in_bytes = 0;
-uint64_t device_out_packets = 0;
-uint64_t device_out_bytes = 0;
-
static bool setup_device(void) {
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = xstrdup(DEFAULT_DEVICE);
static bool setup_device(void) {
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = xstrdup(DEFAULT_DEVICE);
- device_in_packets++;
- device_in_bytes += packet->len;
-
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
- device_out_packets++;
- device_out_bytes += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_in_bytes);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_out_bytes);
-}
-
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
char *iface = NULL;
static char *device_info = NULL;
char *iface = NULL;
static char *device_info = NULL;
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
-
extern char *myport;
static DWORD WINAPI tapreader(void *bla) {
extern char *myport;
static DWORD WINAPI tapreader(void *bla) {
- device_total_out += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
static char *device_info;
static char *device_info;
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
-
static struct addrinfo *ai = NULL;
static mac_t ignore_src = {{0}};
static struct addrinfo *ai = NULL;
static mac_t ignore_src = {{0}};
- device_total_in += packet->len;
-
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
- device_total_out += packet->len;
-
memcpy(&ignore_src, packet->data + 6, sizeof ignore_src);
return true;
}
memcpy(&ignore_src, packet->data + 6, sizeof ignore_src);
return true;
}
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t multicast_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t multicast_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
-
-#if 0
-
-static bool not_supported(void) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Raw socket device not supported on this platform");
- return false;
-}
-
-const devops_t multicast_devops = {
- .setup = not_supported,
- .close = NULL,
- .read = NULL,
- .write = NULL,
- .dump_stats = NULL,
-};
-#endif
#if defined(PF_PACKET) && defined(ETH_P_ALL) && defined(AF_PACKET) && defined(SIOCGIFINDEX)
static char *device_info;
#if defined(PF_PACKET) && defined(ETH_P_ALL) && defined(AF_PACKET) && defined(SIOCGIFINDEX)
static char *device_info;
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
-
static bool setup_device(void) {
struct ifreq ifr;
struct sockaddr_ll sa;
static bool setup_device(void) {
struct ifreq ifr;
struct sockaddr_ll sa;
- device_total_in += packet->len;
-
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
- device_total_out += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t raw_socket_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t raw_socket_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
.close = NULL,
.read = NULL,
.write = NULL,
.close = NULL,
.read = NULL,
.write = NULL,
char *iface = NULL;
static char *device_info = NULL;
char *iface = NULL;
static char *device_info = NULL;
-uint64_t device_in_packets = 0;
-uint64_t device_in_bytes = 0;
-uint64_t device_out_packets = 0;
-uint64_t device_out_bytes = 0;
-
static bool setup_device(void) {
char *type;
static bool setup_device(void) {
char *type;
- device_in_packets++;
- device_in_bytes += packet->len;
-
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len, device_info);
return true;
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len, device_info);
return true;
- device_out_packets++;
- device_out_bytes += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_in_bytes);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_out_bytes);
-}
-
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t os_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
- if(debug_level >= DEBUG_CONNECTIONS)
- devops.dump_stats();
-
end:
close_network_connections();
end:
close_network_connections();
static int state = 0;
static char *device_info;
static int state = 0;
static char *device_info;
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
-
enum request_type { REQ_NEW_CONTROL };
static struct request {
enum request_type { REQ_NEW_CONTROL };
static struct request {
- device_total_in += packet->len;
-
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len,
device_info);
- device_total_out += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t uml_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t uml_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,
static char *group = NULL;
static char *device_info;
static char *group = NULL;
static char *device_info;
-static uint64_t device_total_in = 0;
-static uint64_t device_total_out = 0;
-
static bool setup_device(void) {
libvdeplug_dynopen(plug);
static bool setup_device(void) {
libvdeplug_dynopen(plug);
- device_total_in += packet->len;
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len, device_info);
return true;
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Read packet of %d bytes from %s", packet->len, device_info);
return true;
- device_total_out += packet->len;
-
-static void dump_device_stats(void) {
- logger(DEBUG_ALWAYS, LOG_DEBUG, "Statistics for %s %s:", device_info, device);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes in: %10"PRIu64, device_total_in);
- logger(DEBUG_ALWAYS, LOG_DEBUG, " total bytes out: %10"PRIu64, device_total_out);
-}
-
const devops_t vde_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
const devops_t vde_devops = {
.setup = setup_device,
.close = close_device,
.read = read_packet,
.write = write_packet,
- .dump_stats = dump_device_stats,