Currently my BACnet server implementation responds to unicast confirmed requests and local confirmed broadcasts. It discards global broadcasts, which is good. I need to disable local confirmed broadcasts. for example when receiving read property. Where and how is this accomplished? Stack version used is 0.8.7.
Last edit: Mladen Bajšić 2020-09-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I have a similar issue in my BACnet server implementation. It responds to Global and Local confirmed requests. It is because the stack isn't able to parse the destination address of the request. I have changed some functionality in bvlc .c sourse file to parse all data from the UDP socket to get the destination address of the request. Then I handle it in NPDU handler as shown below. It works properly now. Could you please advise, whether it good solution or it can affect the BACnet stack, or maybe you know a better solution?
In the BVLC handler, I added bvlc_broadcast_handler() function to handle the incoming Broadcast destination from the datalink, so that the code remains layered:
intbvlc_broadcast_handler(BACNET_IP_ADDRESS*addr,BACNET_ADDRESS*src,uint8_t*npdu,uint16_tnpdu_len){intoffset=0;uint8_tmessage_type=0;uint16_tmessage_length=0;intheader_len=0;debug_print_bip("Received Broadcast",addr);header_len=bvlc_decode_header(npdu,npdu_len,&message_type,&message_length);if(header_len==4){switch(message_type){caseBVLC_ORIGINAL_UNICAST_NPDU:/* drop unicast when sent as a broadcast */debug_print_bip("Dropped BVLC (Original Unicast)",addr);break;default:offset=bvlc_handler(addr,src,npdu,npdu_len);break;}}returnoffset;}
Currently my BACnet server implementation responds to unicast confirmed requests and local confirmed broadcasts. It discards global broadcasts, which is good. I need to disable local confirmed broadcasts. for example when receiving read property. Where and how is this accomplished? Stack version used is 0.8.7.
Last edit: Mladen Bajšić 2020-09-25
The npdu_handler() is responsible for ignoring broadcasts. 0.8.7 uses the following code:
Hi!
I have a similar issue in my BACnet server implementation. It responds to Global and Local confirmed requests. It is because the stack isn't able to parse the destination address of the request. I have changed some functionality in bvlc .c sourse file to parse all data from the UDP socket to get the destination address of the request. Then I handle it in NPDU handler as shown below. It works properly now. Could you please advise, whether it good solution or it can affect the BACnet stack, or maybe you know a better solution?
In the BVLC handler, I added bvlc_broadcast_handler() function to handle the incoming Broadcast destination from the datalink, so that the code remains layered:
See https://sourceforge.net/p/bacnet/src/ci/master/tree/src/bacnet/basic/bbmd/h_bbmd.c