Only enable forwarding for an IP family if any forwarding is required
for that family.
Fixes#6221.
Signed-off-by: David Anderson <danderson@tailscale.com>
pull/6227/head
David Anderson2 years agocommitted byDave Anderson
log.Fatalf("Unable to create tuntap device file: %v",err)
}
}
ifcfg.ProxyTo!=""||cfg.Routes!=""{
iferr:=ensureIPForwarding();err!=nil{
log.Printf("Failed to enable IP forwarding: %v",err)
log.Printf("To run tailscale as a proxy or router container, IP forwarding must be enabled.")
ifcfg.InKubernetes{
log.Fatalf("You can either set the sysctls as a privileged initContainer, or run the tailscale container with privileged=true.")
}else{
log.Fatalf("You can fix this by running the container with privileged=true, or the equivalent in your container runtime that permits access to sysctls.")
log.Printf("Failed to enable IP forwarding: %v",err)
log.Printf("To run tailscale as a proxy or router container, IP forwarding must be enabled.")
ifcfg.InKubernetes{
log.Fatalf("You can either set the sysctls as a privileged initContainer, or run the tailscale container with privileged=true.")
}else{
log.Fatalf("You can fix this by running the container with privileged=true, or the equivalent in your container runtime that permits access to sysctls.")
}
}
}
}
@ -334,14 +334,46 @@ func ensureTunFile() error {
}
// ensureIPForwarding enables IPv4/IPv6 forwarding for the container.