svn commit: r353356 - head/sys/netinet6

Gleb Smirnoff glebius at FreeBSD.org
Wed Oct 9 17:02:28 UTC 2019


Author: glebius
Date: Wed Oct  9 17:02:28 2019
New Revision: 353356
URL: https://svnweb.freebsd.org/changeset/base/353356

Log:
  ip6_output() has a complex set of gotos, and some can jump out of
  the epoch section towards return statement. Since entering epoch
  is cheap, it is easier to cover the whole function with epoch,
  rather than try to properly maintain its state.

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Wed Oct  9 16:59:42 2019	(r353355)
+++ head/sys/netinet6/ip6_output.c	Wed Oct  9 17:02:28 2019	(r353356)
@@ -405,6 +405,8 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 	struct m_tag *fwd_tag = NULL;
 	uint32_t id;
 
+	NET_EPOCH_ENTER(et);
+
 	if (inp != NULL) {
 		INP_LOCK_ASSERT(inp);
 		M_SETFIB(m, inp->inp_inc.inc_fibnum);
@@ -587,7 +589,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 		ro = &opt->ip6po_route;
 	dst = (struct sockaddr_in6 *)&ro->ro_dst;
 	fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m);
-	NET_EPOCH_ENTER(et);
 again:
 	/*
 	 * if specified, try to fill in the traffic class field.


More information about the svn-src-all mailing list