summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/sysdep
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-11-14 02:18:06 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-11-14 02:18:06 +0000
commitdea9aad245ff326966cb5503acc26a78631ea373 (patch)
tree9d3ec38de93e68d7f8bae9da12bba5716197a173 /sbin/isakmpd/sysdep
parentf74969ee2f76bfd6a33b2df332298948577bbf4c (diff)
correct IPv6 setsockopt for ipsec operation. angelos ok
From: Martti Kuparinen <martti.kuparinen@iki.fi>
Diffstat (limited to 'sbin/isakmpd/sysdep')
-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);