Skip to content

Commit

Permalink
virtio-net: minor code simplification
Browse files Browse the repository at this point in the history
During packet filtering, we can now use host hdr len
to offset incoming buffer unconditionally.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
mstsirkin committed Oct 29, 2012
1 parent 7b80d08 commit e043ebc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions hw/virtio-net.c
Expand Up @@ -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;
Expand Down

0 comments on commit e043ebc

Please sign in to comment.