Fixed BACnet/IP to handler remote network broadcast that is unicast to the router.
This commit is contained in:
+10
-2
@@ -166,12 +166,20 @@ int bip_send_pdu(
|
||||
|
||||
mtu[0] = BVLL_TYPE_BACNET_IP;
|
||||
bip_dest.sin_family = AF_INET;
|
||||
if ((dest->net == BACNET_BROADCAST_NETWORK) || ((dest->net > 0) &&
|
||||
(dest->len == 0)) || (dest->mac_len == 0)) {
|
||||
if ((dest->net == BACNET_BROADCAST_NETWORK) || (dest->mac_len == 0)) {
|
||||
/* broadcast */
|
||||
address.s_addr = BIP_Broadcast_Address.s_addr;
|
||||
port = BIP_Port;
|
||||
mtu[1] = BVLC_ORIGINAL_BROADCAST_NPDU;
|
||||
} else if ((dest->net > 0) && (dest->len == 0)) {
|
||||
/* network specific broadcast */
|
||||
if (dest->mac_len == 6) {
|
||||
bip_decode_bip_address(dest, &address, &port);
|
||||
} else {
|
||||
address.s_addr = BIP_Broadcast_Address.s_addr;
|
||||
port = BIP_Port;
|
||||
}
|
||||
mtu[1] = BVLC_ORIGINAL_BROADCAST_NPDU;
|
||||
} else if (dest->mac_len == 6) {
|
||||
bip_decode_bip_address(dest, &address, &port);
|
||||
mtu[1] = BVLC_ORIGINAL_UNICAST_NPDU;
|
||||
|
||||
+12
-3
@@ -1181,9 +1181,7 @@ int bvlc_send_pdu(
|
||||
/* handle various broadcasts: */
|
||||
/* mac_len = 0 is a broadcast address */
|
||||
/* net = 0 indicates local, net = 65535 indicates global */
|
||||
/* net > 0 and net < 65535 are network specific broadcast if len = 0 */
|
||||
if ((dest->net == BACNET_BROADCAST_NETWORK) || ((dest->net > 0) &&
|
||||
(dest->len == 0)) || (dest->mac_len == 0)) {
|
||||
if ((dest->net == BACNET_BROADCAST_NETWORK) || (dest->mac_len == 0)) {
|
||||
/* if we are a foreign device */
|
||||
if (Remote_BBMD.sin_port) {
|
||||
mtu[1] = BVLC_DISTRIBUTE_BROADCAST_TO_NETWORK;
|
||||
@@ -1196,6 +1194,17 @@ int bvlc_send_pdu(
|
||||
mtu[1] = BVLC_ORIGINAL_BROADCAST_NPDU;
|
||||
debug_printf("BVLC: Sent Original-Broadcast-NPDU.\n");
|
||||
}
|
||||
} else if ((dest->net > 0) && (dest->len == 0)) {
|
||||
/* net > 0 and net < 65535 are network specific broadcast if len = 0 */
|
||||
if (dest->mac_len == 6) {
|
||||
/* network specific broadcast */
|
||||
bvlc_decode_bip_address(&dest->mac[0], &address, &port);
|
||||
} else {
|
||||
address.s_addr = bip_get_broadcast_addr();
|
||||
port = bip_get_port();
|
||||
}
|
||||
mtu[1] = BVLC_ORIGINAL_BROADCAST_NPDU;
|
||||
debug_printf("BVLC: Sent Original-Broadcast-NPDU.\n");
|
||||
} else if (dest->mac_len == 6) {
|
||||
/* valid unicast */
|
||||
bvlc_decode_bip_address(&dest->mac[0], &address, &port);
|
||||
|
||||
Reference in New Issue
Block a user