Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/tcpip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ void EtherCard::udpPrepare (uint16_t sport, const uint8_t *dip, uint16_t dport)
} else { // checked if dip is dns ip and separately if dip is hisip and then use correct mac.
setMACandIPs(gwmacaddr, dip);
}
//form a valid multicast mac
if ((dip[0] & 0xF0) == 0xE0){
uint8_t cMac[6];cMac[0]=1;cMac[1]=0;cMac[2]=0x5e;
memcpy(&cMac[3],dip+1,3);
cMac[3]&=0x7f;
EtherCard::copyMac(gPB + ETH_DST_MAC, cMac);
} else
// see http://tldp.org/HOWTO/Multicast-HOWTO-2.html
// multicast or broadcast address, https://github.com/njh/EtherCard/issues/59
if ((dip[0] & 0xF0) == 0xE0 || *((unsigned long*) dip) == 0xFFFFFFFF || !memcmp(broadcastip,dip,IP_LEN))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a duplicate if statement condition?

Expand Down