MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / tap_subnet_from_host_ip

Function tap_subnet_from_host_ip

crates/openshell-driver-vm/src/runtime.rs:534–543  ·  view source on GitHub ↗
(host_ip: &str)

Source from the content-addressed store, hash-verified

532}
533
534fn tap_subnet_from_host_ip(host_ip: &str) -> String {
535 host_ip.parse::<std::net::Ipv4Addr>().map_or_else(
536 |_| format!("{host_ip}/30"),
537 |ip| {
538 let base = u32::from(ip) & !3;
539 let base_ip = std::net::Ipv4Addr::from(base);
540 format!("{base_ip}/30")
541 },
542 )
543}
544
545fn enable_ip_forwarding() -> Result<(), String> {
546 std::fs::write("/proc/sys/net/ipv4/ip_forward", "1")

Callers 3

setup_tap_networkingFunction · 0.85
teardown_tap_networkingFunction · 0.85

Calls

no outgoing calls