git: 02e7a6514e63 - main - bhyve: Set SO_REUSEADDR on the gdb stub socket

Mark Johnston markj at FreeBSD.org
Mon May 3 17:55:38 UTC 2021


The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=02e7a6514e63ceca680fade40797280aef1bf55f

commit 02e7a6514e63ceca680fade40797280aef1bf55f
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-05-03 16:42:54 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-05-03 17:24:30 +0000

    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
---
 usr.sbin/bhyve/gdb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c
index 5df10467cd62..219d192b7c9a 100644
--- a/usr.sbin/bhyve/gdb.c
+++ b/usr.sbin/bhyve/gdb.c
@@ -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);


More information about the dev-commits-src-all mailing list