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

Function imf_rollback

freebsd/netinet/in_mcast.c:844–867  ·  view source on GitHub ↗

* Revert socket-layer filter set deltas at t1 to t0 state. */

Source from the content-addressed store, hash-verified

842 * Revert socket-layer filter set deltas at t1 to t0 state.
843 */
844static void
845imf_rollback(struct in_mfilter *imf)
846{
847 struct ip_msource *ims, *tims;
848 struct in_msource *lims;
849
850 RB_FOREACH_SAFE(ims, ip_msource_tree, &imf->imf_sources, tims) {
851 lims = (struct in_msource *)ims;
852 if (lims->imsl_st[0] == lims->imsl_st[1]) {
853 /* no change at t1 */
854 continue;
855 } else if (lims->imsl_st[0] != MCAST_UNDEFINED) {
856 /* revert change to existing source at t1 */
857 lims->imsl_st[1] = lims->imsl_st[0];
858 } else {
859 /* revert source added t1 */
860 CTR2(KTR_IGMPV3, "%s: free ims %p", __func__, ims);
861 RB_REMOVE(ip_msource_tree, &imf->imf_sources, ims);
862 free(ims, M_INMFILTER);
863 imf->imf_nsrc--;
864 }
865 }
866 imf->imf_st[1] = imf->imf_st[0];
867}
868
869/*
870 * Mark socket-layer filter set as INCLUDE {} at t1.

Callers 4

inp_block_unblock_sourceFunction · 0.85
inp_join_groupFunction · 0.85
inp_leave_groupFunction · 0.85
inp_set_source_filtersFunction · 0.85

Calls 1

freeFunction · 0.50

Tested by

no test coverage detected