Skip to content

Commit

Permalink
Heuristics to fix interop with bad ZeroChecksum
Browse files Browse the repository at this point in the history
The SCTP implementation used in v3.2.28 fails to establish a connection
with other WebRTC implementations. The implementation of ZeroChecksum
assumes incorrectly that the feature is bi-directional

SCTP ZeroChecksum is actually a uni-directional feature which causes the
Assocations to be unable to communicate.
  • Loading branch information
Sean-Der committed Apr 3, 2024
1 parent f0386f2 commit b6135a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions association.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ type Association struct {
peerVerificationTag uint32
myVerificationTag uint32
state uint32
initialTSN uint32
myNextTSN uint32 // nextTSN
peerLastTSN uint32 // lastRcvdTSN
minTSN2MeasureRTT uint32 // for RTT measurement
Expand Down Expand Up @@ -336,6 +337,7 @@ func createAssociation(config Config) *Association {
mtu: initialMTU,
maxPayloadSize: initialMTU - (commonHeaderSize + dataChunkHeaderSize),
myVerificationTag: globalMathRandomGenerator.Uint32(),
initialTSN: tsn,
myNextTSN: tsn,
myNextRSN: tsn,
minTSN2MeasureRTT: tsn,
Expand Down Expand Up @@ -2553,6 +2555,12 @@ func (a *Association) onRetransmissionTimeout(id int, nRtos uint) {
a.lock.Lock()
defer a.lock.Unlock()

// TSN hasn't been incremented in 3 attempts. Speculatively
// disable ZeroChecksum because old Pion versions had a broken implementation
if a.cumulativeTSNAckPoint+1 == a.initialTSN && nRtos == 3 {
a.sendZeroChecksum = false
}

if id == timerT1Init {
err := a.sendInit()
if err != nil {
Expand Down

0 comments on commit b6135a7

Please sign in to comment.