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

Function bstp_update_roles

freebsd/net/bridgestp.c:923–1073  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

921}
922
923static void
924bstp_update_roles(struct bstp_state *bs, struct bstp_port *bp)
925{
926 switch (bp->bp_role) {
927 case BSTP_ROLE_DISABLED:
928 /* Clear any flags if set */
929 if (bp->bp_sync || !bp->bp_synced || bp->bp_reroot) {
930 bp->bp_sync = 0;
931 bp->bp_synced = 1;
932 bp->bp_reroot = 0;
933 }
934 break;
935
936 case BSTP_ROLE_ALTERNATE:
937 case BSTP_ROLE_BACKUP:
938 if ((bs->bs_allsynced && !bp->bp_agree) ||
939 (bp->bp_proposed && bp->bp_agree)) {
940 bp->bp_proposed = 0;
941 bp->bp_agree = 1;
942 bp->bp_flags |= BSTP_PORT_NEWINFO;
943 DPRINTF("%s -> ALTERNATE_AGREED\n",
944 bp->bp_ifp->if_xname);
945 }
946
947 if (bp->bp_proposed && !bp->bp_agree) {
948 bstp_set_all_sync(bs);
949 bp->bp_proposed = 0;
950 DPRINTF("%s -> ALTERNATE_PROPOSED\n",
951 bp->bp_ifp->if_xname);
952 }
953
954 /* Clear any flags if set */
955 if (bp->bp_sync || !bp->bp_synced || bp->bp_reroot) {
956 bp->bp_sync = 0;
957 bp->bp_synced = 1;
958 bp->bp_reroot = 0;
959 DPRINTF("%s -> ALTERNATE_PORT\n", bp->bp_ifp->if_xname);
960 }
961 break;
962
963 case BSTP_ROLE_ROOT:
964 if (bp->bp_state != BSTP_IFSTATE_FORWARDING && !bp->bp_reroot) {
965 bstp_set_all_reroot(bs);
966 DPRINTF("%s -> ROOT_REROOT\n", bp->bp_ifp->if_xname);
967 }
968
969 if ((bs->bs_allsynced && !bp->bp_agree) ||
970 (bp->bp_proposed && bp->bp_agree)) {
971 bp->bp_proposed = 0;
972 bp->bp_sync = 0;
973 bp->bp_agree = 1;
974 bp->bp_flags |= BSTP_PORT_NEWINFO;
975 DPRINTF("%s -> ROOT_AGREED\n", bp->bp_ifp->if_xname);
976 }
977
978 if (bp->bp_proposed && !bp->bp_agree) {
979 bstp_set_all_sync(bs);
980 bp->bp_proposed = 0;

Callers 2

bstp_update_stateFunction · 0.85
bstp_enableFunction · 0.85

Calls 7

bstp_set_all_syncFunction · 0.85
bstp_set_all_rerootFunction · 0.85
bstp_rerootedFunction · 0.85
bstp_set_port_stateFunction · 0.85
bstp_timer_stopFunction · 0.85
bstp_timer_startFunction · 0.85
bstp_transmitFunction · 0.85

Tested by

no test coverage detected