docsteer / sacnview

sACNView provides a tool for monitoring and sending the Streaming ACN lighting control protocol used for lighting control in theatres, TV studios and architectural systems
http://www.sacnview.org
Apache License 2.0
101 stars 24 forks source link

sacn: [WARN] sACN: Ignoring malformed sACN universe discovery packet from component XXX #263

Closed mxwendler closed 2 years ago

mxwendler commented 2 years ago

Hello there,

thank you for writing this awesome tool!

On my windows laptop i have sacnview and my own application using the etc sacn library. i get warnings in the log,

00:56:16: Debug: sacn: [WARN] sACN: Ignoring malformed sACN universe discovery packet from component 7b646566-3632-6538-652d-613863652d34

and looking deeper into the issue, this check in the ETC library fails:

bool parse_sacn_universe_discovery_layer(const uint8_t* buf, size_t buflen, int* page, int* last_page,
                                         const uint8_t** universes, size_t* num_universes)
{
  // Check the input parameters including buffer size
  if (!buf || !page || !last_page || !universes || !num_universes || buflen < SACN_DATA_PACKET_MIN_SIZE)
    return false;
   [...]
}

because buflen is 10, which is lower than SACN_DATA_PACKET_MIN_SIZE (88).

This is the packet data in wireshark:
0000   01 00 5e 7f fa d6 9e b6 be 1f ae 2a 08 00 45 00
0010   00 96 d4 18 00 00 01 11 31 04 c0 a8 08 bc ef ff
0020   fa d6 d1 bc 15 c0 00 82 9d c4 00 10 00 00 41 53
0030   43 2d 45 31 2e 31 37 00 00 00 70 6a 00 00 00 08
0040   7b 64 65 66 36 32 65 38 65 2d 61 38 63 65 2d 34
0050   70 54 00 00 00 02 73 41 43 4e 56 69 65 77 00 00
0060   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090   00 00 00 00 00 00 00 00 00 00 70 0a 00 00 00 01
00a0   00 00 00 01

These are much more than 10 bytes .. can someone give me a hint if the issue is either in sacnview or in the etc library?

marcusbirkin commented 2 years ago

Could you attache the frame as a pcap file, that makes it much simpler for me to debug?

mxwendler commented 2 years ago

sure! only one pcap, the capture is 200MB fault-discovery-1.zip

marcusbirkin commented 2 years ago

So disecting that frame, it looks ok to me. Ignoring the UDP/IP header:

Root Layer

E1.31 Framing Layer

Universe Discovery Layer

mxwendler commented 2 years ago

Thank you - i also think the check for SACN_DATA_PACKET_MIN_SIZE makes no sense here, since the check for a general packet size is done before (ETC Library code):

bool parse_sacn_data_packet(const uint8_t* buf, size_t buflen, SacnRemoteSource* source_info, uint8_t* seq,
                            bool* terminated, SacnRecvUniverseData* universe_data)
{
  // Check the input parameters including buffer size
  if (!buf || !source_info || !seq || !terminated || !universe_data || buflen < SACN_DATA_PACKET_MIN_SIZE)
    return false;
[...]
}

I will point the ETC developers to this issue. Thank you again for your prompt support!