From 4e9cb9d925b5dbc924bda6e1b793bb3be424a790 Mon Sep 17 00:00:00 2001 From: Adam Wujek <adam.wujek@cern.ch> Date: Tue, 28 Aug 2018 13:39:53 +0200 Subject: [PATCH] [BUG: 1680] userspace/wrsw_rtud: add static entries to broadcast STP BPDUs There is no support of STP yet. Signed-off-by: Adam Wujek <adam.wujek@cern.ch> --- userspace/wrsw_rtud/rtud.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/userspace/wrsw_rtud/rtud.c b/userspace/wrsw_rtud/rtud.c index b2ffd79c8..f96d85414 100644 --- a/userspace/wrsw_rtud/rtud.c +++ b/userspace/wrsw_rtud/rtud.c @@ -91,10 +91,12 @@ int read_ports(void){ static int rtu_create_static_entries(void) { uint8_t bcast_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + uint8_t stp_bpdu_mac[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; uint8_t slow_proto_mac[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x01 }; uint8_t ptp_mcast_mac[] = { 0x01, 0x1b, 0x19, 0x00, 0x00, 0x00 }; uint8_t udp_ptp_mac[] = { 0x01, 0x00, 0x5e, 0x00, 0x01, 0x81 }; uint8_t udp_ptp_p2p_mac[] = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x6b }; + int i, err; uint32_t enabled_port_mask = 0; @@ -103,9 +105,25 @@ static int rtu_create_static_entries(void) pr_info("Number of physical ports: %d\n", hal_nports_local); + for (i = 0; i < hal_nports_local; i++) { + enabled_port_mask |= (1 << hal_ports_local_copy[i].hw_index); + + port_was_up[i] = state_up(hal_ports_local_copy[i].state); + } + // VLAN-aware Bridge reserved addresses (802.1Q-2005 Table 8.1) pr_info("Adding static routes for slow protocols...\n"); - for (i = 0; i < NUM_RESERVED_ADDR; i++) { + /* Silently add (R)STP BPDUs broadcasting while no support of STP + in software. */ + err = + rtu_fd_create_entry(stp_bpdu_mac, 0, + enabled_port_mask | (1 << hal_nports_local), + RTU_ENTRY_TYPE_STATIC, OVERRIDE_EXISTING); + if (err) + return err; + + /* Add other slow protocols */ + for (i = 1; i < NUM_RESERVED_ADDR; i++) { slow_proto_mac[5] = i; err = rtu_fd_create_entry(slow_proto_mac, 0, @@ -116,12 +134,6 @@ static int rtu_create_static_entries(void) return err; } - for (i = 0; i < hal_nports_local; i++) { - enabled_port_mask |= (1 << hal_ports_local_copy[i].hw_index); - - port_was_up[i] = state_up(hal_ports_local_copy[i].state); - } - /* PTP over UDP */ pr_info("Adding entry for PTP over UDP\n"); err = -- GitLab