mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-22 11:01:54 +00:00
wgengine/router,ipn/ipnlocal: add MTU field to router config
The MacOS client can't set the MTU when creating the tun due to lack of permissions, so add it to the router config and have MacOS set it in the callback using a method that it does have permissions for. Updates #8219 Signed-off-by: Val <valerie@tailscale.com>
This commit is contained in:
@@ -24,9 +24,16 @@ type CallbackRouter struct {
|
||||
// will return ErrGetBaseConfigNotSupported.
|
||||
GetBaseConfigFunc func() (dns.OSConfig, error)
|
||||
|
||||
mu sync.Mutex // protects all the following
|
||||
rcfg *Config // last applied router config
|
||||
dcfg *dns.OSConfig // last applied DNS config
|
||||
// InitialMTU is the MTU the tun should be initialized with.
|
||||
// Zero means don't change the MTU from the default. This MTU
|
||||
// is applied only once, shortly after the TUN is created, and
|
||||
// ignored thereafter.
|
||||
InitialMTU uint32
|
||||
|
||||
mu sync.Mutex // protects all the following
|
||||
didSetMTU bool // if we set the MTU already
|
||||
rcfg *Config // last applied router config
|
||||
dcfg *dns.OSConfig // last applied DNS config
|
||||
}
|
||||
|
||||
// Up implements Router.
|
||||
@@ -41,6 +48,10 @@ func (r *CallbackRouter) Set(rcfg *Config) error {
|
||||
if r.rcfg.Equal(rcfg) {
|
||||
return nil
|
||||
}
|
||||
if r.didSetMTU == false {
|
||||
r.didSetMTU = true
|
||||
rcfg.NewMTU = int(r.InitialMTU)
|
||||
}
|
||||
r.rcfg = rcfg
|
||||
return r.SetBoth(r.rcfg, r.dcfg)
|
||||
}
|
||||
|
Reference in New Issue
Block a user