1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-18 05:13:56 +02:00
openwrt-packages/net/tailscale/patches/020-tailscaled_fake_iptables.patch
Oskari Rauta aabfc3f510 tailscale: update to 1.36.0
- Update tailscale to version 1.36.0
 - Patch iptables support

Tailscale does not (yet) support nftables.
Tailscale allows running with --netfilter=off allowing
end-user to create his own firewall rules, but this
affects only tailscale cli, not tailscaled daemon, so
connection cannot be made without error telling that
tailscaled was unable to determine execute iptables
for determining it's version.

There is a work-around for those who do not want
nft-iptables compatibility package; they can create
a script to /usr/bin/iptables which responds to
--version argument and echos fake version string
and on any other arguments or no arguments, just exits.

After this procedure and starting tailscale cli with
netfilter off- it works. Openwrt has moved on to
nftables, so iptables manipulation seems unnecessary.
Especially for other reasons, on Openwrt, firewall
should be configured on it's own, because firewall
rules made by other software, such as tailscale,
loose their firewalling rules when firewall restarts.

So I patched it to allow "fake" iptables pointing
to executable /bin/false and ignoring version
request. And I also set cli to default to
netfilter off setting.

If still end-user wants to use iptables, this
patch does not make it impossible; just install
iptables, or nft-iptables, and run tailscale
with argument --netfilter=on and it works out
as it did before, tailscaled daemon still
matches with iptables if it is found in $PATH.

Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
2023-02-04 18:26:54 +08:00

33 lines
940 B
Diff

--- a/wgengine/router/router_linux.go
+++ b/wgengine/router/router_linux.go
@@ -129,7 +129,7 @@ func newUserspaceRouter(logf logger.Logf
ipt4, err := iptables.NewWithProtocol(iptables.ProtocolIPv4)
if err != nil {
- return nil, err
+ ipt4, err = iptables.NewFakeWithProtocol(iptables.ProtocolIPv4)
}
v6err := checkIPv6(logf)
@@ -148,7 +148,7 @@ func newUserspaceRouter(logf logger.Logf
// if unavailable. We want that to be a non-fatal error.
ipt6, err = iptables.NewWithProtocol(iptables.ProtocolIPv6)
if err != nil {
- return nil, err
+ ipt6, err = iptables.NewFakeWithProtocol(iptables.ProtocolIPv6)
}
}
@@ -1635,11 +1635,6 @@ func checkIPv6(logf logger.Logf) error {
return fmt.Errorf("kernel doesn't support IPv6 policy routing: %w", err)
}
- // Some distros ship ip6tables separately from iptables.
- if _, err := exec.LookPath("ip6tables"); err != nil {
- return err
- }
-
return nil
}