-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Today, there is nothing stopping multiple routes w/ the same prefix but different host bits from being accepted into the RIB as separate entries.
treyaspelund@Tallon-IV 12:03:56 PM | ~/git/maghemite main
‣ ./target/debug/mgadm static add-v4-route 1.1.1.1/24 4.4.4.4
treyaspelund@Tallon-IV 12:04:02 PM | ~/git/maghemite main
‣ ./target/debug/mgadm static add-v4-route 1.1.1.0/24 4.4.4.4
treyaspelund@Tallon-IV 12:04:07 PM | ~/git/maghemite main
‣ ./target/debug/mgadm static get-v4-routes
{
"1.1.1.1/24": [
Path {
bgp: None,
nexthop: 4.4.4.4,
rib_priority: 1,
shutdown: false,
vlan_id: None,
},
],
"1.1.1.0/24": [
Path {
bgp: None,
nexthop: 4.4.4.4,
rib_priority: 1,
shutdown: false,
vlan_id: None,
},
],
}
In the above example, both 1.1.1.1/24 and 1.1.1.0/24 map to the same prefix: 1.1.1.0/24
However, there's nothing in place today to ensure these inputs reference the same prefix.
We should either zero out the host bits before prefix creation or we should enforce this requirement well before RIB insertion of the prefix (e.g. during BGP NLRI validation, in the mgd API handlers, and during sled::Db insertion/parsing).
The current behavior would undoubtedly be confusing for any users who end up in this state, as it's left up to the implementation details of mg-lower, dendrite, and tofino as to if/how these conflicts would be handled.