DADR is only valid when DNET is specified (i.e. net is non-zero).
This commit is contained in:
@@ -60,7 +60,7 @@
|
|||||||
/* FIXME: mac[] only needs to be as big as our local datalink MAC */
|
/* FIXME: mac[] only needs to be as big as our local datalink MAC */
|
||||||
#define MAX_MAC_LEN 7
|
#define MAX_MAC_LEN 7
|
||||||
struct BACnet_Device_Address {
|
struct BACnet_Device_Address {
|
||||||
/* mac_len = 0 if global address */
|
/* mac_len = 0 is a broadcast address */
|
||||||
uint8_t mac_len;
|
uint8_t mac_len;
|
||||||
/* note: MAC for IP addresses uses 4 bytes for addr, 2 bytes for port */
|
/* note: MAC for IP addresses uses 4 bytes for addr, 2 bytes for port */
|
||||||
/* use de/encode_unsigned32/16 for re/storing the IP address */
|
/* use de/encode_unsigned32/16 for re/storing the IP address */
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ int bip_send_pdu(
|
|||||||
|
|
||||||
mtu[0] = BVLL_TYPE_BACNET_IP;
|
mtu[0] = BVLL_TYPE_BACNET_IP;
|
||||||
bip_dest.sin_family = AF_INET;
|
bip_dest.sin_family = AF_INET;
|
||||||
if (dest->net == BACNET_BROADCAST_NETWORK
|
if (dest->net == BACNET_BROADCAST_NETWORK
|
||||||
|| dest->len == 0
|
|| ((dest->net > 0) && (dest->len == 0))
|
||||||
|| dest->mac_len == 0) {
|
|| dest->mac_len == 0) {
|
||||||
/* broadcast */
|
/* broadcast */
|
||||||
address.s_addr = BIP_Broadcast_Address.s_addr;
|
address.s_addr = BIP_Broadcast_Address.s_addr;
|
||||||
|
|||||||
@@ -1140,8 +1140,12 @@ int bvlc_send_pdu(
|
|||||||
/* bip datalink doesn't need to know the npdu data */
|
/* bip datalink doesn't need to know the npdu data */
|
||||||
(void) npdu_data;
|
(void) npdu_data;
|
||||||
mtu[0] = BVLL_TYPE_BACNET_IP;
|
mtu[0] = BVLL_TYPE_BACNET_IP;
|
||||||
if ( dest->net == BACNET_BROADCAST_NETWORK
|
/* handle various broadcasts: */
|
||||||
|| dest->len == 0
|
/* 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) {
|
|| dest->mac_len == 0) {
|
||||||
/* if we are a foreign device */
|
/* if we are a foreign device */
|
||||||
if (Remote_BBMD.sin_port) {
|
if (Remote_BBMD.sin_port) {
|
||||||
|
|||||||
Reference in New Issue
Block a user