The parser accepts a port name as a next hop, and a /prefix that it then rejects #1281

Closed
opened 2026-11-09 22:03:12 +00:00 by jaylouisw · 0 comments
Owner

The census in #1279 proved state → text. This is the other direction: what the parser accepts and
then stores, which is sometimes neither what was typed nor anything at all.

r1(config)#ip route 10.9.0.0 255.255.0.0 Gi0
Route added: 10.9.0.0/16 via Gi0
                                      -> stored { gw: "Gi0", iface: null }

r1(config)#ip route 10.9.0.0 255.255.0.0 nonsense
Route added: 10.9.0.0/16 via nonsense  -> stored the same way: any word became a next hop

r1(config-if)#ip address 10.0.0.1/24
% Incomplete command                  -> no address, and no hint what the form should be

r1(config-dhcp)#network 10.5.0.0/24
                                      -> stored network "10.5.0.0/24", which the pool validator then
                                         rejects: the spelling the usage line itself advertises
                                         produced a pool that cannot serve

Why the route shape matters

routeTo() reads r.gw as an address and r.iface as an egress. A port name in gw therefore produces a
route that is listed, installed, printed by show running-config, and then ARPs for an address called Gi0.
Measured on a two-router lab with the pc's LAN reachable through r2:

route on r1 ping to the pc
ip route 192.168.9.0 255.255.255.0 10.0.0.2 works
ip route 192.168.9.0 255.255.255.0 Gi0 fails: no ARP reply from 192.168.9.9

The port-only form is legal and worth keeping — it is how you point at a segment — but it carries a packet only
if the far side proxies ARP for the destination, and nothing said so anywhere. That is the failure mode this
project keeps closing: a table that looks healthy over a path that cannot work.

What "done" looks like

  • ip route <dest> <mask> <port> stores the port in the egress field, gw null;
  • the console says no next hop: this resolves by ARP on that segment, which needs proxy ARP on the far side
    when the line is typed, and show ip route carries (no next hop: ARP for the destination on that segment)
    on the row;
  • anything that is neither a next-hop address nor an interface is refused, naming the token and the route;
    a port followed by anything else is refused; a next hop followed by an unknown port is refused;
  • all three shapes still round-trip byte-identically through show running-config — including the port-only
    form, which used to print an empty field and two spaces;
  • ip address <addr>/<len> is refused with both accepted forms spelled out, and the previous address is left
    untouched;
  • network <net>/<len> and network <net> <mask> produce identical state and identical printed config;
    an impossible prefix (/33) is refused quoting the value and stores no half-network.
The census in #1279 proved *state → text*. This is the other direction: what the parser **accepts** and then stores, which is sometimes neither what was typed nor anything at all. ``` r1(config)#ip route 10.9.0.0 255.255.0.0 Gi0 Route added: 10.9.0.0/16 via Gi0 -> stored { gw: "Gi0", iface: null } r1(config)#ip route 10.9.0.0 255.255.0.0 nonsense Route added: 10.9.0.0/16 via nonsense -> stored the same way: any word became a next hop r1(config-if)#ip address 10.0.0.1/24 % Incomplete command -> no address, and no hint what the form should be r1(config-dhcp)#network 10.5.0.0/24 -> stored network "10.5.0.0/24", which the pool validator then rejects: the spelling the usage line itself advertises produced a pool that cannot serve ``` ## Why the route shape matters `routeTo()` reads `r.gw` as an address and `r.iface` as an egress. A port name in `gw` therefore produces a route that is listed, installed, printed by `show running-config`, and then ARPs for an address called `Gi0`. Measured on a two-router lab with the pc's LAN reachable through r2: | route on r1 | ping to the pc | |---|---| | `ip route 192.168.9.0 255.255.255.0 10.0.0.2` | works | | `ip route 192.168.9.0 255.255.255.0 Gi0` | fails: `no ARP reply from 192.168.9.9` | The port-only form is legal and worth keeping — it is how you point at a segment — but it carries a packet only if the far side proxies ARP for the destination, and *nothing said so anywhere*. That is the failure mode this project keeps closing: a table that looks healthy over a path that cannot work. ## What "done" looks like * `ip route <dest> <mask> <port>` stores the port in the egress field, `gw` null; * the console says `no next hop: this resolves by ARP on that segment, which needs proxy ARP on the far side` when the line is typed, and `show ip route` carries `(no next hop: ARP for the destination on that segment)` on the row; * anything that is neither a next-hop address nor an interface is refused, naming the token and the route; a port followed by anything else is refused; a next hop followed by an unknown port is refused; * all three shapes still round-trip byte-identically through `show running-config` — including the port-only form, which used to print an empty field and two spaces; * `ip address <addr>/<len>` is refused with both accepted forms spelled out, and the previous address is left untouched; * `network <net>/<len>` and `network <net> <mask>` produce **identical state** and identical printed config; an impossible prefix (`/33`) is refused quoting the value and stores no half-network.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge#1281
No description provided.