From owner-svn-src-head@FreeBSD.ORG Sat Jun 20 07:49:09 2015 Return-Path: Delivered-To: svn-src-head@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7CC4DA03; Sat, 20 Jun 2015 07:49:09 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B2D630F; Sat, 20 Jun 2015 07:49:09 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5K7n9V6074666; Sat, 20 Jun 2015 07:49:09 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5K7n942074665; Sat, 20 Jun 2015 07:49:09 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201506200749.t5K7n942074665@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Sat, 20 Jun 2015 07:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284630 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jun 2015 07:49:09 -0000 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);