From e68f8008d52cd0292bfdeb6955b22c0dcc5855c1 Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 23 Mar 2005 16:53:10 +0000 Subject: [PATCH] corrected code to make it work --- bacnet-stack/ports/linux/ethernet.c | 15 +++------------ bacnet-stack/ports/linux/main.c | 6 +++--- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/bacnet-stack/ports/linux/ethernet.c b/bacnet-stack/ports/linux/ethernet.c index 841278a9..0051fe78 100644 --- a/bacnet-stack/ports/linux/ethernet.c +++ b/bacnet-stack/ports/linux/ethernet.c @@ -203,16 +203,7 @@ int ethernet_send( { for (i = 0; i < 6; i++) { - mtu[i] = dest->mac[i]; - mtu_len++; - } - } - // Global Broadcast - else if (dest->mac_len == 0) - { - for (i = 0; i < 6; i++) - { - mtu[i] = Ethernet_Broadcast[i]; + mtu[mtu_len] = dest->mac[i]; mtu_len++; } } @@ -227,7 +218,7 @@ int ethernet_send( { for (i = 0; i < 6; i++) { - mtu[i] = src->mac[i]; + mtu[mtu_len] = src->mac[i]; mtu_len++; } } @@ -377,7 +368,7 @@ void ethernet_set_broadcast_address( { for (i = 0; i < 6; i++) { - dest->mac[i] = 0xFF; + dest->mac[i] = Ethernet_Broadcast[i]; } dest->mac_len = 6; dest->net = BACNET_BROADCAST_NETWORK; diff --git a/bacnet-stack/ports/linux/main.c b/bacnet-stack/ports/linux/main.c index 2bed3407..c9c6bf17 100644 --- a/bacnet-stack/ports/linux/main.c +++ b/bacnet-stack/ports/linux/main.c @@ -35,8 +35,7 @@ void Send_IAm(void) BACNET_ADDRESS src; // I-Am is a global broadcast - dest.mac_len = 0; - + ethernet_set_broadcast_address(&dest); ethernet_get_my_address(&src); // encode the NPDU portion of the packet @@ -59,6 +58,7 @@ void Send_IAm(void) &dest, // destination address &Tx_Buf[0], pdu_len); // number of bytes of data + fprintf(stderr,"Sent I-Am Request!\n"); } void WhoIsHandler( @@ -70,7 +70,7 @@ void WhoIsHandler( int32_t low_limit = 0; int32_t high_limit = 0; - fprintf(stderr,"Received Who-Is Request!\r"); + fprintf(stderr,"Received Who-Is Request!\n"); len = whois_decode_service_request( service_request, service_len,