On 2017年06月14日 16:04, Zhang Chen wrote:
On 06/13/2017 05:14 PM, Jason Wang wrote:
On 2017年06月12日 17:27, Zhang Chen wrote:
+ if (nf->direction == NET_FILTER_DIRECTION_RX ||
+ nf->direction == NET_FILTER_DIRECTION_ALL) {
+ vnet_hdr_len = nf->netdev->vnet_hdr_len;
This can only work if e.g virtio-net set its own vnet_hdr_len. But
looks like it use guest_hdr_len instead.
I see in hw/net/virtio-net.c use the
"qemu_set_vnet_hdr_len(nc->peer, n->guest_hdr_len);" to
set the nf->netdev->vnet_hdr_len, any case not include here?
You mean:
if (peer_has_vnet_hdr(n) &&
qemu_has_vnet_hdr_len(nc->peer, n->guest_hdr_len)) {
qemu_set_vnet_hdr_len(nc->peer, n->guest_hdr_len);
n->host_hdr_len = n->guest_hdr_len;
}
?
From the code, it only set peer's vnet header when peer supports
vnet_hdr up to n->guest_hdr_len. If peer can't, virtio-net will strip
the header.
So, We should get the n->guest_hdr_len in another way? like set a new
parameter in NetClientState?
Any suggestion about it?
Thanks
Zhang Chen
Rethink about this, a question is do we really care guest vnet header
len? During guest transmission, when packet reaches netfilter. The
vnet_header should have been stripped to netdev->vnet_hdr_len.
I still think use nf->netdev->vnet_hdr_len is sufficient.
Thanks
Thanks