summaryrefslogtreecommitdiff
path: root/sys/netinet6/ip6_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6/ip6_output.c')
-rw-r--r--sys/netinet6/ip6_output.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index fc7aee1f0c1..ac28becd3e9 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.262 2021/12/01 12:51:09 bluhm Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.263 2021/12/03 17:18:34 bluhm Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -220,7 +220,7 @@ ip6_output(struct mbuf *m, struct ip6_pktopts *opt, struct route_in6 *ro,
}
#ifdef IPSEC
- if (ipsec_in_use || inp) {
+ if (ipsec_in_use || inp != NULL) {
error = ip6_output_ipsec_lookup(m, inp, &tdb);
if (error) {
/*
@@ -433,7 +433,7 @@ reroute:
}
#ifdef IPSEC
- if (tdb) {
+ if (tdb != NULL) {
/*
* XXX what should we do if ip6_hlim == 0 and the
* packet gets tunneled?
@@ -762,12 +762,15 @@ reroute:
ip6stat_inc(ip6s_fragmented);
done:
- if_put(ifp);
if (ro == &ip6route && ro->ro_rt) {
rtfree(ro->ro_rt);
} else if (ro_pmtu == &ip6route && ro_pmtu->ro_rt) {
rtfree(ro_pmtu->ro_rt);
}
+ if_put(ifp);
+#ifdef IPSEC
+ tdb_unref(tdb);
+#endif /* IPSEC */
return (error);
freehdrs:
@@ -2770,6 +2773,7 @@ ip6_output_ipsec_lookup(struct mbuf *m, struct inpcb *inp, struct tdb **tdbout)
!memcmp(&tdbi->dst, &tdb->tdb_dst,
sizeof(union sockaddr_union))) {
/* no IPsec needed */
+ tdb_unref(tdb);
*tdbout = NULL;
return 0;
}