Fix ICMP match.

This commit is contained in:
Adam Ierymenko 2016-10-13 14:21:00 -07:00
parent 2cb760e0ac
commit 4f3775bb86

View file

@ -383,8 +383,8 @@ static _doZtFilterResult _doZtFilter(
break;
case ZT_NETWORK_RULE_MATCH_ICMP:
if ((etherType == ZT_ETHERTYPE_IPV4)&&(frameLen >= 20)) {
if (frameData[9] == 0x01) {
const unsigned int ihl = (frameData[0] & 0xf) * 32;
if (frameData[9] == 0x01) { // IP protocol == ICMP
const unsigned int ihl = (frameData[0] & 0xf) * 4;
if (frameLen >= (ihl + 2)) {
if (rules[rn].v.icmp.type == frameData[ihl]) {
if ((rules[rn].v.icmp.flags & 0x01) != 0) {