debug(icom): log the raw packets seen during a control handshake
A rig that answers something unrecognised (a newer model, another firmware) and a rig that answers nothing are different faults; a silent timeout hides which. Capped at a dozen packets so a working handshake cannot flood the log. Prompted by the first IC-7760 network attempt — which turned out to be aimed at the console's IP, where nothing listens; the remote server lives on the RF deck.
This commit is contained in:
@@ -712,6 +712,11 @@ func icnHandshake(c *net.UDPConn, myID uint32, cancel <-chan struct{}) (uint32,
|
|||||||
}
|
}
|
||||||
typ := icnLE.Uint16(p[4:])
|
typ := icnLE.Uint16(p[4:])
|
||||||
sentid := icnLE.Uint32(p[8:])
|
sentid := icnLE.Uint32(p[8:])
|
||||||
|
// Every packet the rig sends during the handshake, verbatim. A radio that
|
||||||
|
// answers SOMETHING unrecognised (a newer model, a different firmware) and
|
||||||
|
// a radio that answers nothing are different faults, and a silent timeout
|
||||||
|
// hides which one this is.
|
||||||
|
icnHandshakeProbe(p)
|
||||||
switch typ {
|
switch typ {
|
||||||
case 0x04: // iAmHere
|
case 0x04: // iAmHere
|
||||||
remoteID = sentid
|
remoteID = sentid
|
||||||
@@ -903,3 +908,19 @@ func icnPasscode(s string) []byte {
|
|||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// icnHandshakeProbe logs the first packets seen during a control handshake —
|
||||||
|
// capped hard, because a working handshake would log for ever.
|
||||||
|
var icnProbeCount int
|
||||||
|
|
||||||
|
func icnHandshakeProbe(p []byte) {
|
||||||
|
if icnProbeCount >= 12 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
icnProbeCount++
|
||||||
|
n := len(p)
|
||||||
|
if n > 32 {
|
||||||
|
n = 32
|
||||||
|
}
|
||||||
|
debugLog.Printf("icom net: handshake rx %d bytes: % X", len(p), p[:n])
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user