aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-09-24 16:27:27 +0200
committerMichael S. Tsirkin <mst@redhat.com>2012-10-29 18:25:23 +0200
commite043ebc6f9a093c1fd1b677191ad9fbeefe22d1e (patch)
tree26f1ea6db320c405107fe60dcc544a27039ed2d7 /hw
parent7b80d08efc36fd6c7881e98302f00148b5fd908a (diff)
virtio-net: minor code simplification
During packet filtering, we can now use host hdr len to offset incoming buffer unconditionally. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio-net.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index dc4a26cbd6..c94521e0fe 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -544,9 +544,7 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
if (n->promisc)
return 1;
- if (n->has_vnet_hdr) {
- ptr += sizeof(struct virtio_net_hdr);
- }
+ ptr += n->host_hdr_len;
if (!memcmp(&ptr[12], vlan, sizeof(vlan))) {
int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;