Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 2021 13:50:06 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9186e4eb65c0 - stable/12 - bhyve: Set SO_REUSEADDR on the gdb stub socket
Message-ID:  <202105101350.14ADo6v1029107@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=9186e4eb65c0fcff07729893f395b4dfbb9f09c6

commit 9186e4eb65c0fcff07729893f395b4dfbb9f09c6
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-05-03 16:42:54 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-05-10 13:35:25 +0000

    bhyve: Set SO_REUSEADDR on the gdb stub socket
    
    Reviewed by:    jhb
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D30037
    
    (cherry picked from commit 02e7a6514e63ceca680fade40797280aef1bf55f)
---
 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 0539c461bdb3..0cf8637fd280 100644
--- a/usr.sbin/bhyve/gdb.c
+++ b/usr.sbin/bhyve/gdb.c
@@ -1809,7 +1809,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 ");
 
@@ -1825,6 +1825,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105101350.14ADo6v1029107>