Bug 275146 - [tcp] odd error handling from net.inet.tcp.functions_default sysctl
Summary: [tcp] odd error handling from net.inet.tcp.functions_default sysctl
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-17 00:27 UTC by Ed Maste
Modified: 2025-09-10 20:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer freebsd_triage 2023-11-17 00:27:06 UTC
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
Comment 1 Ed Maste freebsd_committer freebsd_triage 2023-11-18 18:31:41 UTC
Proposed patch from zlei in https://reviews.freebsd.org/D42647
Comment 2 Michael Tuexen freebsd_committer freebsd_triage 2025-09-10 19:52:00 UTC
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.
Comment 3 Alan Somers freebsd_committer freebsd_triage 2025-09-10 20:04:20 UTC
I agree with Michael, too.