The mesh's interface takes over the found tunnel's MTU
Carries MTU from the reported tunnel (mesh-host#28) through inventory, the overlay graph's TakeOver, into the generated config's [Interface]. A tuned path keeps its MTU across the takeover instead of regressing to 1420 and hanging transfers no ping would reveal. Two emit tests; a tunnel with no MTU writes no line.
This commit is contained in:
@@ -286,3 +286,26 @@ func TestANodeWithNoTunnelAndNoEndpointStillListensOnNothing(t *testing.T) {
|
||||
t.Fatalf("a dial-only node needs no ListenPort:\n%s", config)
|
||||
}
|
||||
}
|
||||
|
||||
func TestATakenTunnelCarriesItsMTU(t *testing.T) {
|
||||
// A path tuned to a smaller MTU (1380 here) must survive the takeover — the mesh interface
|
||||
// comes up with the same MTU, or transfers hang silently (novox/hq: a taken tunnel carries
|
||||
// its MTU).
|
||||
config, _ := declarationFor(t, Node{
|
||||
Name: "shanks", Key: "SPOKE", Address: "10.10.0.3",
|
||||
TakesOver: &TakeOver{Interface: "wg0", Port: 51820, MTU: 1380},
|
||||
}, nil)
|
||||
if !strings.Contains(config, "MTU = 1380") {
|
||||
t.Fatalf("the tuned MTU was dropped:\n%s", config)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNoMTULineWhenTheTunnelSetNone(t *testing.T) {
|
||||
config, _ := declarationFor(t, Node{
|
||||
Name: "shanks", Key: "SPOKE", Address: "10.10.0.3",
|
||||
TakesOver: &TakeOver{Interface: "wg0", Port: 51820},
|
||||
}, nil)
|
||||
if strings.Contains(config, "MTU") {
|
||||
t.Fatalf("no MTU was found, so none should be written:\n%s", config)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user