oxidecomputer / maghemite

A routing stack written in Rust.
Mozilla Public License 2.0
40 stars 2 forks source link

static route assigned to wrong port #407

Closed Nieuwejaar closed 2 weeks ago

Nieuwejaar commented 2 weeks ago

While setting up the london racklette, I found a route assigned to the wrong interface. The relevant bit of the config is:

# The one routed through lab `172.20.27.0/24`
[rack_network_config.switch1.qsfp0]
routes = [ { nexthop = "172.20.15.25", destination = "0.0.0.0/0" } ]
addresses = [ {address = "172.20.15.29/29" } ]
uplink_port_speed = "40G"
uplink_port_fec = "none"
autoneg = true
tx_eq = {main = 25, pre1 = -2 }
bgp_peers = []

[rack_network_config.switch1.qsfp6]
routes = [ { nexthop = "192.168.5.1", destination = "192.168.5.1/30" } ]
addresses = [ {address = "172.20.15.30/29" } ]
uplink_port_speed = "100G"
autoneg = false

The route on the second interface is bogus, as the nexthop doesn't have a corresponding local subnet, and thus no obvious interface to which the route should be assigned.

We would expect to see the 0.0.0.0/0 route installed on qsfp0 correctly, and the second route dropped. Instead we see the first route incorrectly associated with qsfp6:

root@oxz_switch1:~# swadm route ls
Subnet                   Port    Link  Gateway                   Vlan
0.0.0.0/0                qsfp6   0     172.20.15.25
Nieuwejaar commented 2 weeks ago

This is fundamentally user error, as the provided config isn't actually valid. It would be helpful if the invalidity were caught earlier, but that doesn't seem like maghemite's problem to solve.