Page MenuHomeFreeBSD

tcp: mark TCP stacks which can serve as a default stack
ClosedPublic

Authored by tuexen on May 31 2024, 9:50 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 3, 2:16 PM
Unknown Object (File)
Tue, Oct 1, 3:56 PM
Unknown Object (File)
Sat, Sep 28, 5:32 AM
Unknown Object (File)
Fri, Sep 27, 1:59 AM
Unknown Object (File)
Thu, Sep 26, 8:02 PM
Unknown Object (File)
Fri, Sep 20, 7:54 AM
Unknown Object (File)
Fri, Sep 20, 4:42 AM
Unknown Object (File)
Mon, Sep 16, 10:54 PM

Details

Summary

Allow a TCP function block (tfb) to become the default stack only if tfb->tfb_flags has the TCP_FUNC_DEFAULT_OK flags set. This allows a TCP function block, that is not suitable as a default function block to ensure that it is not set as the default via sysctl. In this case sysctl would return EINVAL.

One could do the same thing using a flag TCP_FUNC_DEFAULT_NOT_OK. Then this change would be smaller, but doing it the way described above seems safer. But if you prefer this approach, we can use it. I'm open to that.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

tuexen retitled this revision from tcp: allow a TCP stack to to tcp: allow a TCP stack to not become a default stack.May 31 2024, 11:13 AM
tuexen retitled this revision from tcp: allow a TCP stack to not become a default stack to tcp: mark TCP stacks which can serve as a default stack.May 31 2024, 11:29 AM

Can you give a brief explanation of the problem this is supposed to solve?

As far as the "sense" of the option, can you explain why the default presumption is that stacks can not be used at the default stack?

In D45419#1036179, @jtl wrote:

Can you give a brief explanation of the problem this is supposed to solve?

Sure. Assume there is a TCP function block, which only deals with TCP endpoints in the ESTABLISHED state.
If you use such a TCP function block as the default stack, you can not create an TCP endpoint anymore,
since the tfb_tcp_fb_init function call will fail. All TCP endpoints are created in the CLOSED state.
Such a stack would not have the TCP_FUNC_DEFAULT_OK flag be set and this patch would protect
the system to get in such a bad state, where no TCP endpoints could be created anymore.

As far as the "sense" of the option, can you explain why the default presumption is that stacks can not be used at the default stack?

We can mark the stacks, which can be used as a default stack or mark the stacks which cannot be used as a default stack.
I thought it is safer that the developer has to say it is OK to use this stack as a default. If you forget it, nothing bad will happen, you just have limited functionality. If you forget to say that it is not OK, you run into the bad state.

I don't have a strong opinion on the default flag state (DEFAULT_OK or DEFAULT_NOT_OK), so this seems fine to me.

This revision is now accepted and ready to land.Jul 21 2024, 11:50 PM