| 580 | } |
| 581 | |
| 582 | static void |
| 583 | bstp_received_bpdu(struct bstp_state *bs, struct bstp_port *bp, |
| 584 | struct bstp_config_unit *cu) |
| 585 | { |
| 586 | int type; |
| 587 | |
| 588 | BSTP_LOCK_ASSERT(bs); |
| 589 | |
| 590 | /* We need to have transitioned to INFO_MINE before proceeding */ |
| 591 | switch (bp->bp_infois) { |
| 592 | case BSTP_INFO_DISABLED: |
| 593 | case BSTP_INFO_AGED: |
| 594 | return; |
| 595 | } |
| 596 | |
| 597 | type = bstp_pdu_rcvtype(bp, cu); |
| 598 | |
| 599 | switch (type) { |
| 600 | case BSTP_PDU_SUPERIOR: |
| 601 | bs->bs_allsynced = 0; |
| 602 | bp->bp_agreed = 0; |
| 603 | bp->bp_proposing = 0; |
| 604 | |
| 605 | if (cu->cu_proposal && cu->cu_forwarding == 0) |
| 606 | bp->bp_proposed = 1; |
| 607 | if (cu->cu_topology_change) |
| 608 | bp->bp_rcvdtc = 1; |
| 609 | if (cu->cu_topology_change_ack) |
| 610 | bp->bp_rcvdtca = 1; |
| 611 | |
| 612 | if (bp->bp_agree && |
| 613 | !bstp_pdu_bettersame(bp, BSTP_INFO_RECEIVED)) |
| 614 | bp->bp_agree = 0; |
| 615 | |
| 616 | /* copy the received priority and timers to the port */ |
| 617 | bp->bp_port_pv = cu->cu_pv; |
| 618 | bp->bp_port_msg_age = cu->cu_message_age; |
| 619 | bp->bp_port_max_age = cu->cu_max_age; |
| 620 | bp->bp_port_fdelay = cu->cu_forward_delay; |
| 621 | bp->bp_port_htime = |
| 622 | (cu->cu_hello_time > BSTP_MIN_HELLO_TIME ? |
| 623 | cu->cu_hello_time : BSTP_MIN_HELLO_TIME); |
| 624 | |
| 625 | /* set expiry for the new info */ |
| 626 | bstp_set_timer_msgage(bp); |
| 627 | |
| 628 | bp->bp_infois = BSTP_INFO_RECEIVED; |
| 629 | bstp_assign_roles(bs); |
| 630 | break; |
| 631 | |
| 632 | case BSTP_PDU_REPEATED: |
| 633 | if (cu->cu_proposal && cu->cu_forwarding == 0) |
| 634 | bp->bp_proposed = 1; |
| 635 | if (cu->cu_topology_change) |
| 636 | bp->bp_rcvdtc = 1; |
| 637 | if (cu->cu_topology_change_ack) |
| 638 | bp->bp_rcvdtca = 1; |
| 639 |
no test coverage detected