Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/VirtualTap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ signed char zts_lwip_eth_tx(struct netif* n, struct pbuf* p)
bufptr += q->len;
totalLength += q->len;
}
int len = totalLength - sizeof(struct eth_hdr);
if (len < 0) {
return ERR_IF;
}
struct eth_hdr* ethhdr;
ethhdr = (struct eth_hdr*)buf;

Expand All @@ -400,7 +404,6 @@ signed char zts_lwip_eth_tx(struct netif* n, struct pbuf* p)
dest_mac.setTo(ethhdr->dest.addr, 6);

char* data = buf + sizeof(struct eth_hdr);
int len = totalLength - sizeof(struct eth_hdr);
int proto = Utils::ntoh((uint16_t)ethhdr->type);
tap->_handler(tap->_arg, NULL, tap->_net_id, src_mac, dest_mac, proto, 0, data, len);

Expand Down