|
@@ -216,6 +216,7 @@ func (c Tun) Activate() error {
|
|
LinkIndex: link.Attrs().Index,
|
|
LinkIndex: link.Attrs().Index,
|
|
Dst: dr,
|
|
Dst: dr,
|
|
MTU: c.DefaultMTU,
|
|
MTU: c.DefaultMTU,
|
|
|
|
+ AdvMSS: c.advMSS(route{}),
|
|
Scope: unix.RT_SCOPE_LINK,
|
|
Scope: unix.RT_SCOPE_LINK,
|
|
Src: c.Cidr.IP,
|
|
Src: c.Cidr.IP,
|
|
Protocol: unix.RTPROT_KERNEL,
|
|
Protocol: unix.RTPROT_KERNEL,
|
|
@@ -233,6 +234,7 @@ func (c Tun) Activate() error {
|
|
LinkIndex: link.Attrs().Index,
|
|
LinkIndex: link.Attrs().Index,
|
|
Dst: r.route,
|
|
Dst: r.route,
|
|
MTU: r.mtu,
|
|
MTU: r.mtu,
|
|
|
|
+ AdvMSS: c.advMSS(r),
|
|
Scope: unix.RT_SCOPE_LINK,
|
|
Scope: unix.RT_SCOPE_LINK,
|
|
}
|
|
}
|
|
|
|
|
|
@@ -248,6 +250,7 @@ func (c Tun) Activate() error {
|
|
LinkIndex: link.Attrs().Index,
|
|
LinkIndex: link.Attrs().Index,
|
|
Dst: r.route,
|
|
Dst: r.route,
|
|
MTU: r.mtu,
|
|
MTU: r.mtu,
|
|
|
|
+ AdvMSS: c.advMSS(r),
|
|
Scope: unix.RT_SCOPE_LINK,
|
|
Scope: unix.RT_SCOPE_LINK,
|
|
}
|
|
}
|
|
|
|
|
|
@@ -265,3 +268,16 @@ func (c Tun) Activate() error {
|
|
|
|
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func (c Tun) advMSS(r route) int {
|
|
|
|
+ mtu := r.mtu
|
|
|
|
+ if r.mtu == 0 {
|
|
|
|
+ mtu = c.DefaultMTU
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // We only need to set advmss if the route MTU does not match the device MTU
|
|
|
|
+ if mtu != c.MaxMTU {
|
|
|
|
+ return mtu - 40
|
|
|
|
+ }
|
|
|
|
+ return 0
|
|
|
|
+}
|