Page MenuHomeFreeBSD

rc.d/dhclient: load values from netif
Needs RevisionPublic

Authored by feld on Aug 27 2025, 12:55 AM.
Tags
Referenced Files
Unknown Object (File)
Tue, Oct 7, 4:06 AM
Unknown Object (File)
Thu, Oct 2, 4:40 PM
Unknown Object (File)
Sep 17 2025, 8:14 AM
Unknown Object (File)
Sep 17 2025, 5:27 AM
Unknown Object (File)
Sep 12 2025, 7:50 AM
Unknown Object (File)
Sep 6 2025, 8:46 PM
Unknown Object (File)
Aug 28 2025, 11:04 AM
Unknown Object (File)
Aug 28 2025, 6:40 AM
Subscribers

Details

Reviewers
0mp
Summary

Using /etc/rc.conf.d/* for configuring services works well, but I ran into an issue with DHCP.

Where should you put these lines? :

ifconfig_ix0="SYNCDHCP"
background_dhclient="YES"

Network interfaces are configured via /etc/rc.d/netif. At the bottom of of this file, it has:

# Load the old "network" config file also for compatibility.
# This is needed for mfsBSD at least.
load_rc_config network
load_rc_config $name

So the "network" config file is soft-deprecated, and the values of /etc/rc.conf.d/network are loaded for backwards compatibility. The correct place to put your networking config (ifconfig_*) would be /etc/rc.conf.d/netif.

However, /etc/rc.d/dhclient needs to read the ifconfig_* values, but it only reads /etc/rc.conf.d/dhclient and /etc/rc.conf.d/network.

The proposed change would allow you to centralize all of your networking config including dhclient-specific variables in /etc/rc.conf.d/netif which to my understanding is the correct and modern place to do this.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

feld requested review of this revision.Aug 27 2025, 12:55 AM

I kinda wonder if load_rc_config $name should be the last one loaded so /etc/rc.conf.d/dhclient overrides the other files...

feld edited the summary of this revision. (Show Details)EditedAug 27 2025, 1:13 AM

There is a second problem I've discovered... ifconfig_DEFAULT= only works in /etc/rc.conf. It does not work when put into /etc/rc.conf.local or any of these files in /etc/rc.conf.d/

0mp requested changes to this revision.Aug 27 2025, 12:31 PM
0mp added a subscriber: 0mp.

I am not sure if we should make our services read load more configuration files or perhaps solve this issue with symlinks.

Also, if network is only softly deprecated maybe we can undeprecate it?

This revision now requires changes to proceed.Aug 27 2025, 12:31 PM