Clear Ethernet header when reading packets from a tun device.

This fixes a warning from valgrind about uninitialized bytes, which were being
sent to other nodes.
This commit is contained in:
Guus Sliepen 2012-10-09 15:52:58 +02:00
parent b346338f9c
commit 72642b40b3
3 changed files with 4 additions and 0 deletions

View file

@ -238,6 +238,7 @@ static bool read_packet(vpn_packet_t *packet) {
return false;
}
memset(packet->data, 0, 12);
packet->len = inlen + 14;
break;
@ -269,6 +270,7 @@ static bool read_packet(vpn_packet_t *packet) {
return false;
}
memset(packet->data, 0, 12);
packet->len = inlen + 10;
break;
}

View file

@ -131,6 +131,7 @@ static bool read_packet(vpn_packet_t *packet) {
return false;
}
memset(packet->data, 0, 12);
packet->len = inlen + 10;
break;
case DEVICE_TYPE_TAP:

View file

@ -151,6 +151,7 @@ static bool read_packet(vpn_packet_t *packet) {
return false;
}
memset(packet->data, 0, 12);
packet->len = inlen + 14;
device_total_in += packet->len;