From owner-svn-src-all@freebsd.org Fri Jan 18 21:46:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4DF41484698; Fri, 18 Jan 2019 21:46:39 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B66B76001; Fri, 18 Jan 2019 21:46:39 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 686AC8796; Fri, 18 Jan 2019 21:46:39 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0ILkdW9046380; Fri, 18 Jan 2019 21:46:39 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0ILkdoJ046379; Fri, 18 Jan 2019 21:46:39 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201901182146.x0ILkdoJ046379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 18 Jan 2019 21:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r343162 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 343162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7B66B76001 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2019 21:46:40 -0000 Author: brooks Date: Fri Jan 18 21:46:38 2019 New Revision: 343162 URL: https://svnweb.freebsd.org/changeset/base/343162 Log: Make SIFTR work again after r342125 (D18443). Correct a logic error. Only disable when already enabled or enable when disabled. Submitted by: Richard Scheffenegger Reviewed by: Cheng Cui Obtained from: Cheng Cui MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D18885 Modified: head/sys/netinet/siftr.c Modified: head/sys/netinet/siftr.c ============================================================================== --- head/sys/netinet/siftr.c Fri Jan 18 21:30:06 2019 (r343161) +++ head/sys/netinet/siftr.c Fri Jan 18 21:46:38 2019 (r343162) @@ -1219,7 +1219,7 @@ siftr_manage_ops(uint8_t action) if ((s = sbuf_new(NULL, NULL, 200, SBUF_AUTOEXTEND)) == NULL) return (-1); - if (action == SIFTR_ENABLE) { + if (action == SIFTR_ENABLE && siftr_pkt_manager_thr == NULL) { /* * Create our alq * XXX: We should abort if alq_open fails! @@ -1424,7 +1424,8 @@ siftr_manage_ops(uint8_t action) alq_close(siftr_alq); siftr_alq = NULL; - } + } else + error = EINVAL; sbuf_delete(s); @@ -1445,13 +1446,15 @@ siftr_sysctl_enabled_handler(SYSCTL_HANDLER_ARGS) new = siftr_enabled; error = sysctl_handle_int(oidp, &new, 0, req); - if (error != 0 && req->newptr != NULL) { + if (error == 0 && req->newptr != NULL) { if (new > 1) return (EINVAL); else if (new != siftr_enabled) { - error = siftr_manage_ops(new); - if (error != 0) + if ((error = siftr_manage_ops(new)) == 0) { + siftr_enabled = new; + } else { siftr_manage_ops(SIFTR_DISABLE); + } } } @@ -1462,7 +1465,9 @@ siftr_sysctl_enabled_handler(SYSCTL_HANDLER_ARGS) static void siftr_shutdown_handler(void *arg) { - siftr_manage_ops(SIFTR_DISABLE); + if (siftr_enabled == 1) { + siftr_manage_ops(SIFTR_DISABLE); + } }