- /* FIXME sometime
- add_mac_addresses(&outpkt);
- */
-
- if(write(tap_fd, outpkt.data, outpkt.len) < 0)
- syslog(LOG_ERR, _("Can't write to tap device: %m"));
- else
- total_tap_out += outpkt.len;
+ if(debug_lvl >= DEBUG_TRAFFIC)
+ syslog(LOG_ERR, _("Writing packet of %d bytes to tap device"),
+ outpkt.len, outlen);
+
+ /* Fix mac address */
+
+ memcpy(outpkt.data, mymac.net.mac.address.x, 6);
+
+ if(taptype == TAP_TYPE_TUNTAP)
+ {
+ if(write(tap_fd, outpkt.data, outpkt.len) < 0)
+ syslog(LOG_ERR, _("Can't write to tun/tap device: %m"));
+ else
+ total_tap_out += outpkt.len;
+ }
+ else /* ethertap */
+ {
+ if(write(tap_fd, outpkt.data - 2, outpkt.len + 2) < 0)
+ syslog(LOG_ERR, _("Can't write to ethertap device: %m"));
+ else
+ total_tap_out += outpkt.len + 2;
+ }