A command with words it cannot use refuses them (#1403) #1404
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1404
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/show-argument-refusal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A command with words it cannot use refuses them. Fixes #1403.
Found by pointing every
showcommand that takes a filter at arguments nobody implemented and asking whether theanswer changed. Twelve of fourteen did not. The worst was not an empty answer:
The table held one route,
10.0.0.0/24. The question was whether192.0.2.0/24was installed. The answer printed adifferent prefix. An operator checking whether a prefix is installed is checking exactly the thing a silent drop
fabricates — the table came back looking like a yes.
What changed
Eleven commands now refuse a tail they cannot use, quoting the words typed and naming the command:
show ip route <prefix>show arp <address>show ip interface brief <port>show running-config [interface <port>]show vlan <id>(and anything afterbrief)show spanning-tree <port>show lldp neighbors <port>,show lldp <x>show access-lists <n>show etherchannel <x>show vrrp <group>show version <x>Where a narrower question has an answer, the refusal names the command that gives it:
Also fixed: an unknown port in the OSPF reports was described as a port that "is not carrying OSPF" — a claim
about a socket the box does not have.
show ip ospf neighbor NOSUCHandshow ip ospf interface NOSUCHnow say% No interface NOSUCH on <device>, the sentence the rest of the console uses.Two kinds of answer are deliberately not refusals, and the suite asserts the difference: a device-level fact that
holds whatever was typed (
% No access lists configured; a box that cannot supply power says so about the device),and
% No interface X on <device>, which is the answer to the words rather than a refusal of them.Evidence
test/show-argument-refusal.test.js— 77 checks. The lab has content in every table (a routed prefix, an ARPneighbour, a MAC entry, an OSPF process), so a drop is visible; each of the twelve refusals quotes the words typed,
names the command, and is one line rather than a table with a sentence on top; every documented form still answers;
the two commands that really do filter (
show interfaces <port>,show mac address-table interface <port>, #1401)still filter and still refuse unknown ports by name; the OSPF sentence on all three shapes (unknown port, real port,
whole process); and a sweep over the documented
showsurface asserting nothing silently drops a tail.Reverting
engine/cli.jsfails 50 of the 77.docs/CLI.md: a new section, "A command with words it cannot use refuses them", with the fabricated-yes example.Suite: 204 suites, 7,854 assertions, 0 failed. Syntax: 272 files, OK.
Found by pointing every `show` command that takes a filter at arguments nobody implemented and asking whether the answer changed. Twelve of fourteen did not. The worst was not an empty answer: r1#show ip route 192.0.2.0/24 Codes: C - connected, S - static, O - OSPF, B - BGP C 10.0.0.0 /24 is directly connected, Gi0 The table held one route, 10.0.0.0/24; the question was whether 192.0.2.0/24 was installed; the answer printed a different prefix. An operator checking whether a prefix is installed is checking exactly the thing a silent drop fabricates - the table came back looking like a yes. Fixed: eleven commands now refuse a tail they cannot use, quoting the words and naming the command: * `show ip route <prefix>`, `show arp <address>`, `show ip interface brief <port>`, `show running-config interface <port>` / any tail, `show vlan <id>` (and anything after `brief`), `show spanning-tree <port>`, `show lldp neighbors <port>` / `show lldp <x>`, `show access-lists <n>`, `show etherchannel <x>`, `show vrrp <group>`, `show version <x>`. Where a narrower question has an answer, the refusal names the command that gives it: `% show ip interface brief does not take "Gi1/0/1": every interface is listed - use `show interfaces Gi1/0/1` for one port`. Also: an unknown port in the OSPF reports was described as a port that "is not carrying OSPF" - a claim about a socket the box does not have. `show ip ospf neighbor NOSUCH` and `show ip ospf interface NOSUCH` now say `% No interface NOSUCH on <device>`, the sentence the rest of the console uses. Two kinds of answer are deliberately not refusals, and the suite asserts the difference: a device-level fact that holds whatever was typed (`% No access lists configured`; a box that cannot supply power says so about the device), and `% No interface X on <device>`, which is the answer to the words rather than a refusal of them. Evidence: test/show-argument-refusal.test.js, 77 checks - the lab has content in every table so a drop is visible; each of the twelve refusals quotes the words typed, names the command and is one line rather than a table with a sentence on top; every documented form still answers; the two real filters (`show interfaces <port>`, `show mac address-table interface <port>`) still filter and still refuse unknown ports by name; the OSPF sentence; and a sweep over the documented `show` surface asserting nothing silently drops a tail. Reverting engine/cli.js fails 50 of the 77. docs/CLI.md: a new section, "A command with words it cannot use refuses them", with the fabricated-yes example. Suite: 204 suites, 7,854 assertions, 0 failed. Syntax: 272 files, OK.