Bug 246506 - rc.d scripts for lagg and devmatch are misordered at startup
Summary: rc.d scripts for lagg and devmatch are misordered at startup
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 12.1-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Colin Percival
Depends on:
Reported: 2020-05-16 16:32 UTC by Colin Percival
Modified: 2020-07-30 15:40 UTC (History)
2 users (show)

See Also:
koobs: mfc-stable12?
koobs: mfc-stable11-


Note You need to log in before you can comment on or make changes to this bug.
Description Colin Percival freebsd_committer 2020-05-16 16:32:59 UTC
The devmatch rc.d script now automatically loads kernel modules -- thank you Warner! -- which makes configuring wifi adapters much easier.

However: The devmatch rc.d script runs very late in the boot process, which makes it incompatible with using lagg to switch automatically between wired and wireless networks (https://www.freebsd.org/doc/handbook/network-aggregation.html#networking-lagg-wired-and-wireless) -- if you try, you find that when lagg is created by /etc/rc.d/netif, it can't attach the wifi adapter because said adapter doesn't have a driver loaded yet.

A workaround for this is "load the kernel modules via loader.conf and don't rely on devmatch", but that's not the most user-friendly option.

A better fix might be to have lagg interfaces get created later in the boot process; that might be problematic if devmatch needs a working network for some reason.  I'm not sure why devmatch runs so late.
Comment 1 Warner Losh freebsd_committer 2020-05-16 17:29:55 UTC
Likely just needs a BEFORE: netif. All it REQUIRES is that / be mounted and kldxref has run.
Comment 2 Colin Percival freebsd_committer 2020-05-16 17:50:37 UTC
Indeed, adding "BEFORE: netif" does the trick.  Thanks!
Comment 3 Colin Percival freebsd_committer 2020-05-16 18:43:45 UTC
Fixed in r361114, will MFC in 3 days.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2020-05-17 11:29:40 UTC
^Triage: Assign to committer resolving

Thanks Colin!
Comment 5 commit-hook freebsd_committer 2020-05-19 01:41:09 UTC
A commit references this bug:

Author: cperciva
Date: Tue May 19 01:40:46 UTC 2020
New revision: 361235
URL: https://svnweb.freebsd.org/changeset/base/361235

  MFC r361114:

    Move the devmatch rc.d script before netif in the boot process.

    Prior to this change, using lagg to aggregate wired and wireless networks
    was broken in the (relatively common) case where wifi drivers + firmware
    are loaded by devmatch, since the interface didn't exist at the time when
    the lagg interface was being created.

  PR:		246506

_U  stable/12/
Comment 6 commit-hook freebsd_committer 2020-07-30 15:40:32 UTC
A commit references this bug:

Author: bcr
Date: Thu Jul 30 15:39:50 UTC 2020
New revision: 54386
URL: https://svnweb.freebsd.org/changeset/doc/54386

  Update the instructions for loading wifi drivers on FreeBSD versions
  with or without devmatch. Mention that loading of drivers in
  loader.conf or via rc.conf may be required for certain versions. It
  should be done in order to have the lagg interface properly set up
  at boot time.

  Thanks to Pau Amma for providing the patch.
  While here, fix some overly long lines in the note above.

  PR:             246506 (documentation part)
  Submitted by:   pauamma_gundo.com
  Requested by:   cperciva (on IRC)
  Reviewed by:    cperciva, bcr
  Approved by:    bcr
  Differential Revision:  https://reviews.freebsd.org/D25881