summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@cvs.openbsd.org>2017-05-08 13:51:11 +0000
committerRafael Zalamena <rzalamena@cvs.openbsd.org>2017-05-08 13:51:11 +0000
commitb0abc5bbd96e8872485706555953806f102543b6 (patch)
tree5bd7e4dbd7864e8201d1a9b6d86f96bf78e05cf9
parent429e2f348caa1070bb3331109b324676841112c5 (diff)
Remove icmp6_reflect() micro optimization to simplify code and avoid a
M_LOOP flag dance in ip6_output(). ok bluhm@, mpi@
-rw-r--r--sys/netinet6/icmp6.c25
-rw-r--r--sys/netinet6/ip6_output.c10
2 files changed, 9 insertions, 26 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index e9cb269a197..d513dc67dfe 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.208 2017/05/04 17:58:46 bluhm Exp $ */
+/* $OpenBSD: icmp6.c,v 1.209 2017/05/08 13:51:09 rzalamena Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1127,29 +1127,20 @@ icmp6_reflect(struct mbuf *m, size_t off)
in6_embedscope(&t, &sa6_dst, NULL);
/*
- * This is the case if the dst is our link-local address
- * and the sender is also ourselves.
- */
- if (IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP))
- src = &t;
-
- /*
* If the incoming packet was addressed directly to us (i.e. unicast),
* use dst as the src for the reply.
* The IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED case would be VERY rare,
* but is possible (for example) when we encounter an error while
* forwarding procedure destined to a duplicated address of ours.
*/
- if (src == NULL) {
- rt = rtalloc(sin6tosa(&sa6_dst), 0, m->m_pkthdr.ph_rtableid);
- if (rtisvalid(rt) && ISSET(rt->rt_flags, RTF_LOCAL) &&
- !ISSET(ifatoia6(rt->rt_ifa)->ia6_flags,
- IN6_IFF_ANYCAST|IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)) {
- src = &t;
- }
- rtfree(rt);
- rt = NULL;
+ rt = rtalloc(sin6tosa(&sa6_dst), 0, m->m_pkthdr.ph_rtableid);
+ if (rtisvalid(rt) && ISSET(rt->rt_flags, RTF_LOCAL) &&
+ !ISSET(ifatoia6(rt->rt_ifa)->ia6_flags,
+ IN6_IFF_ANYCAST|IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)) {
+ src = &t;
}
+ rtfree(rt);
+ rt = NULL;
if (src == NULL) {
/*
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index baa367ae200..3c030b4cceb 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.229 2017/05/08 08:46:39 rzalamena Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.230 2017/05/08 13:51:10 rzalamena Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -592,13 +592,6 @@ reroute:
u_int32_t dummy1; /* XXX unused */
u_int32_t dummy2; /* XXX unused */
- /*
- * XXX: if we have to send an ICMPv6 error to the sender,
- * we need the M_LOOP flag since icmp6_error() expects
- * the IPv6 and the hop-by-hop options header are
- * continuous unless the flag is set.
- */
- m->m_flags |= M_LOOP;
m->m_pkthdr.ph_ifidx = ifp->if_index;
if (ip6_process_hopopts(m, (u_int8_t *)(hbh + 1),
((hbh->ip6h_len + 1) << 3) - sizeof(struct ip6_hbh),
@@ -607,7 +600,6 @@ reroute:
error = EINVAL;/* better error? */
goto done;
}
- m->m_flags &= ~M_LOOP; /* XXX */
m->m_pkthdr.ph_ifidx = 0;
}