Skip to content

Commit 9d8078b

Browse files
BUGFIX: 6316 - be more specific when checking allow_export_list_active (#6318)
This change updates the queries to lookup peers by `switch_port_settings_id` AND peer `address` when checking `allow_export_list_active` column. Related --- #6316
1 parent 4a6be3a commit 9d8078b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

nexus/db-model/src/switch_port.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,13 @@ pub struct SwitchPortBgpPeerConfigCommunity {
642642
)]
643643
#[diesel(table_name = switch_port_settings_bgp_peer_config_allow_export)]
644644
pub struct SwitchPortBgpPeerConfigAllowExport {
645+
/// Parent switch port configuration
645646
pub port_settings_id: Uuid,
647+
/// Interface peer is reachable on
646648
pub interface_name: String,
649+
/// Peer Address
647650
pub addr: IpNetwork,
651+
/// Allowed Prefix
648652
pub prefix: IpNetwork,
649653
}
650654

@@ -660,9 +664,13 @@ pub struct SwitchPortBgpPeerConfigAllowExport {
660664
)]
661665
#[diesel(table_name = switch_port_settings_bgp_peer_config_allow_import)]
662666
pub struct SwitchPortBgpPeerConfigAllowImport {
667+
/// Parent switch port configuration
663668
pub port_settings_id: Uuid,
669+
/// Interface peer is reachable on
664670
pub interface_name: String,
671+
/// Peer Address
665672
pub addr: IpNetwork,
673+
/// Allowed Prefix
666674
pub prefix: IpNetwork,
667675
}
668676

nexus/db-queries/src/db/datastore/bgp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ impl DataStore {
606606
.transaction(&conn, |conn| async move {
607607
let active = peer_dsl::switch_port_settings_bgp_peer_config
608608
.filter(db_peer::port_settings_id.eq(port_settings_id))
609+
.filter(db_peer::addr.eq(addr))
609610
.select(db_peer::allow_export_list_active)
610611
.limit(1)
611612
.first_async::<bool>(&conn)
@@ -652,6 +653,7 @@ impl DataStore {
652653
.transaction(&conn, |conn| async move {
653654
let active = peer_dsl::switch_port_settings_bgp_peer_config
654655
.filter(db_peer::port_settings_id.eq(port_settings_id))
656+
.filter(db_peer::addr.eq(addr))
655657
.select(db_peer::allow_import_list_active)
656658
.limit(1)
657659
.first_async::<bool>(&conn)

0 commit comments

Comments
 (0)