Setting functions_default to a nonexistent entry (because it is not loaded, or for any other reason) has odd user-facing error behaviour: # sysctl net.inet.tcp.functions_default=rack net.inet.tcp.functions_default: freebsd sysctl: net.inet.tcp.functions_default=rack: No such file or directory Some other sysctls use EINVAL which at least gives the user an understandable error: # sysctl kern.timecounter.hardware=testing kern.timecounter.hardware: TSC sysctl: kern.timecounter.hardware=testing: Invalid argument
Proposed patch from zlei in https://reviews.freebsd.org/D42647
The current code now returns `ENOENT` if the requested TCP function block does not exist, `EINVAL` is returned if the requested function block cannot be the default function block. I think returning these different error causes makes sense. It would be less informative to return `EINVAL` in both cases... So I would vote for keeping the `errno` values as we have currently.
I agree with Michael, too.