Lines Matching refs:imo
266 imo_grow(struct ip_moptions *imo, uint16_t newmax) in imo_grow() argument
276 IMO_LOCK_ASSERT_HELD(imo); in imo_grow()
281 omships = imo->imo_membership; in imo_grow()
282 omfilters = imo->imo_mfilters; in imo_grow()
283 oldmax = imo->imo_max_memberships; in imo_grow()
328 imo->imo_membership = nmships; in imo_grow()
330 imo->imo_max_memberships = newmax; in imo_grow()
332 imo->imo_mfilters = nmfilters; in imo_grow()
334 imo->imo_max_filters = newmax; in imo_grow()
356 imo_match_group(const struct ip_moptions *imo, const struct ifnet *ifp, in imo_match_group() argument
363 IMO_LOCK_ASSERT_HELD(__DECONST(struct ip_moptions *, imo)); in imo_match_group()
367 if (imo->imo_membership == NULL || imo->imo_num_memberships == 0) { in imo_match_group()
371 nmships = imo->imo_num_memberships; in imo_match_group()
373 pinm = imo->imo_membership[idx]; in imo_match_group()
400 imo_match_source(const struct ip_moptions *imo, const size_t gidx, in imo_match_source() argument
407 IMO_LOCK_ASSERT_HELD(__DECONST(struct ip_moptions *, imo)); in imo_match_source()
410 VERIFY(gidx != (size_t)-1 && gidx < imo->imo_num_memberships); in imo_match_source()
413 if (imo->imo_mfilters == NULL) { in imo_match_source()
416 imf = &imo->imo_mfilters[gidx]; in imo_match_source()
432 imo_multi_filter(const struct ip_moptions *imo, const struct ifnet *ifp, in imo_multi_filter() argument
439 IMO_LOCK_ASSERT_HELD(__DECONST(struct ip_moptions *, imo)); in imo_multi_filter()
442 gidx = imo_match_group(imo, ifp, group); in imo_multi_filter()
456 mode = imo->imo_mfilters[gidx].imf_st[1]; in imo_multi_filter()
457 ims = imo_match_source(imo, gidx, src); in imo_multi_filter()
1478 struct ip_moptions *imo; in inp_block_unblock_source() local
1580 imo = inp_findmoptions(inp); in inp_block_unblock_source()
1581 if (imo == NULL) { in inp_block_unblock_source()
1585 IMO_LOCK(imo); in inp_block_unblock_source()
1586 idx = imo_match_group(imo, ifp, gsa); in inp_block_unblock_source()
1587 if (idx == (size_t)-1 || imo->imo_mfilters == NULL) { in inp_block_unblock_source()
1592 VERIFY(imo->imo_mfilters != NULL); in inp_block_unblock_source()
1593 imf = &imo->imo_mfilters[idx]; in inp_block_unblock_source()
1594 inm = imo->imo_membership[idx]; in inp_block_unblock_source()
1612 ims = imo_match_source(imo, idx, ssa); in inp_block_unblock_source()
1671 IMO_UNLOCK(imo); in inp_block_unblock_source()
1672 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_block_unblock_source()
1689 struct ip_moptions *imo; in inp_findmoptions() local
1694 if ((imo = inp->inp_moptions) != NULL) { in inp_findmoptions()
1695 IMO_ADDREF(imo); /* for caller */ in inp_findmoptions()
1696 return imo; in inp_findmoptions()
1699 imo = ip_allocmoptions(Z_WAITOK); in inp_findmoptions()
1700 if (imo == NULL) { in inp_findmoptions()
1709 imo->imo_multicast_ifp = NULL; in inp_findmoptions()
1710 imo->imo_multicast_addr.s_addr = INADDR_ANY; in inp_findmoptions()
1711 imo->imo_multicast_vif = -1; in inp_findmoptions()
1712 imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; in inp_findmoptions()
1713 imo->imo_multicast_loop = !!in_mcast_loop; in inp_findmoptions()
1714 imo->imo_num_memberships = 0; in inp_findmoptions()
1715 imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; in inp_findmoptions()
1716 imo->imo_membership = immp; in inp_findmoptions()
1717 imo->imo_max_filters = IP_MIN_MEMBERSHIPS; in inp_findmoptions()
1718 imo->imo_mfilters = imfp; in inp_findmoptions()
1725 inp->inp_moptions = imo; /* keep reference from ip_allocmoptions() */ in inp_findmoptions()
1726 IMO_ADDREF(imo); /* for caller */ in inp_findmoptions()
1728 return imo; in inp_findmoptions()
1740 struct ip_moptions *imo; in inp_get_source_filters() local
1752 imo = inp->inp_moptions; in inp_get_source_filters()
1753 VERIFY(imo != NULL); in inp_get_source_filters()
1799 IMO_LOCK(imo); in inp_get_source_filters()
1805 idx = imo_match_group(imo, ifp, gsa); in inp_get_source_filters()
1806 if (idx == (size_t)-1 || imo->imo_mfilters == NULL) { in inp_get_source_filters()
1807 IMO_UNLOCK(imo); in inp_get_source_filters()
1810 imf = &imo->imo_mfilters[idx]; in inp_get_source_filters()
1816 IMO_UNLOCK(imo); in inp_get_source_filters()
1840 IMO_UNLOCK(imo); in inp_get_source_filters()
1870 IMO_UNLOCK(imo); in inp_get_source_filters()
1909 struct ip_moptions *imo; in inp_getmoptions() local
1916 imo = inp->inp_moptions; in inp_getmoptions()
1931 if (imo != NULL) { in inp_getmoptions()
1932 IMO_LOCK(imo); in inp_getmoptions()
1933 ifp = imo->imo_multicast_ifp; in inp_getmoptions()
1934 if (!in_nullhost(imo->imo_multicast_addr)) { in inp_getmoptions()
1935 mreqn.imr_address = imo->imo_multicast_addr; in inp_getmoptions()
1947 IMO_UNLOCK(imo); in inp_getmoptions()
1959 if (imo != NULL) { in inp_getmoptions()
1960 IMO_LOCK(imo); in inp_getmoptions()
1962 if (imo == NULL || imo->imo_multicast_ifp == NULL) { in inp_getmoptions()
1965 ifindex = imo->imo_multicast_ifp->if_index; in inp_getmoptions()
1967 if (imo != NULL) { in inp_getmoptions()
1968 IMO_UNLOCK(imo); in inp_getmoptions()
1974 if (imo == NULL) { in inp_getmoptions()
1977 IMO_LOCK(imo); in inp_getmoptions()
1978 optval = coptval = imo->imo_multicast_ttl; in inp_getmoptions()
1979 IMO_UNLOCK(imo); in inp_getmoptions()
1989 if (imo == 0) { in inp_getmoptions()
1992 IMO_LOCK(imo); in inp_getmoptions()
1993 optval = coptval = imo->imo_multicast_loop; in inp_getmoptions()
1994 IMO_UNLOCK(imo); in inp_getmoptions()
2004 if (imo == NULL) { in inp_getmoptions()
2108 struct ip_moptions *imo; in inp_join_group() local
2242 imo = inp_findmoptions(inp); in inp_join_group()
2243 if (imo == NULL) { in inp_join_group()
2247 IMO_LOCK(imo); in inp_join_group()
2248 idx = imo_match_group(imo, ifp, gsa); in inp_join_group()
2252 inm = imo->imo_membership[idx]; in inp_join_group()
2253 imf = &imo->imo_mfilters[idx]; in inp_join_group()
2280 lims = imo_match_source(imo, idx, ssa); in inp_join_group()
2315 if (imo->imo_num_memberships == imo->imo_max_memberships) { in inp_join_group()
2316 error = imo_grow(imo, 0); in inp_join_group()
2326 idx = imo->imo_num_memberships; in inp_join_group()
2327 imo->imo_membership[idx] = NULL; in inp_join_group()
2328 imo->imo_num_memberships++; in inp_join_group()
2329 VERIFY(imo->imo_mfilters != NULL); in inp_join_group()
2330 imf = &imo->imo_mfilters[idx]; in inp_join_group()
2374 imo->imo_membership[idx] = inm; /* from in_joingroup() */ in inp_join_group()
2410 imo->imo_membership[idx] = NULL; in inp_join_group()
2411 --imo->imo_num_memberships; in inp_join_group()
2415 IMO_UNLOCK(imo); in inp_join_group()
2416 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_join_group()
2438 struct ip_moptions *imo; in inp_leave_group() local
2558 imo = inp_findmoptions(inp); in inp_leave_group()
2559 if (imo == NULL) { in inp_leave_group()
2563 IMO_LOCK(imo); in inp_leave_group()
2564 idx = imo_match_group(imo, ifp, gsa); in inp_leave_group()
2569 inm = imo->imo_membership[idx]; in inp_leave_group()
2574 imf = &imo->imo_mfilters[idx]; in inp_leave_group()
2597 ims = imo_match_source(imo, idx, ssa); in inp_leave_group()
2654 VERIFY(inm == imo->imo_membership[idx]); in inp_leave_group()
2658 for (++idx; idx < imo->imo_num_memberships; ++idx) { in inp_leave_group()
2659 imo->imo_membership[idx - 1] = imo->imo_membership[idx]; in inp_leave_group()
2660 imo->imo_mfilters[idx - 1] = imo->imo_mfilters[idx]; in inp_leave_group()
2662 imo->imo_num_memberships--; in inp_leave_group()
2665 imo->imo_membership[imo->imo_num_memberships] = NULL; in inp_leave_group()
2666 imf_init(&imo->imo_mfilters[imo->imo_num_memberships], MCAST_UNDEFINED, MCAST_EXCLUDE); in inp_leave_group()
2670 IMO_UNLOCK(imo); in inp_leave_group()
2671 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_leave_group()
2693 struct ip_moptions *imo; in inp_set_multicast_if() local
2753 imo = inp_findmoptions(inp); in inp_set_multicast_if()
2754 if (imo == NULL) { in inp_set_multicast_if()
2758 IMO_LOCK(imo); in inp_set_multicast_if()
2759 imo->imo_multicast_ifp = ifp; in inp_set_multicast_if()
2761 imo->imo_multicast_addr = addr; in inp_set_multicast_if()
2763 imo->imo_multicast_addr.s_addr = INADDR_ANY; in inp_set_multicast_if()
2765 IMO_UNLOCK(imo); in inp_set_multicast_if()
2766 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_set_multicast_if()
2782 struct ip_moptions *imo; in inp_set_source_filters() local
2854 imo = inp_findmoptions(inp); in inp_set_source_filters()
2855 if (imo == NULL) { in inp_set_source_filters()
2859 IMO_LOCK(imo); in inp_set_source_filters()
2860 idx = imo_match_group(imo, ifp, gsa); in inp_set_source_filters()
2861 if (idx == (size_t)-1 || imo->imo_mfilters == NULL) { in inp_set_source_filters()
2865 inm = imo->imo_membership[idx]; in inp_set_source_filters()
2866 imf = &imo->imo_mfilters[idx]; in inp_set_source_filters()
2980 IMO_UNLOCK(imo); in inp_set_source_filters()
2981 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_set_source_filters()
3001 struct ip_moptions *imo; in inp_setmoptions() local
3033 imo = inp_findmoptions(inp); in inp_setmoptions()
3034 if (imo == NULL) { in inp_setmoptions()
3044 IMO_LOCK(imo); in inp_setmoptions()
3045 imo->imo_multicast_ifp = NULL; in inp_setmoptions()
3046 IMO_UNLOCK(imo); in inp_setmoptions()
3047 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_setmoptions()
3055 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_setmoptions()
3064 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_setmoptions()
3068 IMO_LOCK(imo); in inp_setmoptions()
3069 imo->imo_multicast_ifp = ifp; in inp_setmoptions()
3077 imo->imo_multicast_addr.s_addr = INADDR_ANY; in inp_setmoptions()
3078 IMO_UNLOCK(imo); in inp_setmoptions()
3079 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_setmoptions()
3111 imo = inp_findmoptions(inp); in inp_setmoptions()
3112 if (imo == NULL) { in inp_setmoptions()
3116 IMO_LOCK(imo); in inp_setmoptions()
3117 imo->imo_multicast_ttl = ttl; in inp_setmoptions()
3118 IMO_UNLOCK(imo); in inp_setmoptions()
3119 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_setmoptions()
3148 imo = inp_findmoptions(inp); in inp_setmoptions()
3149 if (imo == NULL) { in inp_setmoptions()
3153 IMO_LOCK(imo); in inp_setmoptions()
3154 imo->imo_multicast_loop = !!loop; in inp_setmoptions()
3155 IMO_UNLOCK(imo); in inp_setmoptions()
3156 IMO_REMREF(imo); /* from inp_findmoptions() */ in inp_setmoptions()