1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

apply patch

This commit is contained in:
Joel Bender 2018-02-12 15:28:03 -05:00
parent 5a796fcc27
commit cac423338c
3 changed files with 37 additions and 36 deletions

View File

@ -446,11 +446,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
def indication(self, pdu):
if _debug: BIPForeign._debug("indication %r", pdu)
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
return
# check for local stations
if pdu.pduDestination.addrType == Address.localStationAddr:
# make an original unicast PDU
@ -462,6 +457,11 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
# check for broadcasts
elif pdu.pduDestination.addrType == Address.localBroadcastAddr:
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
return
# make an original broadcast PDU
xpdu = DistributeBroadcastToNetwork(pdu, user_data=pdu.pduUserData)
xpdu.pduDestination = self.bbmdAddress
@ -498,6 +498,13 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
return
elif isinstance(pdu, OriginalUnicastNPDU):
# build a vanilla PDU
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
# send it upstream
self.response(xpdu)
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
@ -511,13 +518,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
# send this to the service access point
self.sap_response(pdu)
elif isinstance(pdu, OriginalUnicastNPDU):
# build a vanilla PDU
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
# send it upstream
self.response(xpdu)
elif isinstance(pdu, ForwardedNPDU):
# build a PDU with the source from the real source
xpdu = PDU(pdu.pduData, source=pdu.bvlciAddress, destination=LocalBroadcast(), user_data=pdu.pduUserData)

View File

@ -442,11 +442,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
def indication(self, pdu):
if _debug: BIPForeign._debug("indication %r", pdu)
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
return
# check for local stations
if pdu.pduDestination.addrType == Address.localStationAddr:
# make an original unicast PDU
@ -458,6 +453,11 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
# check for broadcasts
elif pdu.pduDestination.addrType == Address.localBroadcastAddr:
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
return
# make an original broadcast PDU
xpdu = DistributeBroadcastToNetwork(pdu, user_data=pdu.pduUserData)
xpdu.pduDestination = self.bbmdAddress
@ -494,6 +494,14 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
return
elif isinstance(pdu, OriginalUnicastNPDU):
# build a vanilla PDU
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
# send it upstream
self.response(xpdu)
return
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
@ -507,13 +515,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
# send this to the service access point
self.sap_response(pdu)
elif isinstance(pdu, OriginalUnicastNPDU):
# build a vanilla PDU
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
# send it upstream
self.response(xpdu)
elif isinstance(pdu, ForwardedNPDU):
# build a PDU with the source from the real source
xpdu = PDU(pdu.pduData, source=pdu.bvlciAddress, destination=LocalBroadcast(), user_data=pdu.pduUserData)

View File

@ -441,11 +441,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
def indication(self, pdu):
if _debug: BIPForeign._debug("indication %r", pdu)
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
return
# check for local stations
if pdu.pduDestination.addrType == Address.localStationAddr:
# make an original unicast PDU
@ -457,6 +452,11 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
# check for broadcasts
elif pdu.pduDestination.addrType == Address.localBroadcastAddr:
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
return
# make an original broadcast PDU
xpdu = DistributeBroadcastToNetwork(pdu, user_data=pdu.pduUserData)
xpdu.pduDestination = self.bbmdAddress
@ -493,6 +493,13 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
return
elif isinstance(pdu, OriginalUnicastNPDU):
# build a vanilla PDU
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
# send it upstream
self.response(xpdu)
# check the BBMD registration status, we may not be registered
if self.registrationStatus != 0:
if _debug: BIPForeign._debug(" - packet dropped, unregistered")
@ -506,13 +513,6 @@ class BIPForeign(BIPSAP, Client, Server, OneShotTask, DebugContents):
# send this to the service access point
self.sap_response(pdu)
elif isinstance(pdu, OriginalUnicastNPDU):
# build a vanilla PDU
xpdu = PDU(pdu.pduData, source=pdu.pduSource, destination=pdu.pduDestination, user_data=pdu.pduUserData)
# send it upstream
self.response(xpdu)
elif isinstance(pdu, ForwardedNPDU):
# build a PDU with the source from the real source
xpdu = PDU(pdu.pduData, source=pdu.bvlciAddress, destination=LocalBroadcast(), user_data=pdu.pduUserData)