Page MenuHomeFreeBSD

sctp: Some fixes for loader tunables
ClosedPublic

Authored by zlei on Sep 28 2023, 10:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 17, 2:38 AM
Unknown Object (File)
Thu, Oct 17, 2:38 AM
Unknown Object (File)
Oct 7 2024, 10:46 PM
Unknown Object (File)
Sep 24 2024, 6:29 PM
Unknown Object (File)
Sep 24 2024, 4:40 PM
Unknown Object (File)
Sep 24 2024, 4:20 PM
Unknown Object (File)
Sep 20 2024, 4:36 AM
Unknown Object (File)
Sep 19 2024, 9:15 PM

Details

Summary

The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that sysctl -T will report them correctly.

  1. net.inet.sctp.tcbhashsize
  2. net.inet.sctp.pcbhashsize
  3. net.inet.sctp.chunkscale

While here, validate the loader tunables on vnet initialize, reset them to
theirs default, otherwise invalid kernel environment can cause kernel panic.

The loader tunable net.inet.sctp.tcbhashsize and net.inet.sctp.chunkscale are
used only when vnet initialize, thus it make no senses to make them writable tunables.

MFC after: 1 week

Test Plan

Set kernel env and load module sctp.ko, then validate the tunables.

# kenv net.inet.sctp.tcbhashsize=0
net.inet.sctp.tcbhashsize="0"
# kenv net.inet.sctp.chunkscale=20
net.inet.sctp.chunkscale="20"
# kenv net.inet.sctp.pcbhashsize=128
net.inet.sctp.pcbhashsize="128"
# kldload sctp
# sysctl -T net.inet.sctp
net.inet.sctp.chunkscale: 20
net.inet.sctp.pcbhashsize: 128
net.inet.sctp.tcbhashsize: 1024

Note the compile default value:

  • net.inet.sctp.tcbhashsize is SCTPCTL_TCBHASHSIZE_DEFAULT (1024)
  • net.inet.sctp.chunkscale is SCTPCTL_CHUNKSCALE_DEFAULT (10)
  • net.inet.sctp.pcbhashsize is SCTPCTL_PCBHASHSIZE_DEFAULT (256)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

zlei requested review of this revision.Sep 28 2023, 10:10 AM
sys/netinet/sctp_sysctl.c
870

I would suggest to use CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW instead of 0 here.

874

I would suggest to use CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_TUN|CTLFLAG_NOFETCH instead of CTLFLAG_TUN|CTLFLAG_NOFETCH here.

895

I would suggest to use just flags here.

921

I would suggest to use a new macro here, which calls SCTP_UINT_SYSCTL_FLAG with CTLFLAG_VNET | CTLFLAG_RDTUN | CTLFLAG_NOFETCH as its flags argument.

927

I would suggest to use a new macro here, which calls SCTP_UINT_SYSCTL_FLAG with CTLFLAG_VNET | CTLFLAG_RDTUN | CTLFLAG_NOFETCH as its flags argument.

zlei marked 5 inline comments as done.Oct 8 2023, 9:37 AM
zlei added inline comments.
sys/netinet/sctp_sysctl.c
899

SYSCTL_UINT is sufficient for readonly tunables. No need for a dedicated sysctl handler sctp_sysctl_handle_##mib_name.

This revision is now accepted and ready to land.Oct 8 2023, 10:38 AM
This revision was automatically updated to reflect the committed changes.