Lines Matching refs:imo
265 im6o_grow(struct ip6_moptions *imo) in im6o_grow() argument
276 IM6O_LOCK_ASSERT_HELD(imo); in im6o_grow()
281 omships = imo->im6o_membership; in im6o_grow()
282 omfilters = imo->im6o_mfilters; in im6o_grow()
283 oldmax = imo->im6o_max_memberships; in im6o_grow()
321 imo->im6o_membership = nmships; in im6o_grow()
322 imo->im6o_max_memberships = newmax; in im6o_grow()
325 imo->im6o_mfilters = nmfilters; in im6o_grow()
326 imo->im6o_max_filters = newmax; in im6o_grow()
348 im6o_match_group(const struct ip6_moptions *imo, const struct ifnet *ifp, in im6o_match_group() argument
356 IM6O_LOCK_ASSERT_HELD(__DECONST(struct ip6_moptions *, imo)); in im6o_match_group()
361 if (imo->im6o_membership == NULL || imo->im6o_num_memberships == 0) { in im6o_match_group()
365 nmships = imo->im6o_num_memberships; in im6o_match_group()
367 pinm = imo->im6o_membership[idx]; in im6o_match_group()
399 im6o_match_source(const struct ip6_moptions *imo, const size_t gidx, in im6o_match_source() argument
407 IM6O_LOCK_ASSERT_HELD(__DECONST(struct ip6_moptions *, imo)); in im6o_match_source()
410 VERIFY(gidx != (size_t)-1 && gidx < imo->im6o_num_memberships); in im6o_match_source()
413 if (imo->im6o_mfilters == NULL) { in im6o_match_source()
416 imf = &imo->im6o_mfilters[gidx]; in im6o_match_source()
433 im6o_mc_filter(const struct ip6_moptions *imo, struct ifnet *ifp, in im6o_mc_filter() argument
440 IM6O_LOCK_ASSERT_HELD(__DECONST(struct ip6_moptions *, imo)); in im6o_mc_filter()
447 gidx = im6o_match_group(imo, ifp, &group_tmp); in im6o_mc_filter()
461 mode = imo->im6o_mfilters[gidx].im6f_st[1]; in im6o_mc_filter()
462 ims = im6o_match_source(imo, gidx, src); in im6o_mc_filter()
1433 struct ip6_moptions *imo; in in6p_block_unblock_source() local
1503 imo = in6p_findmoptions(inp); in in6p_block_unblock_source()
1504 if (imo == NULL) { in in6p_block_unblock_source()
1508 IM6O_LOCK(imo); in in6p_block_unblock_source()
1509 idx = im6o_match_group(imo, ifp, gsa); in in6p_block_unblock_source()
1510 if (idx == (size_t)-1 || imo->im6o_mfilters == NULL) { in in6p_block_unblock_source()
1515 VERIFY(imo->im6o_mfilters != NULL); in in6p_block_unblock_source()
1516 imf = &imo->im6o_mfilters[idx]; in in6p_block_unblock_source()
1517 inm = imo->im6o_membership[idx]; in in6p_block_unblock_source()
1535 ims = im6o_match_source(imo, idx, ssa); in in6p_block_unblock_source()
1594 IM6O_UNLOCK(imo); in in6p_block_unblock_source()
1595 IM6O_REMREF(imo); /* from in6p_findmoptions() */ in in6p_block_unblock_source()
1611 struct ip6_moptions *imo; in in6p_findmoptions() local
1616 if ((imo = inp->in6p_moptions) != NULL) { in in6p_findmoptions()
1617 IM6O_ADDREF(imo); /* for caller */ in in6p_findmoptions()
1618 return imo; in in6p_findmoptions()
1621 imo = ip6_allocmoptions(Z_WAITOK); in in6p_findmoptions()
1622 if (imo == NULL) { in in6p_findmoptions()
1631 imo->im6o_multicast_ifp = NULL; in in6p_findmoptions()
1632 imo->im6o_multicast_hlim = (u_char)ip6_defmcasthlim; in in6p_findmoptions()
1633 imo->im6o_multicast_loop = (u_char)in6_mcast_loop; in in6p_findmoptions()
1634 imo->im6o_num_memberships = 0; in in6p_findmoptions()
1635 imo->im6o_max_memberships = IPV6_MIN_MEMBERSHIPS; in in6p_findmoptions()
1636 imo->im6o_membership = immp; in in6p_findmoptions()
1637 imo->im6o_max_filters = IPV6_MIN_MEMBERSHIPS; in in6p_findmoptions()
1638 imo->im6o_mfilters = imfp; in in6p_findmoptions()
1645 inp->in6p_moptions = imo; /* keep reference from ip6_allocmoptions() */ in in6p_findmoptions()
1646 IM6O_ADDREF(imo); /* for caller */ in in6p_findmoptions()
1648 return imo; in in6p_findmoptions()
1662 struct ip6_moptions *imo; in in6p_get_source_filters() local
1675 imo = inp->in6p_moptions; in in6p_get_source_filters()
1676 VERIFY(imo != NULL); in in6p_get_source_filters()
1731 IM6O_LOCK(imo); in in6p_get_source_filters()
1735 idx = im6o_match_group(imo, ifp, gsa); in in6p_get_source_filters()
1736 if (idx == (size_t)-1 || imo->im6o_mfilters == NULL) { in in6p_get_source_filters()
1737 IM6O_UNLOCK(imo); in in6p_get_source_filters()
1740 imf = &imo->im6o_mfilters[idx]; in in6p_get_source_filters()
1746 IM6O_UNLOCK(imo); in in6p_get_source_filters()
1770 IM6O_UNLOCK(imo); in in6p_get_source_filters()
1800 IM6O_UNLOCK(imo); in in6p_get_source_filters()
2005 struct ip6_moptions *imo; in in6p_join_group() local
2184 imo = in6p_findmoptions(inp); in in6p_join_group()
2185 if (imo == NULL) { in in6p_join_group()
2189 IM6O_LOCK(imo); in in6p_join_group()
2190 idx = im6o_match_group(imo, ifp, gsa); in in6p_join_group()
2194 inm = imo->im6o_membership[idx]; in in6p_join_group()
2195 imf = &imo->im6o_mfilters[idx]; in in6p_join_group()
2222 lims = im6o_match_source(imo, idx, ssa); in in6p_join_group()
2257 if (imo->im6o_num_memberships == imo->im6o_max_memberships) { in in6p_join_group()
2258 error = im6o_grow(imo); in in6p_join_group()
2268 idx = imo->im6o_num_memberships; in in6p_join_group()
2269 imo->im6o_membership[idx] = NULL; in in6p_join_group()
2270 imo->im6o_num_memberships++; in in6p_join_group()
2271 VERIFY(imo->im6o_mfilters != NULL); in in6p_join_group()
2272 imf = &imo->im6o_mfilters[idx]; in in6p_join_group()
2322 imo->im6o_membership[idx] = inm; /* from in6_mc_join() */ in in6p_join_group()
2358 imo->im6o_membership[idx] = NULL; in in6p_join_group()
2359 --imo->im6o_num_memberships; in in6p_join_group()
2363 IM6O_UNLOCK(imo); in in6p_join_group()
2364 IM6O_REMREF(imo); /* from in6p_findmoptions() */ in in6p_join_group()
2383 struct ip6_moptions *imo; in in6p_leave_group() local
2570 imo = in6p_findmoptions(inp); in in6p_leave_group()
2571 if (imo == NULL) { in in6p_leave_group()
2575 IM6O_LOCK(imo); in in6p_leave_group()
2576 idx = im6o_match_group(imo, ifp, gsa); in in6p_leave_group()
2581 inm = imo->im6o_membership[idx]; in in6p_leave_group()
2582 imf = &imo->im6o_mfilters[idx]; in in6p_leave_group()
2603 ims = im6o_match_source(imo, idx, ssa); in in6p_leave_group()
2661 VERIFY(inm == imo->im6o_membership[idx]); in in6p_leave_group()
2664 for (++idx; idx < imo->im6o_num_memberships; ++idx) { in in6p_leave_group()
2665 imo->im6o_membership[idx - 1] = imo->im6o_membership[idx]; in in6p_leave_group()
2666 imo->im6o_mfilters[idx - 1] = imo->im6o_mfilters[idx]; in in6p_leave_group()
2668 imo->im6o_num_memberships--; in in6p_leave_group()
2671 imo->im6o_membership[imo->im6o_num_memberships] = NULL; in in6p_leave_group()
2672 im6f_init(&imo->im6o_mfilters[imo->im6o_num_memberships], MCAST_UNDEFINED, MCAST_EXCLUDE); in in6p_leave_group()
2676 IM6O_UNLOCK(imo); in in6p_leave_group()
2677 IM6O_REMREF(imo); /* from in6p_findmoptions() */ in in6p_leave_group()
2697 struct ip6_moptions *imo; in in6p_set_multicast_if() local
2722 imo = in6p_findmoptions(inp); in in6p_set_multicast_if()
2723 if (imo == NULL) { in in6p_set_multicast_if()
2727 IM6O_LOCK(imo); in in6p_set_multicast_if()
2728 imo->im6o_multicast_ifp = ifp; in in6p_set_multicast_if()
2729 IM6O_UNLOCK(imo); in in6p_set_multicast_if()
2730 IM6O_REMREF(imo); /* from in6p_findmoptions() */ in in6p_set_multicast_if()
2747 struct ip6_moptions *imo; in in6p_set_source_filters() local
2821 imo = in6p_findmoptions(inp); in in6p_set_source_filters()
2822 if (imo == NULL) { in in6p_set_source_filters()
2826 IM6O_LOCK(imo); in in6p_set_source_filters()
2827 idx = im6o_match_group(imo, ifp, gsa); in in6p_set_source_filters()
2828 if (idx == (size_t)-1 || imo->im6o_mfilters == NULL) { in in6p_set_source_filters()
2832 inm = imo->im6o_membership[idx]; in in6p_set_source_filters()
2833 imf = &imo->im6o_mfilters[idx]; in in6p_set_source_filters()
2957 IM6O_UNLOCK(imo); in in6p_set_source_filters()
2958 IM6O_REMREF(imo); /* from in6p_findmoptions() */ in in6p_set_source_filters()