+static device_type_t device_type;
+char *device = NULL;
+char *iface = NULL;
+static char *type = NULL;
+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);
+
+ if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
+#ifdef HAVE_LINUX_IF_TUN_H
+ if (netname != NULL)
+ iface = xstrdup(netname);
+#else
+ iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);
+#endif
+ device_fd = open(device, O_RDWR | O_NONBLOCK);