From owner-svn-src-projects@freebsd.org Sat Dec 10 16:41:57 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36BF3C7112B for ; Sat, 10 Dec 2016 16:41:57 +0000 (UTC) (envelope-from ae@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 mx1.freebsd.org (Postfix) with ESMTPS id 066D3182E; Sat, 10 Dec 2016 16:41:56 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBAGfuDT044890; Sat, 10 Dec 2016 16:41:56 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBAGfu7S044889; Sat, 10 Dec 2016 16:41:56 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201612101641.uBAGfu7S044889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 10 Dec 2016 16:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r309820 - projects/ipsec/sys/netipsec X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2016 16:41:57 -0000 Author: ae Date: Sat Dec 10 16:41:55 2016 New Revision: 309820 URL: https://svnweb.freebsd.org/changeset/base/309820 Log: Replace sav->tdb_xform == NULL check with ASSERT. All key_allocsa* functions return SA with alive state. There is no way to have SA without initialized tdb_xform in the savtree_alive list. Modified: projects/ipsec/sys/netipsec/ipsec_output.c Modified: projects/ipsec/sys/netipsec/ipsec_output.c ============================================================================== --- projects/ipsec/sys/netipsec/ipsec_output.c Sat Dec 10 16:21:09 2016 (r309819) +++ projects/ipsec/sys/netipsec/ipsec_output.c Sat Dec 10 16:41:55 2016 (r309820) @@ -171,17 +171,7 @@ next: } return (NULL); } - /* - * Sanity check the SA content for the caller - * before they invoke the xform output method. - */ - if (sav->tdb_xform == NULL) { - DPRINTF(("%s: no transform for SA\n", __func__)); - IPSEC_OSTAT_INC(isr->saidx.proto, noxform); - key_freesav(&sav); - *error = EHOSTUNREACH; - return (NULL); - } + IPSEC_ASSERT(sav->tdb_xform != NULL, ("SA with NULL tdb_xform")); return (sav); } @@ -403,17 +393,7 @@ next: } return (NULL); } - /* - * Sanity check the SA content for the caller - * before they invoke the xform output method. - */ - if (sav->tdb_xform == NULL) { - DPRINTF(("%s: no transform for SA\n", __func__)); - IPSEC_OSTAT_INC(isr->saidx.proto, noxform); - key_freesav(&sav); - *error = EHOSTUNREACH; - return (NULL); - } + IPSEC_ASSERT(sav->tdb_xform != NULL, ("SA with NULL tdb_xform")); return (sav); }