Skip to content

network: fall back to static configuration#2334

Merged
mkroening merged 2 commits intohermit-os:mainfrom
cagatay-y:dhcp-fallback
Apr 10, 2026
Merged

network: fall back to static configuration#2334
mkroening merged 2 commits intohermit-os:mainfrom
cagatay-y:dhcp-fallback

Conversation

@cagatay-y
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Details
Benchmark Current: 9cebbaf Previous: 5127c77 Performance Ratio
startup_benchmark Build Time 89.32 s 89.35 s 1.00
startup_benchmark File Size 0.79 MB 0.79 MB 1.00
Startup Time - 1 core 0.79 s (±0.04 s) 0.81 s (±0.03 s) 0.98
Startup Time - 2 cores 0.81 s (±0.03 s) 0.82 s (±0.03 s) 0.99
Startup Time - 4 cores 0.82 s (±0.02 s) 0.83 s (±0.02 s) 0.99
multithreaded_benchmark Build Time 86.33 s 92.62 s 0.93
multithreaded_benchmark File Size 0.89 MB 0.89 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 91.12 % (±7.60 %) 90.72 % (±8.59 %) 1.00
Multithreaded Pi Efficiency - 4 Threads 45.69 % (±4.15 %) 44.88 % (±4.39 %) 1.02
Multithreaded Pi Efficiency - 8 Threads 26.54 % (±2.67 %) 25.87 % (±3.25 %) 1.03
micro_benchmarks Build Time 92.54 s 100.57 s 0.92
micro_benchmarks File Size 0.90 MB 0.90 MB 1.00
Scheduling time - 1 thread 70.53 ticks (±4.97 ticks) 74.98 ticks (±4.47 ticks) 0.94
Scheduling time - 2 threads 40.22 ticks (±4.84 ticks) 40.19 ticks (±4.30 ticks) 1.00
Micro - Time for syscall (getpid) 3.00 ticks (±0.31 ticks) 2.97 ticks (±0.23 ticks) 1.01
Memcpy speed - (built_in) block size 4096 79799.29 MByte/s (±55269.97 MByte/s) 76264.90 MByte/s (±52720.43 MByte/s) 1.05
Memcpy speed - (built_in) block size 1048576 29996.21 MByte/s (±24445.40 MByte/s) 30292.34 MByte/s (±24927.05 MByte/s) 0.99
Memcpy speed - (built_in) block size 16777216 28340.04 MByte/s (±23372.79 MByte/s) 23336.56 MByte/s (±19347.79 MByte/s) 1.21
Memset speed - (built_in) block size 4096 79852.26 MByte/s (±55304.60 MByte/s) 76939.35 MByte/s (±53180.56 MByte/s) 1.04
Memset speed - (built_in) block size 1048576 30705.01 MByte/s (±24826.06 MByte/s) 31021.82 MByte/s (±25328.96 MByte/s) 0.99
Memset speed - (built_in) block size 16777216 29079.79 MByte/s (±23798.00 MByte/s) 24084.23 MByte/s (±19864.53 MByte/s) 1.21
Memcpy speed - (rust) block size 4096 68089.51 MByte/s (±47597.10 MByte/s) 67864.13 MByte/s (±47549.43 MByte/s) 1.00
Memcpy speed - (rust) block size 1048576 29811.72 MByte/s (±24324.34 MByte/s) 30092.92 MByte/s (±24855.28 MByte/s) 0.99
Memcpy speed - (rust) block size 16777216 28250.15 MByte/s (±23253.84 MByte/s) 23650.21 MByte/s (±19669.17 MByte/s) 1.19
Memset speed - (rust) block size 4096 68747.54 MByte/s (±48081.17 MByte/s) 67668.78 MByte/s (±47427.13 MByte/s) 1.02
Memset speed - (rust) block size 1048576 30551.66 MByte/s (±24751.46 MByte/s) 30783.24 MByte/s (±25249.62 MByte/s) 0.99
Memset speed - (rust) block size 16777216 29004.65 MByte/s (±23693.78 MByte/s) 24398.50 MByte/s (±20179.80 MByte/s) 1.19
alloc_benchmarks Build Time 90.89 s 96.87 s 0.94
alloc_benchmarks File Size 0.86 MB 0.86 MB 1.00
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 6296.31 Ticks (±67.24 Ticks) 5277.51 Ticks (±516.92 Ticks) 1.19
Allocations - Average Allocation time (no fail) 6296.31 Ticks (±67.24 Ticks) 5277.51 Ticks (±516.92 Ticks) 1.19
Allocations - Average Deallocation time 1224.60 Ticks (±73.87 Ticks) 959.09 Ticks (±254.64 Ticks) 1.28
mutex_benchmark Build Time 91.03 s 91.13 s 1.00
mutex_benchmark File Size 0.90 MB 0.90 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 13.34 ns (±0.82 ns) 13.26 ns (±0.96 ns) 1.01
Mutex Stress Test Average Time per Iteration - 2 Threads 20.76 ns (±13.45 ns) 20.28 ns (±12.66 ns) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

If the DHCP feature is left enabled, the network interface does not use
the provided IP. This is a problem especially as the feature is enabled
by default.
This signals to the kernel that it should use the static IP even if the
DHCP feature is enabled. Note that if a DHCP lease is acquired it will
replace the static configuration. However, this should not happen with
our TAP configuration.
sockets.add(dhcpv4::Socket::new())
};

if !cfg!(feature = "dhcpv4") || hermit_var!("HERMIT_IP").is_some() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if !cfg!(feature = "dhcpv4") || hermit_var!("HERMIT_IP").is_some() {
if cfg!(not(feature = "dhcpv4")) || hermit_var!("HERMIT_IP").is_some() {

Is there a reason we don't want to fall back to 10.0.5.3 if no DHCP configuration is acquired? I feel like that would simplify the logic a bit, and the way I see it, HERMIT_IP is supposed to overwrite the 10.0.5.3 default, having it also imply enabling the fallback is a bit unintuitive. I wouldn't mind always falling back to the static configuration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My impression is that it is not good practice to claim an IP address without explicit input from the user. When DHCP is not enabled, it is reasonable to infer that the user wants a static IP and if one is not provided use the default, but if DHCP is enabled we shouldn't claim an address without the user asking for it.

Always falling back to the default would also mean that the user has no way of preventing the kernel from claiming an address. I guess we could make it so that when HERMIT_IP is set to something like 0.0.0.0 we don't set an address, but I think the behaviour in the PR is safer.

For the suggested change, I personally prefer to stay in the normal Rust land as opposed to the configuration specification language as much as possible, but I also don't really mind the alternative.

Copy link
Copy Markdown
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! :)

@mkroening mkroening added this pull request to the merge queue Apr 10, 2026
Merged via the queue into hermit-os:main with commit 692efb1 Apr 10, 2026
19 checks passed
@cagatay-y cagatay-y deleted the dhcp-fallback branch April 13, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants