From ad43bf348bfd3ef395352e42544133860dbeaa9f Mon Sep 17 00:00:00 2001 From: "Andrey V. Elsukov" Date: Fri, 16 Nov 2018 14:21:57 +0000 Subject: [PATCH] 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 --- sys/net/if_ipsec.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index 8dad10cd33bd..5e2e77a6c979 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -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); @@ -983,18 +983,6 @@ ipsec_set_addresses(struct ifnet *ifp, struct sockaddr *src, 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) return (EEXIST);