Skip to content

Commit

Permalink
bhyve: Set SO_REUSEADDR on the gdb stub socket
Browse files Browse the repository at this point in the history
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30037

(cherry picked from commit 02e7a65)
  • Loading branch information
markjdb committed May 10, 2021
1 parent 0f19be5 commit b2c871b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion usr.sbin/bhyve/gdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,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 ");

Expand All @@ -1826,6 +1826,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);
Expand Down

0 comments on commit b2c871b

Please sign in to comment.