A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
Diff: ip4/ip4.cpp
- Revision:
- 15:6ca6778168b1
- Parent:
- 14:e75a59c1123d
- Child:
- 18:accfcb80d9c3
--- a/ip4/ip4.cpp Fri May 05 17:44:16 2017 +0000 +++ b/ip4/ip4.cpp Tue May 09 15:39:03 2017 +0000 @@ -150,10 +150,23 @@ readHeader(pHeader); bool isMe = Ip4Dst == DhcpLocalIp; + bool isLocalBroadcast = Ip4Dst == DhcpLocalIp | 0xFF000000; bool isBroadcast = Ip4Dst == IP4_BROADCAST_ADDRESS; bool isMulticast = (Ip4Dst & 0xE0) == 0xE0; //224.x.x.x == 1110 0000 == E0.xx.xx.xx == xx.xx.xx.E0 in little endian - if (!isMe && !isBroadcast && !isMulticast) return DO_NOTHING; + bool doIt = isMe || isLocalBroadcast || isBroadcast || isMulticast; + if (!doIt) + { + if (DEBUG) + { + char text[20]; + Ip4AddressToString(Ip4Dst, sizeof(text), text); + LogTimeF("IP4 filtered out ip %s ", text); + Ip4AddressToString(Ip4Src, sizeof(text), text); + LogF("from %s \r\n", text); + } + return DO_NOTHING; + } ArAdd4(pSrcMac, Ip4Src);