On 10/05/2022 23:24, Stefano Brivio wrote:
...
I don't know if this is an issue, but I couldn't figure out the reason
for this difference either:
- with the old socket option, I can pass something like:
-net socket,fd=5 -net nic,model=virtio
and frames are sent to/received from socket number 5 (which I
pre-opened)
- with the new option, and something like:
-netdev
socket-ng,id=socket0,mode=client,addr.type=unix,addr.path=/tmp/test.socket -net
nic,model=virtio,id=hostnet0
I get a connection on the socket, but the virtio-net device is not
connected to it (no frames received/sent).
However, if instead of "-net nic" I pass this:
-device virtio-net-pci,netdev=socket0
everything works.
I think the problem is with the hub.
When it works:
-net socket,udp=localhost:1235,localaddr=localhost:1234 \
-net nic,model=virtio,macaddr=9a:2b:2c:2d:2e:2f
(qemu) info network
hub 0
\ hub0port1: virtio-net-pci.0:
index=0,type=nic,model=virtio-net-pci,macaddr=9a:2b:2c:2d:2e:2f
\ hub0port0: #net039: index=0,type=socket,socket: udp=127.0.0.1:1235
When it doesn't work (with the upcoming new syntax...):
-net dgram,id=socket0,local.type=inet,local.host=localhost,local.port=1234,\
remote.type=inet,remote.host=localhost,remote.port=1235
-net nic,model=virtio,macaddr=9a:2b:2c:2d:2e:2f
(qemu) info network
hub 0
\ hub0port0: virtio-net-pci.0:
index=0,type=nic,model=virtio-net-pci,macaddr=9a:2b:2c:2d:2e:2f
socket0: index=0,type=dgram,udp=127.0.0.1:1234/127.0.0.1:1235
We can see socket0 is not linked to the hub (hub0port0)
With "-device" it works because it doesn't use the hub but the netdev id:
-device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=socket0
virtio-net-pci.0:
index=0,type=nic,model=virtio-net-pci,macaddr=9a:2b:2c:2d:2e:f
\ socket0: index=0,type=dgram,udp=127.0.0.1:1234/127.0.0.1:1235
I'm investigating...
Thanks,
Laurent