summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2002-11-14 02:18:05 +0000
committeritojun <itojun@openbsd.org>2002-11-14 02:18:05 +0000
commitda0f1953614314d21324fe34e54da5b39c550111 (patch)
tree986689dbbf3297694838907201f6b09c33ae2b5d
parentget more use of the shadowed regs (diff)
downloadwireguard-openbsd-da0f1953614314d21324fe34e54da5b39c550111.tar.xz
wireguard-openbsd-da0f1953614314d21324fe34e54da5b39c550111.zip
correct IPv6 setsockopt for ipsec operation. angelos ok
From: Martti Kuparinen <martti.kuparinen@iki.fi>
-rw-r--r--sbin/isakmpd/sysdep/freebsd/sysdep.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sbin/isakmpd/sysdep/freebsd/sysdep.c b/sbin/isakmpd/sysdep/freebsd/sysdep.c
index 4f853ca1774..f96c59c9325 100644
--- a/sbin/isakmpd/sysdep/freebsd/sysdep.c
+++ b/sbin/isakmpd/sysdep/freebsd/sysdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysdep.c,v 1.10 2001/10/26 12:23:45 ho Exp $ */
+/* $OpenBSD: sysdep.c,v 1.11 2002/11/14 02:18:05 itojun Exp $ */
/*
* Copyright (c) 1998, 1999 Niklas Hallqvist. All rights reserved.
@@ -137,6 +137,8 @@ sysdep_cleartext (int fd, int af)
char *policy[] = { "in bypass", "out bypass", NULL };
char **p;
int ipp;
+ int opt;
+ char *msgstr;
if (app_none)
return 0;
@@ -145,9 +147,13 @@ sysdep_cleartext (int fd, int af)
{
case AF_INET:
ipp = IPPROTO_IP;
+ opt = IP_IPSEC_POLICY;
+ msgstr = "";
break;
case AF_INET6:
ipp = IPPROTO_IPV6;
+ opt = IPV6_IPSEC_POLICY;
+ msgstr = "V6";
break;
default:
log_print ("sysdep_cleartext: unsupported protocol family %d", af);
@@ -168,12 +174,11 @@ sysdep_cleartext (int fd, int af)
return -1;
}
- if (setsockopt(fd, ipp, IP_IPSEC_POLICY, buf,
- ipsec_get_policylen(buf)) < 0)
+ if (setsockopt(fd, ipp, opt, buf, ipsec_get_policylen(buf)) < 0)
{
log_error ("sysdep_cleartext: "
- "setsockopt (%d, IPPROTO_IP, IP_IPSEC_POLICY, ...) failed",
- fd);
+ "setsockopt (%d, IPPROTO_IP%s, IP%s_IPSEC_POLICY, ...) "
+ "failed", fd, msgstr, msgstr);
return -1;
}
free(buf);