| 1538 | } |
| 1539 | |
| 1540 | int |
| 1541 | bstp_set_protocol(struct bstp_state *bs, int proto) |
| 1542 | { |
| 1543 | struct bstp_port *bp; |
| 1544 | |
| 1545 | switch (proto) { |
| 1546 | /* Supported protocol versions */ |
| 1547 | case BSTP_PROTO_STP: |
| 1548 | case BSTP_PROTO_RSTP: |
| 1549 | break; |
| 1550 | |
| 1551 | default: |
| 1552 | return (EINVAL); |
| 1553 | } |
| 1554 | |
| 1555 | BSTP_LOCK(bs); |
| 1556 | bs->bs_protover = proto; |
| 1557 | bs->bs_bridge_htime = BSTP_DEFAULT_HELLO_TIME; |
| 1558 | LIST_FOREACH(bp, &bs->bs_bplist, bp_next) { |
| 1559 | /* reinit state */ |
| 1560 | bp->bp_infois = BSTP_INFO_DISABLED; |
| 1561 | bp->bp_txcount = 0; |
| 1562 | bstp_set_port_proto(bp, bs->bs_protover); |
| 1563 | bstp_set_port_role(bp, BSTP_ROLE_DISABLED); |
| 1564 | bstp_set_port_tc(bp, BSTP_TCSTATE_INACTIVE); |
| 1565 | bstp_timer_stop(&bp->bp_recent_backup_timer); |
| 1566 | } |
| 1567 | bstp_reinit(bs); |
| 1568 | BSTP_UNLOCK(bs); |
| 1569 | return (0); |
| 1570 | } |
| 1571 | |
| 1572 | int |
| 1573 | bstp_set_priority(struct bstp_state *bs, int pri) |
no test coverage detected