1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

ethos: Add drop frame case to recv function

The ethos driver does not drop the received frame if the recv function
is called with NULL buffer and with a length. This commit fixes that.
This commit is contained in:
Koen Zandberg 2018-08-31 10:40:30 +02:00
parent b518f3c73e
commit 761987ef0d
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -314,7 +314,14 @@ static int _recv(netdev_t *netdev, void *buf, size_t len, void* info)
return (int)len;
}
else {
return dev->last_framesize;
if (len) {
int dropsize = dev->last_framesize;
dev->last_framesize = 0;
return tsrb_drop(&dev->inbuf, dropsize);
}
else {
return dev->last_framesize;
}
}
}