mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
linuxfw,wgengine/route,ipn: add c2n and nodeattrs to control linux netfilter
Updates tailscale/corp#14029. Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
@@ -271,6 +271,9 @@ type LocalBackend struct {
|
||||
currentUser ipnauth.WindowsToken
|
||||
selfUpdateProgress []ipnstate.UpdateProgress
|
||||
lastSelfUpdateState ipnstate.SelfUpdateStatus
|
||||
// capForcedNetfilter is the netfilter that control instructs Linux clients
|
||||
// to use, unless overridden locally.
|
||||
capForcedNetfilter string
|
||||
|
||||
// ServeConfig fields. (also guarded by mu)
|
||||
lastServeConfJSON mem.RO // last JSON that was parsed into serveConfig
|
||||
@@ -3901,12 +3904,21 @@ func (b *LocalBackend) routerConfig(cfg *wgcfg.Config, prefs ipn.PrefsView, oneC
|
||||
singleRouteThreshold = 1
|
||||
}
|
||||
|
||||
netfilterKind := b.capForcedNetfilter
|
||||
if prefs.NetfilterKind() != "" {
|
||||
if b.capForcedNetfilter != "" {
|
||||
b.logf("nodeattr netfilter preference %s overridden by c2n pref %s", b.capForcedNetfilter, prefs.NetfilterKind())
|
||||
}
|
||||
netfilterKind = prefs.NetfilterKind()
|
||||
}
|
||||
|
||||
rs := &router.Config{
|
||||
LocalAddrs: unmapIPPrefixes(cfg.Addresses),
|
||||
SubnetRoutes: unmapIPPrefixes(prefs.AdvertiseRoutes().AsSlice()),
|
||||
SNATSubnetRoutes: !prefs.NoSNAT(),
|
||||
NetfilterMode: prefs.NetfilterMode(),
|
||||
Routes: peerRoutes(b.logf, cfg.Peers, singleRouteThreshold),
|
||||
NetfilterKind: netfilterKind,
|
||||
}
|
||||
|
||||
if distro.Get() == distro.Synology {
|
||||
@@ -4416,6 +4428,14 @@ func (b *LocalBackend) setNetMapLocked(nm *netmap.NetworkMap) {
|
||||
}
|
||||
b.capFileSharing = fs
|
||||
|
||||
if hasCapability(nm, tailcfg.NodeAttrLinuxMustUseIPTables) {
|
||||
b.capForcedNetfilter = "iptables"
|
||||
} else if hasCapability(nm, tailcfg.NodeAttrLinuxMustUseNfTables) {
|
||||
b.capForcedNetfilter = "nftables"
|
||||
} else {
|
||||
b.capForcedNetfilter = "" // empty string means client can auto-detect
|
||||
}
|
||||
|
||||
b.MagicConn().SetSilentDisco(b.ControlKnobs().SilentDisco.Load())
|
||||
|
||||
b.setDebugLogsByCapabilityLocked(nm)
|
||||
|
Reference in New Issue
Block a user