Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2020 03:24:35 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r363442 - stable/12/sys/net
Message-ID:  <202007230324.06N3OZdM000692@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Jul 23 03:24:35 2020
New Revision: 363442
URL: https://svnweb.freebsd.org/changeset/base/363442

Log:
  MFC r363244: ether_ifattach: set mtu before calling if_attach()
  
  if_attach() -> if_attach_internal() will call if_attachdomain1(ifp) any time
  an ethernet interface is setup *after*
  SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_FIRST.  This eventually leads to
  nd6_ifattach() -> nd6_setmtu0() stashing off ifp->if_mtu in ndi->maxmtu
  *before* ifp->if_mtu has been properly set in some scenarios, e.g., USB
  ethernet adapter plugged in later on.
  
  For interfaces that are created in early boot, we don't have this issue as
  domains aren't constructed enough for them to attach and thus it gets
  deferred to domainifattach at SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_SECOND
  *after* the mtu has been set earlier in ether_ifattach().
  
  PR:		248005

Modified:
  stable/12/sys/net/if_ethersubr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_ethersubr.c
==============================================================================
--- stable/12/sys/net/if_ethersubr.c	Thu Jul 23 03:08:17 2020	(r363441)
+++ stable/12/sys/net/if_ethersubr.c	Thu Jul 23 03:24:35 2020	(r363442)
@@ -927,8 +927,8 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla)
 
 	ifp->if_addrlen = ETHER_ADDR_LEN;
 	ifp->if_hdrlen = ETHER_HDR_LEN;
-	if_attach(ifp);
 	ifp->if_mtu = ETHERMTU;
+	if_attach(ifp);
 	ifp->if_output = ether_output;
 	ifp->if_input = ether_input;
 	ifp->if_resolvemulti = ether_resolvemulti;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007230324.06N3OZdM000692>