Added check to make sure destination network address is zero, indicating a local destination (me) instead of a routed destination.

This commit is contained in:
skarg
2008-06-20 17:38:51 +00:00
parent 24e7c4c908
commit 0cb7ad6d9c
+6 -3
View File
@@ -385,16 +385,19 @@ void npdu_handler(
fprintf(stderr, "NPDU: Network Layer Message discarded!\n"); fprintf(stderr, "NPDU: Network Layer Message discarded!\n");
#endif #endif
} else if ((apdu_offset > 0) && (apdu_offset <= pdu_len)) { } else if ((apdu_offset > 0) && (apdu_offset <= pdu_len)) {
/* only handle the version that we know how to handle */ if ((npdu_data.protocol_version == BACNET_PROTOCOL_VERSION) &&
if (npdu_data.protocol_version == BACNET_PROTOCOL_VERSION) (dest.net == 0)) {
/* only handle the version that we know how to handle */
/* and we are not a router, so ignore messages with
routing information cause they are not for us */
apdu_handler(src, &pdu[apdu_offset], apdu_handler(src, &pdu[apdu_offset],
(uint16_t) (pdu_len - apdu_offset)); (uint16_t) (pdu_len - apdu_offset));
}
} }
return; return;
} }
#ifdef TEST #ifdef TEST
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>