Repository navigation
feat(edge): Drop public listener traffic that is not a VIP reply - #1518
Conversation
An Edge public listener may send only replies to its VIPs' clients. usid_egress admitted anything a listener attachment sent from its own address, and a packet that missed the VIP translation rows went on to the VRF's routes and the kernel, so a provider could use its listener to reach any other address. galactic-edge now marks a host link in a new edge_listener_link_table map when the attachment's EdgeService grants PublicListener, and clears the mark when the grant goes or the link is removed. usid_egress drops anything a marked link sends that matches no VIP translation row, after its link-local and Neighbor Discovery exits, and counts it as listener_unmatched_egress. The mark is its own map rather than a field in edge_link_value. Growing that value would make the loader recreate edge_link_table empty, which leaves every edge link ungated until galactic-edge writes it again. Against a datapath that predates the map, marking a link fails, so a listener attachment stays unprogrammed rather than unconfined. VIP reply translation needed no change: #1507 showed it working on edge host links for both families. Fixes: #1510
Review of the listener egress drop found four ways a listener could still reach the kernel's routing: - Neighbor Discovery messages took usid_egress's ND exit before the listener check, whatever their destination. The check now runs before that exit. A listener's own ND is link-local, since its pod's default route is via fe80::1, and leaves at the earlier link-scope exit. - A VIP reply on a node whose public uplink is not configured fell through to routing. A listener's packet now leaves only through the VIP redirect; anything that reaches routing is dropped, in both the IPv6 branch and the translated IPv4 one. - A listener link whose ifindex_vrf_table or vrf_table row was missing, such as after a map reload, was handed to the kernel. It now fails closed until galactic-edge registers it again. - An attachment whose EdgeService the agent could not find was programmed as an ordinary attachment, unconfining a listener on a deleted or not yet cached service. It is now treated as a listener. The agent's gate sweep also removes listener marks left with no link row, so an interface that later takes the ifindex never inherits one. The provider contract records the mark, and that the uSID datapath must roll out before galactic-edge. Related to: #1510
usid_egress handed all multicast to the kernel before the listener check, so a listener could send to a site- or global-scope group. A listener link's multicast beyond link scope is now dropped and counted as listener_unmatched_egress; interface- and link-local groups still pass, which the link's own Neighbor Discovery needs. The design doc links #1519 for letting ICMPv6 errors about VIP flows through, which the listener drop discards for now. Related to: #1510
|
Two independent reviews ran on this PR, with a second pass on c0780e8.
CI is green on c0780e8, including the root unit tests. No extra reviewer is configured beyond the code owners. Auto-merge is on. |
scotwells
left a comment
There was a problem hiding this comment.
An Edge public listener can no longer send traffic to arbitrary internet addresses from its public address. A listener's host link now sends only replies that match a VIP, plus link-local traffic, and every other packet is dropped and counted as listener_unmatched_egress. This implements Phase 3 of the approved listener design, with no API change.
It fails closed in the cases that matter: a link whose service the agent can't find is treated as a listener, and a listener link whose datapath rows are missing drops instead of routing. The lab run shows 8 of 8 VIP flows answered and 10 of 10 outbound datagrams dropped and counted. All 26 checks pass.
The uSID datapath has to roll out before galactic-edge, or listener links fail with DatapathFailed. Make sure the release that ships this keeps that order.
Summary
An Edge public listener could send traffic to any internet address from its own address, because the node only rewrote replies that matched a public address and routed the rest. The node now drops everything a listener sends except those replies and traffic on its own link, and counts each drop under a new drop reason. Other edge attachments are unaffected. Roll out the datapath before the edge agent, because an older datapath leaves a listener unprogrammed rather than unconfined.
Fixes #1510
Related to #1519
Test plan