- struct ifreq ifr;
-
-cp
- if(!get_config_string(lookup_config(config_tree, "Device"), &device_fname)))
- device_fname = DEFAULT_DEVICE;
-
-cp
- if((device_fd = open(device_fname, O_RDWR | O_NONBLOCK)) < 0)
- {
- syslog(LOG_ERR, _("Could not open %s: %m"), device_fname);
- return -1;
- }
-cp
- device_fd = device_fd;
-
- /* Set default MAC address for ethertap devices */
-
- mymac.type = SUBNET_MAC;
- mymac.net.mac.address.x[0] = 0xfe;
- mymac.net.mac.address.x[1] = 0xfd;
- mymac.net.mac.address.x[2] = 0x00;
- mymac.net.mac.address.x[3] = 0x00;
- mymac.net.mac.address.x[4] = 0x00;
- mymac.net.mac.address.x[5] = 0x00;
-
- device_info = _("FreeBSD tap device");
-
- syslog(LOG_INFO, _("%s is a %s"), device_fname, device_info);
-cp
- return 0;
+ int lenin;
+
+ cp();
+
+ if((lenin = read(device_fd, packet->data, MTU)) <= 0) {
+ logger(LOG_ERR, _("Error while reading from %s %s: %s"), device_info,
+ device, strerror(errno));
+ return false;
+ }
+
+ packet->len = lenin;
+
+ device_total_in += packet->len;
+
+ ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Read packet of %d bytes from %s"),
+ packet->len, device_info);
+
+ return true;