Page MenuHomeFreeBSD

sysctl: Update 'master' copy of vnet SYSCTLs on kernel environment variables change
AbandonedPublic

Authored by zlei on May 17 2023, 10:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 22 2024, 9:06 PM
Unknown Object (File)
Sep 22 2024, 8:59 AM
Unknown Object (File)
Sep 18 2024, 10:26 AM
Unknown Object (File)
Sep 18 2024, 4:42 AM
Unknown Object (File)
Sep 17 2024, 1:35 PM
Unknown Object (File)
Sep 17 2024, 12:22 PM
Unknown Object (File)
Sep 16 2024, 1:09 AM
Unknown Object (File)
Aug 25 2024, 10:48 PM
Subscribers

Details

Reviewers
hselasky
glebius
melifaro
Group Reviewers
network
Summary

Complete phase three of 3da1cf1e88f8.

In D39638, the values of SYSCTLs belong to VNETs will not reflect the change of kernel environment variable after the kernel modules been initialized. With this change new vnets will get latest values when corresponding kernel environment variables change.

MFC after: 3 weeks
Relnotes: yes

Test Plan

Test the following cases, on x86-64 and riscv hardwares:

set kernel environment variables, create new vnets, check sysctls
unset kernel environment variables, create new vnets, check sysctls

root@:~ # kldload -nq if_bridge
root@:~ # sysctl net.link.bridge.log_stp
net.link.bridge.log_stp: 0
root@:~ # kenv net.link.bridge.log_stp=1
net.link.bridge.log_stp="1"
root@:~ # jail -ic vnet persist
4
root@:~ # jexec 4 sysctl net.link.bridge.log_stp
net.link.bridge.log_stp: 1
root@:~ # sysctl net.link.bridge.log_stp
net.link.bridge.log_stp: 0
root@:~ # kenv -u net.link.bridge.log_stp
root@:~ # jexec 4 sysctl net.link.bridge.log_stp
net.link.bridge.log_stp: 1
root@:~ # jail -ic vnet persist
5
root@:~ # jexec 5 sysctl net.link.bridge.log_stp
net.link.bridge.log_stp: 0

The above sysctl net.link.bridge.log_stp is in kernel module if_bridge.

Repeat tests for sysctl net.inet.tcp.syncache.hashsize which is in kernel.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/kern/link_elf.c
1956

This assert ef->vnet_base != 0 is wrong.

After some hacking, I noticed that the set_vnet in kernel is not relocatable, thus for the kernel the ef->vnet_base is always 0.

Well that can still be work around by make a copy of memory range from VNET_START to VNET_STOP. It requires about extra 110KiB memory for current/15. I wonder it deserves for just only one feature restore the master copy to its default.

zlei edited the test plan for this revision. (Show Details)

Fix restoring vnet SYSCTLs in kernel .

sys/kern/link_elf.c
1956

Fixed.

Abandoned in favor of D41825.