git: b1d10b49e24a - main - if_ipsec(4): handle situations where there are no policy or SADB entry for if
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Jan 2023 21:20:24 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b1d10b49e24a4fd3af80f8491cd95bd0766ca1f1 commit b1d10b49e24a4fd3af80f8491cd95bd0766ca1f1 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-01-17 01:59:56 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-01-18 21:18:39 +0000 if_ipsec(4): handle situations where there are no policy or SADB entry for if Reviewed by: ae, hselasky Sponsored by: NVIDIA Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38093 --- sys/net/if_ipsec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c index 3952b5edb681..a2f690b4cffb 100644 --- a/sys/net/if_ipsec.c +++ b/sys/net/if_ipsec.c @@ -666,6 +666,10 @@ ipsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } saidx = ipsec_getsaidx(sc, IPSEC_DIR_OUTBOUND, sc->family); + if (saidx == NULL) { + error = ENXIO; + break; + } switch (cmd) { #ifdef INET case SIOCGIFPSRCADDR: @@ -783,6 +787,8 @@ ipsec_set_running(struct ipsec_softc *sc) int localip; saidx = ipsec_getsaidx(sc, IPSEC_DIR_OUTBOUND, sc->family); + if (saidx == NULL) + return; localip = 0; switch (sc->family) { #ifdef INET