Strunzdesign / hdlcd

The HDLC Deamon implements the HDLC protocol to easily talk to devices connected via serial communications
GNU General Public License v3.0
17 stars 6 forks source link

Infinite send loop by s-net payload size > 131 Bytes (hdlc payload size > 142 Bytes) #1

Open Tonacatecuhtli opened 7 years ago

Tonacatecuhtli commented 7 years ago

If you send an send a s-net(R) message with an s-net application payload size bigger than 131 Bytes (hdlc palyload size > 142 Bytes) the hdlcd stats sending this message in a infinite loop.

Setup: s-net Master connected to the PC via hdlcd and snet-gateway. Message send with WSN Presets and hdlcd-hexinjector. e.g. 143 Byte hdlc injector message >hdlcd-hexinjector.exe -c //./COM124@localhost:4999 -p "00 00 40 02 3f f7 00 09 17 00 06 00 00 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84"

Strunzdesign commented 7 years ago

Thanks for your report. This issue is not a bug of the HDLCd, but an issue of the downgraded HDLC protocol the s-net tag currently implements. Here, the node does not handle I-frames correctly that exceed the MTU due to missing HDLC session support. We have to switch to an implementation of "vanilla HDLC" in the very near future in order to handle this problem correctly. Such a change will affect the HDLCd as well, but we have to implement the missing pieces both for the s-net tags and the HDLCd at the same time. As long as the HDLCd does not receive a valid S-RR-frame regarding a transmitted I-frame, it will retransmit that frame forever causing a freeze of communications.

I keep this ticket open until we finally implemented and switched to vanilla HDLC. Until that, please avoid sending s-net packets that exceed the MTU of the tag ;-)