2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00

netdev-linux: Report error for truncated packets on receive.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2011-12-02 15:22:20 -08:00
parent a57a8488da
commit 02e83e83b4
2 changed files with 8 additions and 2 deletions

View File

@@ -802,8 +802,11 @@ netdev_linux_recv(struct netdev *netdev_, void *data, size_t size)
}
for (;;) {
ssize_t retval = read(netdev->fd, data, size);
if (retval >= 0) {
ssize_t retval = recv(netdev->fd, data, size, MSG_TRUNC);
if (retval > size) {
/* Received packet was longer than supplied buffer. */
return -EMSGSIZE;
} else if (retval >= 0) {
return retval;
} else if (errno != EINTR) {
if (errno != EAGAIN) {