diff --git a/pocket/pocket.lua b/pocket/pocket.lua index 007f01d..6f876ea 100644 --- a/pocket/pocket.lua +++ b/pocket/pocket.lua @@ -314,7 +314,7 @@ function pocket.comms(version, modem, pkt_channel, svr_channel, crd_channel, ran elseif not self.api.linked then log.debug("discarding coordinator non-link SCADA_MGMT packet before linked") else - log.debug("discarding SCADA_MGMT from different coordinator (src_addr " .. src_addr .. " ≠ " .. self.api.addr .. ")") + log.debug("discarding non-link SCADA_MGMT packet from different coordinator (src_addr " .. src_addr .. " ≠ " .. self.api.addr .. ")") end else log.debug("illegal packet type " .. protocol .. " from coordinator", true) @@ -405,7 +405,7 @@ function pocket.comms(version, modem, pkt_channel, svr_channel, crd_channel, ran elseif not self.sv.linked then log.debug("discarding supervisor non-link SCADA_MGMT packet before linked") else - log.debug("discarding SCADA_MGMT from different supervisor (src_addr " .. src_addr .. " ≠ " .. self.sv.addr .. ")") + log.debug("discarding non-link SCADA_MGMT from different supervisor (src_addr " .. src_addr .. " ≠ " .. self.sv.addr .. ")") end else log.debug("illegal packet type " .. protocol .. " from supervisor", true) diff --git a/pocket/startup.lua b/pocket/startup.lua index c1dc37b..14317fd 100644 --- a/pocket/startup.lua +++ b/pocket/startup.lua @@ -17,7 +17,7 @@ local coreio = require("pocket.coreio") local pocket = require("pocket.pocket") local renderer = require("pocket.renderer") -local POCKET_VERSION = "alpha-v0.4.2" +local POCKET_VERSION = "alpha-v0.4.3" local println = util.println local println_ts = util.println_ts diff --git a/reactor-plc/plc.lua b/reactor-plc/plc.lua index efe6aaa..4cd34ad 100644 --- a/reactor-plc/plc.lua +++ b/reactor-plc/plc.lua @@ -938,7 +938,7 @@ function plc.comms(id, version, modem, plc_channel, svr_channel, range, reactor, elseif not self.linked then log.debug("discarding RPLC packet before linked") else - log.debug("discarding RPLC from different supervisor (src_addr " .. src_addr .. " ≠ " .. self.sv_addr .. "sv_addr)") + log.debug("discarding RPLC packet from different supervisor (src_addr " .. src_addr .. " ≠ " .. self.sv_addr .. ")") end elseif protocol == PROTOCOL.SCADA_MGMT then ---@cast packet mgmt_frame @@ -1057,8 +1057,10 @@ function plc.comms(id, version, modem, plc_channel, svr_channel, range, reactor, else log.debug("SCADA_MGMT establish packet length mismatch") end - else + elseif not self.linked then log.debug("discarding non-link SCADA_MGMT packet before linked") + else + log.debug("discarding non-link SCADA_MGMT packet from different supervisor (src_addr " .. src_addr .. " ≠ " .. self.sv_addr .. ")") end else -- should be unreachable assuming packet is from parse_packet() diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 5d0234f..e04238d 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc") local renderer = require("reactor-plc.renderer") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "v1.4.3" +local R_PLC_VERSION = "v1.4.4" local println = util.println local println_ts = util.println_ts diff --git a/rtu/rtu.lua b/rtu/rtu.lua index a1cc9dc..c97d918 100644 --- a/rtu/rtu.lua +++ b/rtu/rtu.lua @@ -354,7 +354,7 @@ function rtu.comms(version, modem, rtu_channel, svr_channel, range, conn_watchdo -- handle packet if protocol == PROTOCOL.MODBUS_TCP then ---@cast packet modbus_frame - if rtu_state.linked then + if rtu_state.linked and (src_addr == self.sv_addr) then local return_code ---@type boolean local reply ---@type modbus_packet @@ -394,8 +394,10 @@ function rtu.comms(version, modem, rtu_channel, svr_channel, range, conn_watchdo end public.send_modbus(reply) - else + elseif not rtu_state.linked then log.debug("discarding MODBUS packet before linked") + else + log.debug("discarding MODBUS packet from different supervisor (src_addr " .. src_addr .. " ≠ " .. self.sv_addr .. ")") end elseif protocol == PROTOCOL.SCADA_MGMT then ---@cast packet mgmt_frame @@ -434,7 +436,7 @@ function rtu.comms(version, modem, rtu_channel, svr_channel, range, conn_watchdo else log.debug("SCADA_MGMT establish packet length mismatch") end - elseif rtu_state.linked then + elseif rtu_state.linked and (src_addr == self.sv_addr) then if packet.type == SCADA_MGMT_TYPE.KEEP_ALIVE then -- keep alive request received, echo back if packet.length == 1 and type(packet.data[1]) == "number" then @@ -464,8 +466,10 @@ function rtu.comms(version, modem, rtu_channel, svr_channel, range, conn_watchdo -- not supported log.debug("received unsupported SCADA_MGMT message type " .. packet.type) end - else + elseif not rtu_state.linked then log.debug("discarding non-link SCADA_MGMT packet before linked") + else + log.debug("discarding non-link SCADA_MGMT packet from different supervisor (src_addr " .. src_addr .. " ≠ " .. self.sv_addr .. ")") end else -- should be unreachable assuming packet is from parse_packet() diff --git a/rtu/startup.lua b/rtu/startup.lua index 58970f7..0bd3c35 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -28,7 +28,7 @@ local sna_rtu = require("rtu.dev.sna_rtu") local sps_rtu = require("rtu.dev.sps_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "v1.3.3" +local RTU_VERSION = "v1.3.4" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE