softerhardware / Hermes-Lite2

A second generation low-cost amateur HF software defined radio transceiver.
http://www.hermeslite.com
227 stars 80 forks source link

Tighten up handling of ICMP Unreacahble to make sure that the port number is right #152

Closed pjsg closed 3 years ago

pjsg commented 3 years ago

This fixes #151 -- it turned out that the random ICMP unreachable that was generated for unknown reason during DHCP renewal was triggering behavior in the HL2 to stop sending data. This PR changes the ICMP handling logic. If an ICMP Unreachable is received then the source port in the encapsulated IP packet must be 1024 (the streaming data port). If so, then the flag is set to stop streaming. All other ICMP unreachables are ignored.

Tested locally -- changed my dhcp lease time to 5 minutes and verified that it survives the DHCP renewal. Also, verified that if I kill sparksdr (on a linux box) then the OS sends a small number of icmp unreachables, and the stream of data packets stops.