bhyve: Set SO_REUSEADDR on the gdb stub socket

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30037
This commit is contained in:
Mark Johnston 2021-05-03 12:42:54 -04:00
parent 7cb40543e9
commit 02e7a6514e

View File

@ -1821,7 +1821,7 @@ void
init_gdb(struct vmctx *_ctx, int sport, bool wait)
{
struct sockaddr_in sin;
int error, flags, s;
int error, flags, optval, s;
debug("==> starting on %d, %swaiting\n", sport, wait ? "" : "not ");
@ -1837,6 +1837,9 @@ init_gdb(struct vmctx *_ctx, int sport, bool wait)
if (s < 0)
err(1, "gdb socket create");
optval = 1;
(void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
sin.sin_len = sizeof(sin);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = htonl(INADDR_ANY);