- memcpy(vp->data, mymac.net.mac.address.x, 6);
- memcpy(vp->data + 6, mymac.net.mac.address.x, 6);
- vp->data[12] = 0x08;
- vp->data[13] = 0x00;
+ memcpy(packet->data, mymac.net.mac.address.x, 6);
+ memcpy(packet->data + 6, mymac.net.mac.address.x, 6);
+
+ switch(ntohl(type))
+ {
+ case AF_INET:
+ packet->data[12] = 0x8;
+ packet->data[13] = 0x0;
+ break;
+ case AF_INET6:
+ packet->data[12] = 0x86;
+ packet->data[13] = 0xDD;
+ break;
+ default:
+ if(debug_lvl >= DEBUG_TRAFFIC)
+ syslog(LOG_ERR, _("Unknown address family %d while reading packet from %s %s"), ntohl(type), device_info, device);
+ return -1;
+ }