simplify fragmentation test
This is how fragmentation tests used to happen:
A: conn.stackFrag = false
A->B: StartFragmentationTest
B->A: send large non-DF UDP packet
A->B: FragmentationReceived
B: conn.stackFrag = true
conn.stackFrag = true means "UDP packets sent to the other peer get
correctly fragmented and re-assembled".
Note how A clears its own stackFrag flag, but the test establishes
whether fragmentation works for B->A, and ends up setting stackFrag on
B. Not only is this weird, it also means that if A previously had
stackFrag=true, it will now start fragmenting packets until B
initiates a fragmentation test.
The new sequence is:
A: conn.stackFrag = false
A->B: send large non-DF UDP packet
B->A: FragmentationReceived
A: conn.stackFrag = true
Closes #746.
This commit is contained in:
1 parent
bd364f787e
commit
fbf2208e80
2 files changed
+12
-14
No files matched your search
+11
-12
@@ -262,10 +262,7 @@ func (conn *LocalConnection) SetEstablished() {
|
|||||||
conn.fragTest = time.NewTicker(FragTestInterval)
|
conn.fragTest = time.NewTicker(FragTestInterval)
|
||||||
// avoid initial waits for timers to fire
|
// avoid initial waits for timers to fire
|
||||||
conn.Forward(true, conn.heartbeatFrame, nil)
|
conn.Forward(true, conn.heartbeatFrame, nil)
|
||||||
conn.setStackFrag(false)
|
conn.performFragTest()
|
||||||
if err := conn.sendSimpleProtocolMsg(ProtocolStartFragmentationTest); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -386,8 +383,7 @@ func (conn *LocalConnection) actorLoop(actionChan <-chan ConnectionAction) (err
|
|||||||
case <-tickerChan(conn.heartbeat):
|
case <-tickerChan(conn.heartbeat):
|
||||||
conn.Forward(true, conn.heartbeatFrame, nil)
|
conn.Forward(true, conn.heartbeatFrame, nil)
|
||||||
case <-tickerChan(conn.fragTest):
|
case <-tickerChan(conn.fragTest):
|
||||||
conn.setStackFrag(false)
|
conn.performFragTest()
|
||||||
err = conn.sendSimpleProtocolMsg(ProtocolStartFragmentationTest)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -473,12 +469,6 @@ func (conn *LocalConnection) handleProtocolMsg(tag ProtocolTag, payload []byte)
|
|||||||
// We can now consider the connection as established from our
|
// We can now consider the connection as established from our
|
||||||
// end.
|
// end.
|
||||||
conn.SetEstablished()
|
conn.SetEstablished()
|
||||||
case ProtocolStartFragmentationTest:
|
|
||||||
conn.Forward(false, &ForwardedFrame{
|
|
||||||
srcPeer: conn.local,
|
|
||||||
dstPeer: conn.remote,
|
|
||||||
frame: FragTest},
|
|
||||||
nil)
|
|
||||||
case ProtocolFragmentationReceived:
|
case ProtocolFragmentationReceived:
|
||||||
conn.setStackFrag(true)
|
conn.setStackFrag(true)
|
||||||
case ProtocolPMTUVerified:
|
case ProtocolPMTUVerified:
|
||||||
@@ -504,6 +494,15 @@ func (conn *LocalConnection) sendFastHeartbeats() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (conn *LocalConnection) performFragTest() {
|
||||||
|
conn.setStackFrag(false)
|
||||||
|
conn.Forward(false, &ForwardedFrame{
|
||||||
|
srcPeer: conn.local,
|
||||||
|
dstPeer: conn.remote,
|
||||||
|
frame: FragTest},
|
||||||
|
nil)
|
||||||
|
}
|
||||||
|
|
||||||
func tickerChan(ticker *time.Ticker) <-chan time.Time {
|
func tickerChan(ticker *time.Ticker) <-chan time.Time {
|
||||||
if ticker != nil {
|
if ticker != nil {
|
||||||
return ticker.C
|
return ticker.C
|
||||||
|
|||||||
+1
-2
@@ -2,7 +2,7 @@ package router
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
Protocol = "weave"
|
Protocol = "weave"
|
||||||
ProtocolVersion = 18
|
ProtocolVersion = 19
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProtocolTag byte
|
type ProtocolTag byte
|
||||||
@@ -11,7 +11,6 @@ const (
|
|||||||
ProtocolHeartbeat ProtocolTag = iota
|
ProtocolHeartbeat ProtocolTag = iota
|
||||||
ProtocolConnectionEstablished
|
ProtocolConnectionEstablished
|
||||||
ProtocolFragmentationReceived
|
ProtocolFragmentationReceived
|
||||||
ProtocolStartFragmentationTest
|
|
||||||
ProtocolPMTUVerified
|
ProtocolPMTUVerified
|
||||||
ProtocolGossip
|
ProtocolGossip
|
||||||
ProtocolGossipUnicast
|
ProtocolGossipUnicast
|
||||||
|
|||||||
Reference in new issue
Block a user