diff --git a/build b/build index c0a19db..5a7c982 100755 --- a/build +++ b/build @@ -687,12 +687,20 @@ configure_networkmgr() # Remove Networkmgr's netcardmgr script which messes with our auto- # configured network interfaces in /etc/rc.conf. rm -f "${SYSDIR}"/usr/local/bin/netcardmgr - # Prevent execution of networkmgr's setup-nic script. - sed -i '' -E 's/^[::space::]*(.*action.*setup-nic.*)/#\1/g' \ - "${SYSDIR}"/usr/local/etc/devd/networkmgr.conf - # Prevent execution of networkmgr's auto-switch script. - sed -i '' -E 's/^[::space::]*(.*action.*auto-switch.*)/#\1/g' \ - "${SYSDIR}"/usr/local/etc/devd/networkmgr.conf + # Neutralize NetworkMgr's devd automation (setup-nic, link-up, + # auto-switch) entirely. The previous approach of sed-commenting the + # action lines left action-less "notify 5" rules behind; devd runs + # only the highest-priority rule matching an event, so such empty + # shells silently swallow events from lower-priority rules (e.g. the + # base system's notify-0 dhclient rules). NomadBSD handles interface + # configuration itself (dsbdriverd) and DHCP-on-link-up via + # /etc/devd/nomadbsd-dhclient.conf. + cat > "${SYSDIR}"/usr/local/etc/devd/networkmgr.conf << NETWORKMGR_CONF_END +# NetworkMgr's devd rules are intentionally disabled on NomadBSD. +# Interface setup is handled by dsbdriverd, and DHCP on link-up by +# /etc/devd/nomadbsd-dhclient.conf. See configure_networkmgr() in the +# NomadBSD build script. +NETWORKMGR_CONF_END } configure_cupsd() diff --git a/config/etc/devd/nomadbsd-dhclient.conf b/config/etc/devd/nomadbsd-dhclient.conf new file mode 100644 index 0000000..87ae21f --- /dev/null +++ b/config/etc/devd/nomadbsd-dhclient.conf @@ -0,0 +1,33 @@ +# +# NomadBSD override: start dhclient on link-up at a priority that beats +# every other devd rule on the image. +# +# devd(8) executes only the single highest-priority rule matching an +# event; equal priorities are resolved by config scan order, which +# follows readdir() and is therefore an accident of the filesystem. +# Two rule sets compete with the base system's "notify 0" dhclient +# rules here: NetworkMgr's "notify 5" IFNET rules, and NomadBSD's own +# fetch-fw.conf, which used to match LINK_UP at 100 and could win the +# tie against dhclient - leaving the interface with no IPv4 at all. +# +# Priority 200 makes DHCP unconditionally win LINK_UP. fetch-fw now +# triggers on ADDR_ADD only, i.e. after dhclient has done its job. +# +# This file lives in /etc/devd (root filesystem, not the uzip) so devd +# sees it regardless of where its startup falls relative to mount_uzip, +# and it deliberately does NOT modify the stock /etc/devd/dhclient.conf, +# which etcupdate/freebsd-update would revert. +# +notify 200 { + match "system" "IFNET"; + match "type" "LINK_UP"; + media-type "ethernet"; + action "service dhclient quietstart $subsystem"; +}; + +notify 200 { + match "system" "IFNET"; + match "type" "LINK_UP"; + media-type "802.11"; + action "service dhclient quietstart $subsystem"; +}; diff --git a/config/usr/local/etc/devd/dhclient.conf b/config/usr/local/etc/devd/dhclient.conf deleted file mode 100644 index b4bae02..0000000 --- a/config/usr/local/etc/devd/dhclient.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -# Try to start dhclient on Ethernet-like interfaces when the link comes -# up. Only devices that are configured to support DHCP will actually -# run it. No link down rule exists because dhclient automatically exits -# when the link goes down. -# -notify 100 { - match "system" "IFNET"; - match "type" "LINK_UP"; - media-type "ethernet"; - action "service dhclient quietstart $subsystem"; -}; - -notify 100 { - match "system" "IFNET"; - match "type" "LINK_UP"; - media-type "802.11"; - action "service dhclient quietstart $subsystem"; -}; diff --git a/config/usr/local/etc/devd/fetch-fw.conf b/config/usr/local/etc/devd/fetch-fw.conf index 532a33b..3ee4baf 100644 --- a/config/usr/local/etc/devd/fetch-fw.conf +++ b/config/usr/local/etc/devd/fetch-fw.conf @@ -1,7 +1,12 @@ +# Fetch firmware once an address has been assigned (ADDR_ADD fires +# after dhclient or static configuration). Matching LINK_UP here as +# well used to tie with the dhclient rules at the same priority and +# could win the tie, blocking DHCP entirely - see +# /etc/devd/nomadbsd-dhclient.conf. notify 100 { match "system" "IFNET"; - match "type" "(LINK_UP|ADDR_ADD)"; + match "type" "ADDR_ADD"; action "daemon /usr/bin/fetch-fw"; };