Skip to content

Commit b8981dc

Browse files
pipoMichael Tokarev
authored andcommitted
util: socket: Add missing localaddr and localport option for DGRAM socket
The 'socket_optslist' structure does not contain the 'localaddr' and 'localport' options that are parsed in case you are creating a 'connect' type UDP character device. I've noticed it happening after commit f43e47d made qemu abort() after seeing the invalid option. A minimal reproducer for the case is: $ qemu-system-x86_64 -chardev udp,id=charrng0,host=127.0.0.1,port=1234,localaddr=,localport=1234 qemu-system-x86_64: -chardev udp,id=charrng0,host=127.0.0.1,port=1234,localaddr=,localport=1234: Invalid parameter 'localaddr' Aborted (core dumped) Prior to the commit mentioned above the error would be printed but the value for localaddr and localport was simply ignored. I did not go through the code to find out when it was broken. Add the two fields so that the options can again be parsed correctly and qemu doesn't abort(). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1220252 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
1 parent a2f533d commit b8981dc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

util/qemu-sockets.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ QemuOptsList socket_optslist = {
4444
},{
4545
.name = "port",
4646
.type = QEMU_OPT_STRING,
47+
},{
48+
.name = "localaddr",
49+
.type = QEMU_OPT_STRING,
50+
},{
51+
.name = "localport",
52+
.type = QEMU_OPT_STRING,
4753
},{
4854
.name = "to",
4955
.type = QEMU_OPT_NUMBER,

0 commit comments

Comments
 (0)