Page MenuHomeFreeBSD

D61393.1794699819.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D61393.1794699819.diff

diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -104,6 +104,8 @@
struct m_tag *fwd_tag;
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
+ NET_EPOCH_ASSERT();
+
/*
* Do not forward packets to multicast destination (should be handled
* by ip6_mforward().
@@ -186,8 +188,9 @@
dst.sin6_addr = ip6->ip6_dst;
dst.sin6_scope_id = in6_get_unicast_scopeid(&ip6->ip6_dst, m->m_pkthdr.rcvif);
again:
+ /* The network epoch keeps the nexthop valid until we return. */
nh = fib6_lookup(M_GETFIB(m), &dst.sin6_addr, dst.sin6_scope_id,
- NHR_REF, m->m_pkthdr.flowid);
+ NHR_NONE, m->m_pkthdr.flowid);
if (nh == NULL) {
IP6STAT_INC(ip6s_noroute);
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_noroute);
@@ -338,8 +341,6 @@
if (in6_localip(&ip6->ip6_dst))
m->m_flags |= M_FASTFWD_OURS;
else {
- NH_FREE(nh);
-
/* Update address and scopeid. Assume scope is embedded */
dst.sin6_scope_id = ntohs(in6_getscope(&ip6->ip6_dst));
dst.sin6_addr = ip6->ip6_dst;
@@ -362,7 +363,7 @@
m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
#endif
error = netisr_queue(NETISR_IPV6, m);
- goto out;
+ return;
}
/* Or forward to some other address? */
if ((m->m_flags & M_IP6_NEXTHOP) &&
@@ -377,7 +378,6 @@
m->m_flags |= M_SKIP_FIREWALL;
m->m_flags &= ~M_IP6_NEXTHOP;
m_tag_delete(m, fwd_tag);
- NH_FREE(nh);
goto again;
}
@@ -436,12 +436,12 @@
}
if (mcopy == NULL)
- goto out;
+ return;
switch (error) {
case 0:
if (type == ND_REDIRECT) {
icmp6_redirect_output(mcopy, nh);
- goto out;
+ return;
}
goto freecopy;
@@ -463,14 +463,11 @@
break;
}
icmp6_error(mcopy, type, code, 0);
- goto out;
+ return;
freecopy:
m_freem(mcopy);
- goto out;
+ return;
bad:
m_freem(m);
-out:
- if (nh != NULL)
- NH_FREE(nh);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 14, 11:43 PM (9 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41660946
Default Alt Text
D61393.1794699819.diff (1 KB)

Event Timeline