Evaluate Extended ACL Entries With Wildcard Masks
Last updated: November 29, 2026
Quick Overview
Given an ordered extended access list (action, protocol, source and destination with wildcard masks or host or any, optional destination port operator) and a packet, return the action of the first matching entry and its line number, applying the implicit deny at the end.
Cisco
November 29, 20260
0
0 solved
Given an ordered extended access list (action, protocol, source and destination with wildcard masks or host or any, optional destination port operator) and a packet, return the action of the first matching entry and its line number, applying the implicit deny at the end.
ACLs filter traffic on IOS routers, Catalyst switches and Secure Firewall, and engineers working on the security data path or config analysis tools need to reason precisely about first-match semantics. The interviewer checks wildcard mask math, protocol and port handling, and the implicit deny.
What the Interviewer Expects
- Applies first-match semantics in order
- Implements wildcard masks correctly (1 bits are do-not-care)
- Supports any, host, and eq, range, gt, lt, neq port operators
- Treats protocol 'ip' as matching every protocol
- Returns implicit deny when nothing matches
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you detect shadowed entries that can never match?
- With 10,000 entries, how would you speed up evaluation beyond a linear scan?
- How does hardware evaluate ACLs in one TCAM lookup, and what does a port range cost in TCAM?
- How would you handle fragments, where only the first fragment carries the port?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Each ACE: action (permit or deny), proto (ip, tcp, udp, icmp), src and dst as any, host A.B.C.D, or base wildcard, and optional dport like eq 23 or range 8000 8080. Packet: protoco...
High-Level Design
A wildcard mask is the inverse of a subnet mask: a 1 bit means ignore. So the bits we care about are ~wildcard, and an address matches when (ip & care) == (base & care). Wildcards need not be cont...