From 696b215c5318b1da4c5eaf91e8f277e73c486715 Mon Sep 17 00:00:00 2001 From: tbrennan3 Date: Fri, 26 Aug 2011 15:28:15 +0000 Subject: [PATCH] Added a check to (try to) prevent nuisance Reject-Message-to-Network messages when we receive a broadcast to an unreachable-to-us DNET. --- bacnet-stack/demo/handler/h_routed_npdu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bacnet-stack/demo/handler/h_routed_npdu.c b/bacnet-stack/demo/handler/h_routed_npdu.c index 36e877ed..3f321ce7 100644 --- a/bacnet-stack/demo/handler/h_routed_npdu.c +++ b/bacnet-stack/demo/handler/h_routed_npdu.c @@ -198,9 +198,20 @@ static void routed_apdu_handler( bool bGotOne = false; if (!Routed_Device_Is_Valid_Network(dest->net, DNET_list)) { - /* We don't know how to reach this one */ - Send_Reject_Message_To_Network(src, NETWORK_REJECT_NO_ROUTE, - dest->net); + /* We don't know how to reach this one. + * The protocol doesn't specifically state this, but if this message + * was broadcast to us, we should assume "someone else" is handling + * it and not get involved (ie, send a Reject-Message). + * Since we can't reach other routers that src couldn't already reach, + * we don't try the standard path of asking Who-Is-Router-to-Network. + * Upper level handlers knew that this was sent as a bcast, + * but our only way to guess at that here is if the dest->adr + * is absent, then we know this is some sort of bcast. + */ + if ( dest->len > 0 ) { + Send_Reject_Message_To_Network(src, NETWORK_REJECT_NO_ROUTE, + dest->net); + } /* else, silently drop it */ return; }