修复 DPD-REQ 协议

This commit is contained in:
bjdgy 2023-12-31 22:39:29 +08:00
parent 970213f269
commit 2e86547e97
2 changed files with 3 additions and 1 deletions

View File

@ -75,6 +75,7 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
case 0x03: // DPD-REQ case 0x03: // DPD-REQ
// base.Debug("recv DPD-REQ", cSess.IpAddr) // base.Debug("recv DPD-REQ", cSess.IpAddr)
pl.PType = 0x04 pl.PType = 0x04
pl.Data = pl.Data[:n]
if payloadOutCstp(cSess, pl) { if payloadOutCstp(cSess, pl) {
return return
} }
@ -168,7 +169,7 @@ func cstpWrite(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessi
binary.BigEndian.PutUint16(pl.Data[4:6], uint16(l)) binary.BigEndian.PutUint16(pl.Data[4:6], uint16(l))
} }
} else { } else {
pl.Data = append(pl.Data[:0], plHeader...) // pl.Data = append(pl.Data[:0], plHeader...)
// 设置头类型 // 设置头类型
pl.Data[6] = pl.PType pl.Data[6] = pl.PType
} }

View File

@ -150,6 +150,7 @@ func dtlsWrite(conn net.Conn, dSess *sessdata.DtlsSession, cSess *sessdata.ConnS
} }
} else { } else {
// 设置头类型 // 设置头类型
// pl.Data = append(pl.Data[:0], pl.PType)
pl.Data[0] = pl.PType pl.Data[0] = pl.PType
} }
n, err := conn.Write(pl.Data) n, err := conn.Write(pl.Data)