Skip to content

Commit 2749883

Browse files
committed
reject query, reply and "from storage" requests
1 parent 017c583 commit 2749883

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

wled00/e131.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ static void handleDDPPacket(e131_packet_t* p, size_t packetLen) {
3333
// reject control, status and config packets (not implemented)
3434
if (p->destination == DDP_ID_CONTROL || p->destination == DDP_ID_STATUS || p->destination == DDP_ID_CONFIG) return;
3535

36+
// reject query and response packets (not implemented)
37+
if (p->flags & (DDP_FLAGS_QUERY | DDP_FLAGS_REPLY)) return;
38+
39+
bool push = p->flags & DDP_FLAGS_PUSH; // push flag means "render now"
40+
if (!push && (p->flags & DDP_FLAGS_STORAGE)) return; // reject "from storage" flag but still let the push flag pass if set along with it
41+
3642
//reject late packets belonging to previous frame (assuming 4 packets max. before push, if more are used and packets are very late, they are still accepted)
3743
if (e131SkipOutOfSequence && lastPushSeq) {
3844
int sn = p->sequenceNum & 0xF; // sequence number is 4 bits, 1-15, 0 means unused
@@ -78,7 +84,6 @@ static void handleDDPPacket(e131_packet_t* p, size_t packetLen) {
7884
}
7985
}
8086

81-
bool push = p->flags & DDP_FLAGS_PUSH;
8287
ddpSeenPush |= push;
8388
if (!ddpSeenPush || push) { // if we've never seen a push, or this is one, render display
8489
e131NewData = true;

wled00/src/dependencies/e131/ESPAsyncE131.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ typedef struct ip_addr ip4_addr_t;
5555
#define DDP_FLAGS_VER 0xc0 // version mask
5656
#define DDP_FLAGS_VER1 0x40 // version=1
5757
#define DDP_FLAGS_PUSH 0x01
58-
#define DDP_FLAGS_QUERY 0x02
59-
#define DDP_FLAGS_REPLY 0x04
60-
#define DDP_FLAGS_STORAGE 0x08
58+
#define DDP_FLAGS_QUERY 0x02 // unsupported - used by XLights for auto-discovery
59+
#define DDP_FLAGS_REPLY 0x04 // unsupported - response packet from another display
60+
#define DDP_FLAGS_STORAGE 0x08 // unsupported - show data from a storage unit instead of from packet data field. Data field defines storage unit (by name, number, URL or whatever mechanism wanted).
6161
#define DDP_FLAGS_TIME 0x10
6262

6363
#define DDP_CHANNELS_PER_PACKET 1440 // 480 leds

0 commit comments

Comments
 (0)