- RSTP_ID_ARGS(v2->designated_bridge_id), v2->designated_port_id);
-
- if ((v1->root_bridge_id < v2->root_bridge_id) ||
- ((v1->root_bridge_id == v2->root_bridge_id) &&
- (v1->root_path_cost < v2->root_path_cost)) ||
- ((v1->root_bridge_id == v2->root_bridge_id) &&
- (v1->root_path_cost == v2->root_path_cost) &&
- (v1->designated_bridge_id < v2->designated_bridge_id)) ||
- ((v1->root_bridge_id == v2->root_bridge_id) &&
- (v1->root_path_cost == v2->root_path_cost) &&
- (v1->designated_bridge_id == v2->designated_bridge_id) &&
- (v1->designated_port_id < v2->designated_port_id))) {
- VLOG_DBG("superior_absolute");
- return SUPERIOR;
- }
- else if (((v1->root_bridge_id > v2->root_bridge_id) ||
- ((v1->root_bridge_id == v2->root_bridge_id) &&
- (v1->root_path_cost > v2->root_path_cost)) ||
- ((v1->root_bridge_id == v2->root_bridge_id) &&
- (v1->root_path_cost == v2->root_path_cost) &&
- (v1->designated_bridge_id > v2->designated_bridge_id)) ||
- ((v1->root_bridge_id == v2->root_bridge_id) &&
- (v1->root_path_cost == v2->root_path_cost) &&
- (v1->designated_bridge_id == v2->designated_bridge_id) &&
- (v1->designated_port_id > v2->designated_port_id))) &&
- (v1->designated_bridge_id == v2->designated_bridge_id) &&
- (v1->designated_port_id == v2->designated_port_id)) {
- VLOG_DBG("superior_same_des");
+ RSTP_ID_ARGS(v2->designated_bridge_id), v2->designated_port_id,
+ v2->bridge_port_id);
+
+ /* [17.6]
+ * This message priority vector is superior to the port priority vector and
+ * will replace it if, and only if, the message priority vector is better
+ * than the port priority vector, or the message has been transmitted from
+ * the same Designated Bridge and Designated Port as the port priority
+ * vector, i.e., if the following is true:
+ *
+ * ((RD < RootBridgeID)) ||
+ * ((RD == RootBridgeID) && (RPCD < RootPathCost)) ||
+ * ((RD == RootBridgeID) && (RPCD == RootPathCost) &&
+ * (D < designated_bridge_id)) ||
+ * ((RD == RootBridgeID) && (RPCD == RootPathCost) &&
+ * (D == designated_bridge_id) && (PD < designated_port_id)) ||
+ * ((D == designated_bridge_id.BridgeAddress) &&
+ * (PD == designated_port_id.PortNumber))
+ */
+ if ((v1->root_bridge_id < v2->root_bridge_id)
+ || (v1->root_bridge_id == v2->root_bridge_id
+ && v1->root_path_cost < v2->root_path_cost)
+ || (v1->root_bridge_id == v2->root_bridge_id
+ && v1->root_path_cost == v2->root_path_cost
+ && v1->designated_bridge_id < v2->designated_bridge_id)
+ || (v1->root_bridge_id == v2->root_bridge_id
+ && v1->root_path_cost == v2->root_path_cost
+ && v1->designated_bridge_id == v2->designated_bridge_id
+ && v1->designated_port_id < v2->designated_port_id)
+ || (v1->designated_bridge_id == v2->designated_bridge_id
+ && v1->designated_port_id == v2->designated_port_id)) {
+ /* SAME is a subset of SUPERIOR. */
+ if (v1->root_bridge_id == v2->root_bridge_id
+ && v1->root_path_cost == v2->root_path_cost
+ && v1->designated_bridge_id == v2->designated_bridge_id
+ && v1->designated_port_id == v2->designated_port_id) {
+ if (v1->bridge_port_id < v2->bridge_port_id) {
+ VLOG_DBG("superior");
+ return SUPERIOR;
+ }
+ else if (v1->bridge_port_id > v2->bridge_port_id) {
+ VLOG_DBG("inferior");
+ return INFERIOR;
+ }
+ VLOG_DBG("superior_same");
+ return SAME;
+ }
+ VLOG_DBG("superior");