mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 10:52:04 +00:00
fix(vpc): clear subnet drop gate when installing egress reroute
A subnet with an attached IGW but no 0.0.0.0/0 route carries a priority-1100 drop gate on the VPC router. When a route later lands (NATGW reroute at 900, IGW reroute at 1000) the reroute is installed but the drop gate was never removed, so the higher-priority gate wins and black-holes the subnet's egress in lr_in_policy before it reaches routing or SNAT. This left NAT-gateway private-subnet egress with 100% packet loss: the SNAT stage saw zero packets and no conntrack was committed. Remove the subnet's drop gate for the same prefix once a reroute is installed. Idempotent and prefix-scoped, so a specific-prefix reroute is a no-op and leaves the default gate intact.
This commit is contained in:
Vendored
+14
-2
@@ -445,14 +445,26 @@ func (m *igwManager) ensureSubnetEgressAtPriority(ctx context.Context, vpcID, su
|
|||||||
if nexthop == "" {
|
if nexthop == "" {
|
||||||
return fmt.Errorf("%s: no gateway nexthop available for %s (IGW not attached?)", opName, vpcID)
|
return fmt.Errorf("%s: no gateway nexthop available for %s (IGW not attached?)", opName, vpcID)
|
||||||
}
|
}
|
||||||
return m.routes.AddSubnetEgress(ctx, vpcID, policy.SubnetEgressSpec{
|
if err := m.routes.AddSubnetEgress(ctx, vpcID, policy.SubnetEgressSpec{
|
||||||
SubnetID: subnetID,
|
SubnetID: subnetID,
|
||||||
Prefix: prefix,
|
Prefix: prefix,
|
||||||
Nexthop: nexthop,
|
Nexthop: nexthop,
|
||||||
OutputPort: topology.GatewayRouterPort(vpcID),
|
OutputPort: topology.GatewayRouterPort(vpcID),
|
||||||
Priority: priority,
|
Priority: priority,
|
||||||
ExcludeCIDRs: m.rerouteExcludeCIDRs(ctx, vpcID),
|
ExcludeCIDRs: m.rerouteExcludeCIDRs(ctx, vpcID),
|
||||||
})
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// The priority-1100 drop gate is installed while a subnet is routeless and
|
||||||
|
// outranks both reroutes (IGW 1000, NATGW 900), so a gate left in place once
|
||||||
|
// a route lands black-holes the subnet's egress before it reaches routing or
|
||||||
|
// SNAT. Clear it now that this prefix has a reroute. Idempotent and
|
||||||
|
// prefix-scoped: gates only exist for the default route, so a specific-prefix
|
||||||
|
// reroute is a no-op and leaves the default gate intact.
|
||||||
|
if err := m.RemoveSubnetEgressDrop(ctx, vpcID, subnetID, prefix); err != nil {
|
||||||
|
return fmt.Errorf("%s: clear drop gate for %s: %w", opName, subnetID, err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnsureSystemInstanceEgress installs a /32 reroute above the drop gate plus a plain
|
// EnsureSystemInstanceEgress installs a /32 reroute above the drop gate plus a plain
|
||||||
|
|||||||
Reference in New Issue
Block a user