Added check to prevent BACnet/IP messages from myself.

This commit is contained in:
skarg
2005-07-03 11:15:08 +00:00
parent 36bebd5247
commit 0bf6b5885e
+9 -1
View File
@@ -276,7 +276,13 @@ uint16_t bip_receive(
/* Original-Broadcast-NPDU or Original-Unicast-NPDU */
if ((buf[1] == 0x0B) || (buf[1] == 0x0A))
{
// copy the source address
/* ignore messages from me */
if (sin.sin_addr.s_addr == BIP_Address.s_addr)
pdu_len = 0;
else
{
/* copy the source address
FIXME: IPv6? */
src->mac_len = 6;
(void)encode_unsigned32(&src->mac[0],
sin.sin_addr.s_addr);
@@ -284,6 +290,7 @@ uint16_t bip_receive(
sin.sin_port);
// FIXME: check destination address
// see if it is broadcast or for us
/* decode the length of the PDU - length is inclusive of BVLC */
(void)decode_unsigned16(&buf[2],&pdu_len);
/* copy the buffer into the PDU */
@@ -293,6 +300,7 @@ uint16_t bip_receive(
else
pdu_len = 0;
}
}
return pdu_len;
}