Firewall and DMZ for SCADA in SCADA systems - Time & Space Complexity
When managing SCADA systems, firewalls and DMZs control network traffic to keep systems safe.
We want to understand how the time to check and filter traffic grows as more devices connect.
Analyze the time complexity of the following firewall rule checking process.
// Pseudocode for firewall packet filtering in SCADA
function checkPacket(packet, rules) {
for (let rule of rules) {
if (packet.matches(rule)) {
return rule.action
}
}
return defaultAction
}
This code checks each incoming packet against a list of firewall rules until it finds a match or finishes all rules.
Look for repeated steps that take most time.
- Primary operation: Looping through firewall rules to find a match.
- How many times: Up to once per rule for each packet.
As the number of rules grows, the checking time grows too.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 rules | Up to 10 checks per packet |
| 100 rules | Up to 100 checks per packet |
| 1000 rules | Up to 1000 checks per packet |
Pattern observation: Checking time grows linearly with the number of rules.
Time Complexity: O(n)
This means the time to check a packet grows directly with the number of firewall rules.
[X] Wrong: "The firewall checks all rules instantly regardless of how many there are."
[OK] Correct: Each rule must be checked one by one until a match is found, so more rules mean more checks.
Understanding how rule checking scales helps you design efficient SCADA security systems and shows you grasp practical system performance.
"What if the firewall used a hash table to find matching rules instead of checking each one? How would the time complexity change?"