Don't fail hard in ikev2_cp_fixaddr() if no address pool is found.
authortobhe <tobhe@openbsd.org>
Mon, 31 May 2021 17:10:14 +0000 (17:10 +0000)
committertobhe <tobhe@openbsd.org>
Mon, 31 May 2021 17:10:14 +0000 (17:10 +0000)
Fixes a bug where no flows are loaded when a single config address without
pool is configured.

ok patrick@

sbin/iked/ikev2.c

index 6c6a374..276391a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ikev2.c,v 1.321 2021/05/31 16:54:45 tobhe Exp $       */
+/*     $OpenBSD: ikev2.c,v 1.322 2021/05/31 17:10:14 tobhe Exp $       */
 
 /*
  * Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -7066,7 +7066,7 @@ ikev2_cp_fixaddr(struct iked_sa *sa, struct iked_addr *addr,
                naddr = (sa->sa_cp == IKEV2_CP_REQUEST) ?
                    sa->sa_addrpool : sa->sa_cp_addr;
                if (naddr == NULL)
-                       return (-1);
+                       return (-2);
                in4 = (struct sockaddr_in *)&addr->addr;
                if (in4->sin_addr.s_addr)
                        return (-2);
@@ -7078,7 +7078,7 @@ ikev2_cp_fixaddr(struct iked_sa *sa, struct iked_addr *addr,
                naddr = (sa->sa_cp == IKEV2_CP_REQUEST) ?
                    sa->sa_addrpool6 : sa->sa_cp_addr6;
                if (naddr == NULL)
-                       return (-1);
+                       return (-2);
                in6 = (struct sockaddr_in6 *)&addr->addr;
                if (!IN6_IS_ADDR_UNSPECIFIED(&in6->sin6_addr))
                        return (-2);