@@ -951,19 +951,42 @@ impl DataStore {
951951 }
952952 } ) ?;
953953
954+ // Only link default gateway for unicast pools (not multicast pools).
955+ // Internet gateways are used for unicast traffic routing, not multicast.
954956 if ip_pool_resource. is_default {
955- self . link_default_gateway (
956- opctx,
957- ip_pool_resource. resource_id ,
958- ip_pool_resource. ip_pool_id ,
959- & conn,
960- )
961- . await ?;
957+ use nexus_db_schema:: schema:: ip_pool:: dsl;
958+
959+ let pool_type: IpPoolType = dsl:: ip_pool
960+ . filter ( dsl:: id. eq ( ip_pool_resource. ip_pool_id ) )
961+ . filter ( dsl:: time_deleted. is_null ( ) )
962+ . select ( dsl:: pool_type)
963+ . first_async ( & * conn)
964+ . await
965+ . map_err ( |e| {
966+ public_error_from_diesel ( e, ErrorHandler :: Server )
967+ } ) ?;
968+
969+ if pool_type == IpPoolType :: Unicast {
970+ self . link_default_gateway (
971+ opctx,
972+ ip_pool_resource. resource_id ,
973+ ip_pool_resource. ip_pool_id ,
974+ & conn,
975+ )
976+ . await ?;
977+ }
962978 }
963979
964980 Ok ( result)
965981 }
966982
983+ // Links the default internet gateway for all VPCs in a silo to the given
984+ // IP pool.
985+ //
986+ // This is only applicable to unicast pools, where as multicast
987+ // traffic uses DPD/switch-level forwarding rather than internet gateway
988+ // routing.
989+ //
967990 // TODO-correctness: This seems like it should be in a transaction. At
968991 // least, the nested-loops can mostly be re-expressed as a join between the
969992 // silos, projects, vpcs, and Internet gateway tables.
0 commit comments