#607 deny reactor PLC with index out of range
This commit is contained in:
parent
016cd988e1
commit
7c22c172d5
@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v1.6.3"
|
||||
local SUPERVISOR_VERSION = "v1.6.4"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
||||
@ -260,6 +260,17 @@ function supervisor.comms(_version, nic, fp_ok, facility)
|
||||
-- PLC linking request
|
||||
if packet.length == 4 and type(packet.data[4]) == "number" then
|
||||
local reactor_id = packet.data[4]
|
||||
|
||||
-- check ID validity
|
||||
if reactor_id < 1 or reactor_id > config.UnitCount then
|
||||
-- reactor index out of range
|
||||
if last_ack ~= ESTABLISH_ACK.DENY then
|
||||
log.warning(util.c("PLC_ESTABLISH: assignment ", reactor_id, " outside of configured unit count ", config.UnitCount))
|
||||
end
|
||||
|
||||
_send_establish(packet.scada_frame, ESTABLISH_ACK.DENY)
|
||||
else
|
||||
-- try to establish the session
|
||||
local plc_id = svsessions.establish_plc_session(src_addr, i_seq_num, reactor_id, firmware_v)
|
||||
|
||||
if plc_id == false then
|
||||
@ -275,6 +286,7 @@ function supervisor.comms(_version, nic, fp_ok, facility)
|
||||
log.info(util.c("PLC_ESTABLISH: PLC (", firmware_v, ") [@", src_addr, "] reactor unit ", reactor_id, " PLC connected with session ID ", plc_id))
|
||||
_send_establish(packet.scada_frame, ESTABLISH_ACK.ALLOW)
|
||||
end
|
||||
end
|
||||
else
|
||||
log.debug("PLC_ESTABLISH: packet length mismatch/bad parameter type")
|
||||
_send_establish(packet.scada_frame, ESTABLISH_ACK.DENY)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user