MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bstp_set_protocol

Function bstp_set_protocol

freebsd/net/bridgestp.c:1540–1570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1538}
1539
1540int
1541bstp_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
1572int
1573bstp_set_priority(struct bstp_state *bs, int pri)

Callers 1

bridge_ioctl_sprotoFunction · 0.85

Calls 5

bstp_set_port_protoFunction · 0.85
bstp_set_port_roleFunction · 0.85
bstp_set_port_tcFunction · 0.85
bstp_timer_stopFunction · 0.85
bstp_reinitFunction · 0.85

Tested by

no test coverage detected