Bug 195188 - [patch] [rc.d] hostid should be required by hostid_save and netif rc scripts
Summary: [patch] [rc.d] hostid should be required by hostid_save and netif rc scripts
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Enji Cooper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-19 22:40 UTC by guyyur
Modified: 2016-06-08 13:43 UTC (History)
1 user (show)

See Also:
ngie: mfc-stable10+
ngie: mfc-stable9+


Attachments
Add hostid to REQUIRE: for hostid_save and netif (658 bytes, patch)
2014-11-19 22:40 UTC, guyyur
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description guyyur 2014-11-19 22:40:31 UTC
Created attachment 149608 [details]
Add hostid to REQUIRE: for hostid_save and netif

When /etc/rc.d/zvol is removed hostid is run after
hostid_save and netif.


hostid is required by hostid_save in case /etc/hostid
doesn't exist so the correct hostid will be written.

hostid is required by netif for the bridge interface MAC address.
If hostid is run after netif a random MAC address will be
generated on each boot.


rcorder with zvol
sysctl
hostid
zvol
...

rcorder without zvol
...
hostid_save
...
netif
...
hostid
...


Verified behavior on virtual machine installed from
FreeBSD-11.0-CURRENT-i386-20140525-r266655-disc1.iso.

/etc/rc.conf
...
cloned_interfaces="bridge0"


ifconfig bridge0 # (first boot)
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 22:b3:11:79:51:3d

ifconfig bridge0 # (second boot)
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 5e:dc:bd:ed:43:5d


When hostid is added to netif REQUIRE line:
dmesg -a
...
Setting hostid: 0x49d109e4.
...

ifconfig bridge0 # (on every boot)
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 02:49:d1:09:e4:00
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2015-02-09 18:07:11 UTC
I'll take a look at this bug because I want to remove the ZFS dependency from mountroot.
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-10-25 05:59:10 UTC
A commit references this bug:

Author: ngie
Date: Sun Oct 25 05:59:03 UTC 2015
New revision: 289919
URL: https://svnweb.freebsd.org/changeset/base/289919

Log:
  Make hostid_save and netif REQUIRE hostid

  netif needs hostid to be generate first in the event that bridging is being
  setup via netif. The reason for hostid_save needing it is fairly straightforward

  PR: 195188

Changes:
  user/ngie/detangle-rc/etc/rc.d/hostid_save
  user/ngie/detangle-rc/etc/rc.d/netif
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-05-29 02:59:45 UTC
A commit references this bug:

Author: ngie
Date: Sun May 29 02:59:03 UTC 2016
New revision: 300931
URL: https://svnweb.freebsd.org/changeset/base/300931

Log:
  Make netif REQUIRE hostid

  As noted in the PR, if etc/rc.d/zvol is removed, netif will be run before
  hostid, and the MAC address generated for any bridge devices will be
  non-deterministic. Make the MAC address generated be deterministic for
  bridge devices by explicitly REQUIRE'ing hostid.

  This fixes up the rest of the PR, inadvertently committed in r299844

  MFC after: 1 week
  PR: 195188
  Sponsored by: EMC / Isilon Storage Division

Changes:
  head/etc/rc.d/netif
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-06-08 13:40:34 UTC
A commit references this bug:

Author: ngie
Date: Wed Jun  8 13:40:07 UTC 2016
New revision: 301615
URL: https://svnweb.freebsd.org/changeset/base/301615

Log:
  MFC r299844,r300931:

  r299844:

  Make hostid_save depend on hostid

  r300931:

  Make netif REQUIRE hostid

  As noted in the PR, if etc/rc.d/zvol is removed, netif will be run before
  hostid, and the MAC address generated for any bridge devices will be
  non-deterministic. Make the MAC address generated be deterministic for
  bridge devices by explicitly REQUIRE'ing hostid.

  This fixes up the rest of the PR, inadvertently committed in r299844

  PR: 195188

Changes:
_U  stable/10/
  stable/10/etc/rc.d/hostid_save
  stable/10/etc/rc.d/netif
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-06-08 13:42:35 UTC
A commit references this bug:

Author: ngie
Date: Wed Jun  8 13:41:52 UTC 2016
New revision: 301616
URL: https://svnweb.freebsd.org/changeset/base/301616

Log:
  MFstable/10 r301615:

  MFC r299844,r300931:

  r299844:

  Make hostid_save depend on hostid

  r300931:

  Make netif REQUIRE hostid

  As noted in the PR, if etc/rc.d/zvol is removed, netif will be run before
  hostid, and the MAC address generated for any bridge devices will be
  non-deterministic. Make the MAC address generated be deterministic for
  bridge devices by explicitly REQUIRE'ing hostid.

  This fixes up the rest of the PR, inadvertently committed in r299844

  PR: 195188

Changes:
_U  stable/9/
_U  stable/9/etc/
_U  stable/9/etc/rc.d/
  stable/9/etc/rc.d/hostid_save
  stable/9/etc/rc.d/netif