summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2000-06-20 01:27:24 +0000
committeritojun <itojun@openbsd.org>2000-06-20 01:27:24 +0000
commit9638d2b35ed02bec7f10d73948b5a8a447761c60 (patch)
tree663c5c6fb7943c4bdf343be983dec67670c2e693
parentmore KNF (diff)
downloadwireguard-openbsd-9638d2b35ed02bec7f10d73948b5a8a447761c60.tar.xz
wireguard-openbsd-9638d2b35ed02bec7f10d73948b5a8a447761c60.zip
initialize hoplimit field properly on ipsec6 case
-rw-r--r--sys/netinet6/ip6_output.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 971d6306370..1f644bf364e 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.11 2000/06/19 03:43:17 itojun Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.12 2000/06/20 01:27:24 itojun Exp $ */
/* $KAME: ip6_output.c,v 1.112 2000/06/18 01:50:39 itojun Exp $ */
/*
@@ -294,6 +294,13 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
error = EHOSTUNREACH;
goto freehdrs;
}
+
+ /* scoped address is not supported */
+ if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src) ||
+ IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) {
+ error = EHOSTUNREACH;
+ goto freehdrs;
+ }
#endif
}
@@ -581,6 +588,24 @@ skip_ipsec2:;
if (sproto != 0) {
s = splnet();
+ /* fill in IPv6 header which would be filled later */
+ if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
+ if (opt && opt->ip6po_hlim != -1)
+ ip6->ip6_hlim = opt->ip6po_hlim & 0xff;
+ } else {
+ if (im6o != NULL)
+ ip6->ip6_hlim = im6o->im6o_multicast_hlim;
+ else
+ ip6->ip6_hlim = ip6_defmcasthlim;
+ if (opt && opt->ip6po_hlim != -1)
+ ip6->ip6_hlim = opt->ip6po_hlim & 0xff;
+
+ /*
+ * XXX what should we do if ip6_hlim == 0 and the packet
+ * gets tunnelled?
+ */
+ }
+
tdb = gettdb(sspi, &sdst, sproto);
if (tdb == NULL) {
error = EHOSTUNREACH;