]> Git Repo - qemu.git/commit
net/socket: learn to talk with a unix dgram socket
authorMarc-André Lureau <[email protected]>
Mon, 11 Mar 2019 17:25:05 +0000 (18:25 +0100)
committerJason Wang <[email protected]>
Fri, 29 Mar 2019 07:22:18 +0000 (15:22 +0800)
commitfdec16e3c2a614e2861f3086b05d444b5d8c3406
treed7e824672e5589835bf706e1f9147de4da7aadd9
parenta04d91c701251a9b32b7364ddb48029ba024cb75
net/socket: learn to talk with a unix dgram socket

-net socket has a fd argument, and may be passed pre-opened sockets.

TCP sockets use framing.
UDP sockets have datagram boundaries.

When given a unix dgram socket, it will be able to read from it, but
will attempt to send on the dgram_dst, which is unset. The other end
will not receive the data.

Let's teach -net socket to recognize a UNIX DGRAM socket, and use the
regular send() command (without dgram_dst).

This makes running slirp out-of-process possible that
way (python pseudo-code):

a, b = socket.socketpair(socket.AF_UNIX, socket.SOCK_DGRAM)

subprocess.Popen('qemu -net socket,fd=%d -net user' % a.fileno(), shell=True)
subprocess.Popen('qemu ... -net nic -net socket,fd=%d' % b.fileno(), shell=True)

Signed-off-by: Marc-André Lureau <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
net/socket.c
This page took 0.024933 seconds and 4 git commands to generate.