Date: Sat, 20 Jun 2015 07:49:09 +0000 (UTC) From: John-Mark Gurney <jmg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284630 - head/usr.sbin/bhyve Message-ID: <201506200749.t5K7n942074665@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmg Date: Sat Jun 20 07:49:08 2015 New Revision: 284630 URL: https://svnweb.freebsd.org/changeset/base/284630 Log: add SO_REUSEADDR when starting debug port, lets you still bind when a TIME_WAIT socket is still around... Reviewed by: grehan Review: https://reviews.freebsd.org/D2875 Modified: head/usr.sbin/bhyve/dbgport.c Modified: head/usr.sbin/bhyve/dbgport.c ============================================================================== --- head/usr.sbin/bhyve/dbgport.c Sat Jun 20 07:42:54 2015 (r284629) +++ head/usr.sbin/bhyve/dbgport.c Sat Jun 20 07:49:08 2015 (r284630) @@ -116,6 +116,8 @@ SYSRES_IO(BVM_DBG_PORT, 4); void init_dbgport(int sport) { + int reuse; + conn_fd = -1; if ((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { @@ -128,6 +130,13 @@ init_dbgport(int sport) sin.sin_addr.s_addr = htonl(INADDR_ANY); sin.sin_port = htons(sport); + reuse = 1; + if (setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &reuse, + sizeof(reuse)) < 0) { + perror("setsockopt"); + exit(1); + } + if (bind(listen_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { perror("bind"); exit(1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506200749.t5K7n942074665>