From owner-svn-src-head@freebsd.org Fri Nov 16 14:21:58 2018 Return-Path: Delivered-To: svn-src-head@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 7353D113401B; Fri, 16 Nov 2018 14:21:58 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03F0280F08; Fri, 16 Nov 2018 14:21:58 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9C3A1E61B; Fri, 16 Nov 2018 14:21:57 +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 wAGELvF4026057; Fri, 16 Nov 2018 14:21:57 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wAGELvZs026056; Fri, 16 Nov 2018 14:21:57 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201811161421.wAGELvZs026056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 16 Nov 2018 14:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340477 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 340477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 03F0280F08 X-Spamd-Result: default: False [-102.98 / 40.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.87)[-0.873,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Fri, 16 Nov 2018 14:21:58 -0000 Author: ae Date: Fri Nov 16 14:21:57 2018 New Revision: 340477 URL: https://svnweb.freebsd.org/changeset/base/340477 Log: Allow configuration of several ipsec interfaces with the same tunnel endpoints. This can be used to configure several IPsec tunnels between two hosts with different security associations. Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/net/if_ipsec.c Modified: head/sys/net/if_ipsec.c ============================================================================== --- head/sys/net/if_ipsec.c Fri Nov 16 11:17:18 2018 (r340476) +++ head/sys/net/if_ipsec.c Fri Nov 16 14:21:57 2018 (r340477) @@ -968,7 +968,7 @@ static int ipsec_set_addresses(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) { - struct ipsec_softc *sc, *tsc; + struct ipsec_softc *sc; struct secasindex *saidx; sx_assert(&ipsec_ioctl_sx, SA_XLOCKED); @@ -982,18 +982,6 @@ ipsec_set_addresses(struct ifnet *ifp, struct sockaddr key_sockaddrcmp(&saidx->dst.sa, dst, 0) == 0) return (0); /* Nothing has been changed. */ - } - /* Check that given addresses aren't already configured */ - CK_LIST_FOREACH(tsc, ipsec_srchash(src), srchash) { - if (tsc == sc) - continue; - MPASS(tsc->family == src->sa_family); - saidx = ipsec_getsaidx(tsc, IPSEC_DIR_OUTBOUND, tsc->family); - if (key_sockaddrcmp(&saidx->src.sa, src, 0) == 0 && - key_sockaddrcmp(&saidx->dst.sa, dst, 0) == 0) { - /* We already have tunnel with such addresses */ - return (EADDRNOTAVAIL); - } } /* If reqid is not set, generate new one. */ if (ipsec_init_reqid(sc) != 0)