+// SPDX-License-Identifier: ISC
/* $OpenBSD$ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* Copyright (c) 2003, 2004 Markus Friedl <markus@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifdef __OpenBSD__
#include <sys/types.h>
#include <sys/socket.h>
int
pfkey_establish(struct nbr *nbr, struct nbr_params *nbrp)
{
- if (nbrp->auth.method == AUTH_NONE)
- return (0);
-
switch (nbr->auth.method) {
case AUTH_MD5SIG:
strlcpy(nbr->auth.md5key, nbrp->auth.md5key,
sizeof(nbr->auth.md5key));
- return (pfkey_md5sig_establish(nbr, nbrp));
- default:
- break;
+ return pfkey_md5sig_establish(nbr, nbrp);
+ case AUTH_NONE:
+ return 0;
}
- return (0);
+ assert(!"Reached end of function where we are not expecting to");
}
int
pfkey_remove(struct nbr *nbr)
{
- if (nbr->auth.method == AUTH_NONE || !nbr->auth.established)
- return (0);
+ if (!nbr->auth.established)
+ return 0;
switch (nbr->auth.method) {
case AUTH_MD5SIG:
- return (pfkey_md5sig_remove(nbr));
- default:
+ return pfkey_md5sig_remove(nbr);
+ case AUTH_NONE:
+ return 0;
break;
}
- return (0);
+ assert(!"Reached end of function where we are not expecting to");
}
int