Lines Matching +full:atomic +full:- +full:threshold +full:- +full:us
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
53 * and PIM-SMv2 and PIM-DM support, advanced API support,
101 #include <machine/atomic.h>
130 #define VIFI_INVALID ((vifi_t) -1)
176 VNET_DEFINE_STATIC(u_char *, nexpire); /* 0..mfchashsize-1 */
380 if (in_hosteq(rt->mfc_origin, *o) &&
381 in_hosteq(rt->mfc_mcastgrp, *g) &&
382 buf_ring_empty(rt->mfc_stall_ring))
397 rt->mfc_stall_ring = buf_ring_alloc(MAX_UPQ, M_MRTABLE,
399 if (rt->mfc_stall_ring == NULL) {
420 if (so != V_ip_mrouter && sopt->sopt_name != MRT_INIT)
424 switch (sopt->sopt_name) {
451 if (sopt->sopt_name == MRT_ADD_MFC &&
459 sizeof(mfc) - sizeof(struct mfcctl));
463 if (sopt->sopt_name == MRT_ADD_MFC)
490 if (sopt->sopt_name == MRT_ADD_BW_UPCALL)
511 switch (sopt->sopt_name) {
568 * returns the packet, byte, rpf-failure count for the source group provided
576 rt = mfc_find(&req->src, &req->grp);
579 req->pktcnt = req->bytecnt = req->wrong_if = 0xffffffff;
582 req->pktcnt = rt->mfc_pkt_cnt;
583 req->bytecnt = rt->mfc_byte_cnt;
584 req->wrong_if = rt->mfc_wrong_if;
595 vifi_t vifi = req->vifi;
604 req->icount = V_viftable[vifi].v_pkt_in;
605 req->ocount = V_viftable[vifi].v_pkt_out;
606 req->ibytes = V_viftable[vifi].v_bytes_in;
607 req->obytes = V_viftable[vifi].v_bytes_out;
644 if (rt->mfc_parent == vifi) {
796 * a non-sleepable lock.
872 * - there are no vifs installed
873 * - pim_assert is not enabled
874 * - the MFC table is empty
909 struct vif *vifp = V_viftable + vifcp->vifc_vifi;
915 if (vifcp->vifc_vifi >= MAXVIFS)
918 if (vifcp->vifc_rate_limit != 0) {
923 if (in_nullhost(vifcp->vifc_lcl_addr))
927 if (vifcp->vifc_flags & VIFF_REGISTER) {
937 sin.sin_addr = vifcp->vifc_lcl_addr;
944 ifp = ifa->ifa_ifp;
949 if ((vifcp->vifc_flags & VIFF_TUNNEL) != 0) {
952 } else if (vifcp->vifc_flags & VIFF_REGISTER) {
957 V_reg_vif_num = vifcp->vifc_vifi;
960 if ((ifp->if_flags & IFF_MULTICAST) == 0)
971 if (!in_nullhost(vifp->v_lcl_addr)) {
980 vifp->v_flags = vifcp->vifc_flags;
981 vifp->v_threshold = vifcp->vifc_threshold;
982 vifp->v_lcl_addr = vifcp->vifc_lcl_addr;
983 vifp->v_rmt_addr = vifcp->vifc_rmt_addr;
984 vifp->v_ifp = ifp;
986 vifp->v_pkt_in = 0;
987 vifp->v_pkt_out = 0;
988 vifp->v_bytes_in = 0;
989 vifp->v_bytes_out = 0;
990 sprintf(vifp->v_spin_name, "BM[%d] spin", vifcp->vifc_vifi);
991 mtx_init(&vifp->v_spin, vifp->v_spin_name, NULL, MTX_SPIN);
994 if (V_numvifs <= vifcp->vifc_vifi)
995 V_numvifs = vifcp->vifc_vifi + 1;
1000 (int)vifcp->vifc_vifi, ntohl(vifcp->vifc_lcl_addr.s_addr),
1001 (int)vifcp->vifc_threshold);
1023 if (in_nullhost(vifp->v_lcl_addr)) {
1027 if (!(vifp->v_flags & (VIFF_TUNNEL | VIFF_REGISTER)))
1028 *ifp_multi_leave = vifp->v_ifp;
1030 if (vifp->v_flags & VIFF_REGISTER) {
1032 if (vifp->v_ifp) {
1033 if (vifp->v_ifp == V_multicast_register_if)
1035 *ifp_free = vifp->v_ifp;
1039 mtx_destroy(&vifp->v_spin);
1046 for (vifi = V_numvifs; vifi > 0; vifi--)
1047 if (!in_nullhost(V_viftable[vifi-1].v_lcl_addr))
1081 rt->mfc_parent = mfccp->mfcc_parent;
1083 rt->mfc_ttls[i] = mfccp->mfcc_ttls[i];
1084 rt->mfc_flags[i] = mfccp->mfcc_flags[i] & V_mrt_api_config &
1089 rt->mfc_rp = mfccp->mfcc_rp;
1091 rt->mfc_rp.s_addr = INADDR_ANY;
1100 rt->mfc_origin = mfccp->mfcc_origin;
1101 rt->mfc_mcastgrp = mfccp->mfcc_mcastgrp;
1105 /* initialize pkt counters per src-grp */
1106 rt->mfc_pkt_cnt = 0;
1107 rt->mfc_byte_cnt = 0;
1108 rt->mfc_wrong_if = 0;
1109 timevalclear(&rt->mfc_last_assert);
1119 free_bw_list(rt->mfc_bw_meter_leq);
1120 free_bw_list(rt->mfc_bw_meter_geq);
1122 while (!buf_ring_empty(rt->mfc_stall_ring)) {
1123 rte = buf_ring_dequeue_mc(rt->mfc_stall_ring);
1125 m_freem(rte->m);
1129 buf_ring_free(rt->mfc_stall_ring, M_MRTABLE);
1148 rt = mfc_find(&mfccp->mfcc_origin, &mfccp->mfcc_mcastgrp);
1153 __func__, ntohl(mfccp->mfcc_origin.s_addr),
1154 (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr),
1155 mfccp->mfcc_parent);
1165 hash = MFCHASH(mfccp->mfcc_origin, mfccp->mfcc_mcastgrp);
1168 if (in_hosteq(rt->mfc_origin, mfccp->mfcc_origin) &&
1169 in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp) &&
1170 !buf_ring_empty(rt->mfc_stall_ring)) {
1173 __func__, ntohl(mfccp->mfcc_origin.s_addr),
1174 (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr),
1175 mfccp->mfcc_parent,
1176 rt->mfc_stall_ring);
1181 rt->mfc_expire = 0; /* Don't clean this guy up */
1182 V_nexpire[hash]--;
1185 while (!buf_ring_empty(rt->mfc_stall_ring)) {
1186 rte = buf_ring_dequeue_mc(rt->mfc_stall_ring);
1187 if (rte->ifp != NULL)
1188 ip_mdq(rte->m, rte->ifp, rt, -1);
1189 m_freem(rte->m);
1202 if (in_hosteq(rt->mfc_origin, mfccp->mfcc_origin) &&
1203 in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp)) {
1205 if (rt->mfc_expire)
1206 V_nexpire[hash]--;
1207 rt->mfc_expire = 0;
1221 rt->mfc_expire = 0;
1222 rt->mfc_bw_meter_leq = NULL;
1223 rt->mfc_bw_meter_geq = NULL;
1245 origin = mfccp->mfcc_origin;
1246 mcastgrp = mfccp->mfcc_mcastgrp;
1254 if (in_hosteq(rt->mfc_origin, origin) &&
1255 in_hosteq(rt->mfc_mcastgrp, mcastgrp))
1277 SOCKBUF_LOCK(&s->so_rcv);
1278 if (sbappendaddr_locked(&s->so_rcv, (struct sockaddr *)src, mm,
1286 return -1;
1296 * erroneous, in which case a non-zero return value tells the caller to
1317 ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr), ifp);
1319 if (ip->ip_hl < (sizeof(struct ip) + TUNNEL_LEN) >> 2 ||
1327 * Packet arrived through a source-route tunnel.
1328 * Source-route tunnels are no longer supported.
1337 if (imo && ((vifi = imo->imo_multicast_vif) < V_numvifs)) {
1338 if (ip->ip_ttl < MAXTTL)
1339 ip->ip_ttl++; /* compensate for -1 in *_send routines */
1346 * Don't forward a packet with time-to-live of zero or one,
1347 * or a packet destined to a local-only group.
1349 if (ip->ip_ttl <= 1 || IN_LOCAL_GROUP(ntohl(ip->ip_dst.s_addr))) {
1359 rt = mfc_find(&ip->ip_src, &ip->ip_dst);
1363 error = ip_mdq(m, ifp, rt, -1);
1384 hlen = ip->ip_hl << 2;
1389 ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr));
1403 if (mb0 && (!M_WRITABLE(mb0) || mb0->m_len < hlen))
1412 hash = MFCHASH(ip->ip_src, ip->ip_dst);
1415 if (in_hosteq(ip->ip_src, rt->mfc_origin) &&
1416 in_hosteq(ip->ip_dst, rt->mfc_mcastgrp) &&
1417 !buf_ring_empty(rt->mfc_stall_ring))
1453 im->im_msgtype = IGMPMSG_NOCACHE;
1454 im->im_mbz = 0;
1455 im->im_vif = vifi;
1459 k_igmpsrc.sin_addr = ip->ip_src;
1471 rt->mfc_origin.s_addr = ip->ip_src.s_addr;
1472 rt->mfc_mcastgrp.s_addr = ip->ip_dst.s_addr;
1473 rt->mfc_expire = UPCALL_EXPIRE;
1476 rt->mfc_ttls[i] = 0;
1477 rt->mfc_flags[i] = 0;
1479 rt->mfc_parent = -1;
1482 rt->mfc_rp.s_addr = INADDR_ANY;
1483 rt->mfc_bw_meter_leq = NULL;
1484 rt->mfc_bw_meter_geq = NULL;
1486 /* initialize pkt counters per src-grp */
1487 rt->mfc_pkt_cnt = 0;
1488 rt->mfc_byte_cnt = 0;
1489 rt->mfc_wrong_if = 0;
1490 timevalclear(&rt->mfc_last_assert);
1492 buf_ring_enqueue(rt->mfc_stall_ring, rte);
1498 if (buf_ring_full(rt->mfc_stall_ring)) {
1506 buf_ring_enqueue(rt->mfc_stall_ring, rte);
1509 rte->m = mb0;
1510 rte->ifp = ifp;
1536 if (buf_ring_empty(rt->mfc_stall_ring))
1539 if (rt->mfc_expire == 0 || --rt->mfc_expire > 0)
1544 (u_long)ntohl(rt->mfc_origin.s_addr),
1545 (u_long)ntohl(rt->mfc_mcastgrp.s_addr));
1565 int plen = ntohs(ip->ip_len);
1572 * If xmt_vif is not -1, send on only the requested vif.
1574 * (since vifi_t is u_short, -1 becomes MAXUSHORT, which > numvifs.)
1587 vifi = rt->mfc_parent;
1592 ++rt->mfc_wrong_if;
1597 * XXX: A PIM-SM router needs the WRONGVIF detection so it
1612 if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_DISABLE_WRONGVIF)
1615 if (ratecheck(&rt->mfc_last_assert, &pim_assert_interval)) {
1618 int hlen = ip->ip_hl << 2;
1621 if (mm && (!M_WRITABLE(mm) || mm->m_len < hlen))
1627 im->im_msgtype = IGMPMSG_WRONGVIF;
1628 im->im_mbz = 0;
1629 im->im_vif = vifi;
1633 k_igmpsrc.sin_addr = im->im_src;
1646 if (in_hosteq(ip->ip_src, V_viftable[vifi].v_lcl_addr)) {
1655 rt->mfc_pkt_cnt++;
1656 rt->mfc_byte_cnt += plen;
1661 * - the ttl exceeds the vif's threshold
1662 * - there are group members downstream on interface
1665 if ((rt->mfc_ttls[vifi] > 0) && (ip->ip_ttl > rt->mfc_ttls[vifi])) {
1675 * Perform upcall-related bw measuring.
1677 if ((rt->mfc_bw_meter_geq != NULL) || (rt->mfc_bw_meter_leq != NULL)) {
1682 /* Process meters for Greater-or-EQual case */
1683 for (x = rt->mfc_bw_meter_geq; x != NULL; x = x->bm_mfc_next)
1686 /* Process meters for Lower-or-EQual case */
1687 for (x = rt->mfc_bw_meter_leq; x != NULL; x = x->bm_mfc_next) {
1694 mtx_lock_spin(&x->bm_spin);
1695 x->bm_measured.b_packets++;
1696 x->bm_measured.b_bytes += plen;
1697 mtx_unlock_spin(&x->bm_spin);
1748 int hlen = ip->ip_hl << 2;
1759 if (mb_copy && (!M_WRITABLE(mb_copy) || mb_copy->m_len < hlen))
1776 imo.imo_multicast_ifp = vifp->v_ifp;
1777 imo.imo_multicast_ttl = mtod(m, struct ip *)->ip_ttl - 1;
1779 imo.imo_multicast_vif = -1;
1783 * Re-entrancy should not be a problem here, because
1784 * the packets that we send out and are looped back at us
1790 (ptrdiff_t)(vifp - V_viftable), error);
1827 * Define common interface for timeval-related methods
1838 if (req->bu_flags & BW_UPCALL_UNIT_PACKETS)
1840 if (req->bu_flags & BW_UPCALL_UNIT_BYTES)
1842 if (req->bu_flags & BW_UPCALL_GEQ)
1844 if (req->bu_flags & BW_UPCALL_LEQ)
1860 CURVNET_SET((struct vnet *)x->arg);
1867 if (((x->bm_flags & BW_METER_UNIT_PACKETS) &&
1868 (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) ||
1869 ((x->bm_flags & BW_METER_UNIT_BYTES) &&
1870 (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) {
1879 x->bm_start_time = now;
1883 mtx_lock_spin(&x->bm_spin);
1884 x->bm_measured.b_bytes = 0;
1885 x->bm_measured.b_packets = 0;
1886 mtx_unlock_spin(&x->bm_spin);
1888 callout_schedule(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time));
1910 if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES)))
1912 if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)))
1914 if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)) == (BW_UPCALL_GEQ | BW_UPCALL_LEQ))
1917 /* Test if the threshold time interval is valid */
1918 if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <))
1927 mfc = mfc_find(&req->bu_src, &req->bu_dst);
1934 if (req->bu_flags & BW_UPCALL_GEQ)
1935 bwm_ptr = &mfc->mfc_bw_meter_geq;
1937 bwm_ptr = &mfc->mfc_bw_meter_leq;
1939 for (x = *bwm_ptr; x != NULL; x = x->bm_mfc_next) {
1940 if ((BW_TIMEVALCMP(&x->bm_threshold.b_time,
1941 &req->bu_threshold.b_time, ==))
1942 && (x->bm_threshold.b_packets
1943 == req->bu_threshold.b_packets)
1944 && (x->bm_threshold.b_bytes
1945 == req->bu_threshold.b_bytes)
1946 && (x->bm_flags & BW_METER_USER_FLAGS)
1961 x->bm_threshold.b_time = req->bu_threshold.b_time;
1963 x->bm_start_time = now;
1964 x->bm_threshold.b_packets = req->bu_threshold.b_packets;
1965 x->bm_threshold.b_bytes = req->bu_threshold.b_bytes;
1966 x->bm_measured.b_packets = 0;
1967 x->bm_measured.b_bytes = 0;
1968 x->bm_flags = flags;
1969 x->bm_time_next = NULL;
1970 x->bm_mfc = mfc;
1971 x->arg = curvnet;
1972 sprintf(x->bm_spin_name, "BM spin %p", x);
1973 mtx_init(&x->bm_spin, x->bm_spin_name, NULL, MTX_SPIN);
1976 if (req->bu_flags & BW_UPCALL_LEQ) {
1977 callout_init_rw(&x->bm_meter_callout, &mrouter_lock, CALLOUT_SHAREDLOCK);
1978 callout_reset(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time),
1983 x->bm_mfc_next = *bwm_ptr;
1998 if (x->bm_flags & BW_METER_LEQ) {
1999 callout_drain(&x->bm_meter_callout);
2000 mtx_destroy(&x->bm_spin);
2003 list = list->bm_mfc_next;
2023 mfc = mfc_find(&req->bu_src, &req->bu_dst);
2027 } else if (req->bu_flags & BW_UPCALL_DELETE_ALL) {
2034 list = mfc->mfc_bw_meter_leq;
2035 mfc->mfc_bw_meter_leq = NULL;
2039 list = mfc->mfc_bw_meter_geq;
2040 mfc->mfc_bw_meter_geq = NULL;
2051 if (req->bu_flags & BW_UPCALL_GEQ)
2052 bwm_ptr = &mfc->mfc_bw_meter_geq;
2054 bwm_ptr = &mfc->mfc_bw_meter_leq;
2058 prev = x, x = x->bm_mfc_next) {
2059 if ((BW_TIMEVALCMP(&x->bm_threshold.b_time, &req->bu_threshold.b_time, ==)) &&
2060 (x->bm_threshold.b_packets == req->bu_threshold.b_packets) &&
2061 (x->bm_threshold.b_bytes == req->bu_threshold.b_bytes) &&
2062 (x->bm_flags & BW_METER_USER_FLAGS) == flags)
2067 prev->bm_mfc_next = x->bm_mfc_next; /* remove from middle*/
2069 *bwm_ptr = x->bm_mfc_next;/* new head of list */
2071 if (req->bu_flags & BW_UPCALL_LEQ)
2072 callout_stop(&x->bm_meter_callout);
2097 BW_TIMEVALDECR(&delta, &x->bm_start_time);
2104 if (BW_TIMEVALCMP(&delta, &x->bm_threshold.b_time, >)) {
2106 x->bm_start_time = *nowp;
2107 x->bm_measured.b_packets = 0;
2108 x->bm_measured.b_bytes = 0;
2109 x->bm_flags &= ~BW_METER_UPCALL_DELIVERED;
2113 x->bm_measured.b_packets++;
2114 x->bm_measured.b_bytes += plen;
2119 if (!(x->bm_flags & BW_METER_UPCALL_DELIVERED)) {
2120 if (((x->bm_flags & BW_METER_UNIT_PACKETS) &&
2121 (x->bm_measured.b_packets >= x->bm_threshold.b_packets)) ||
2122 ((x->bm_flags & BW_METER_UNIT_BYTES) &&
2123 (x->bm_measured.b_bytes >= x->bm_threshold.b_bytes))) {
2126 x->bm_flags |= BW_METER_UPCALL_DELIVERED;
2132 * Prepare a bandwidth-related upcall
2146 BW_TIMEVALDECR(&delta, &x->bm_start_time);
2156 u->bu_src = x->bm_mfc->mfc_origin;
2157 u->bu_dst = x->bm_mfc->mfc_mcastgrp;
2158 u->bu_threshold.b_time = x->bm_threshold.b_time;
2159 u->bu_threshold.b_packets = x->bm_threshold.b_packets;
2160 u->bu_threshold.b_bytes = x->bm_threshold.b_bytes;
2161 u->bu_measured.b_time = delta;
2162 u->bu_measured.b_packets = x->bm_measured.b_packets;
2163 u->bu_measured.b_bytes = x->bm_measured.b_bytes;
2164 u->bu_flags = 0;
2165 if (x->bm_flags & BW_METER_UNIT_PACKETS)
2166 u->bu_flags |= BW_UPCALL_UNIT_PACKETS;
2167 if (x->bm_flags & BW_METER_UNIT_BYTES)
2168 u->bu_flags |= BW_UPCALL_UNIT_BYTES;
2169 if (x->bm_flags & BW_METER_GEQ)
2170 u->bu_flags |= BW_UPCALL_GEQ;
2171 if (x->bm_flags & BW_METER_LEQ)
2172 u->bu_flags |= BW_UPCALL_LEQ;
2181 * Send the pending bandwidth-related upcalls
2271 in_nullhost(rt->mfc_rp))
2283 mb_copy = mm->m_nextpkt;
2284 mm->m_nextpkt = 0;
2288 if ((V_mrt_api_config & MRT_MFC_RP) && !in_nullhost(rt->mfc_rp)) {
2311 if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
2313 m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
2323 mb_copy = m_pullup(mb_copy, ip->ip_hl << 2);
2329 --ip->ip_ttl;
2332 mtu = 0xffff - sizeof(pim_encap_iphdr) - sizeof(pim_encap_pimhdr);
2334 if (ntohs(ip->ip_len) <= mtu) {
2336 ip->ip_sum = 0;
2337 ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2);
2340 mb_copy->m_pkthdr.csum_flags |= CSUM_IP;
2350 * Send an upcall with the data packet to the user-level process.
2357 int len = ntohs(ip->ip_len);
2371 mb_first->m_data += max_linkhdr;
2372 mb_first->m_pkthdr.len = len + sizeof(struct igmpmsg);
2373 mb_first->m_len = sizeof(struct igmpmsg);
2374 mb_first->m_next = mb_copy;
2378 im->im_msgtype = IGMPMSG_WHOLEPKT;
2379 im->im_mbz = 0;
2380 im->im_vif = vifp - V_viftable;
2381 im->im_src = ip->ip_src;
2382 im->im_dst = ip->ip_dst;
2384 k_igmpsrc.sin_addr = ip->ip_src;
2411 int len = ntohs(ip->ip_len);
2412 vifi_t vifi = rt->mfc_parent;
2429 mb_first->m_data += max_linkhdr;
2430 mb_first->m_len = sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr);
2431 mb_first->m_next = mb_copy;
2433 mb_first->m_pkthdr.len = len + mb_first->m_len;
2440 ip_outer->ip_len = htons(len + sizeof(pim_encap_iphdr) +
2442 ip_outer->ip_src = V_viftable[vifi].v_lcl_addr;
2443 ip_outer->ip_dst = rt->mfc_rp;
2448 ip_outer->ip_tos = ip->ip_tos;
2449 if (ip->ip_off & htons(IP_DF))
2450 ip_outer->ip_off |= htons(IP_DF);
2455 /* If the iif crosses a border, set the Border-bit */
2456 if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & V_mrt_api_config)
2457 pimhdr->flags |= htonl(PIM_BORDER_REGISTER);
2459 mb_first->m_data += sizeof(pim_encap_iphdr);
2460 pimhdr->pim.pim_cksum = in_cksum(mb_first, sizeof(pim_encap_pimhdr));
2461 mb_first->m_data -= sizeof(pim_encap_iphdr);
2487 * PIM-SMv2 and PIM-DM messages processing.
2491 * (used by PIM-SM): the PIM header is stripped off, and the inner packet
2501 int datalen = ntohs(ip->ip_len) - iphlen;
2514 __func__, datalen, ntohl(ip->ip_src.s_addr));
2532 if (m->m_len < minlen && (m = m_pullup(m, minlen)) == NULL) {
2537 /* m_pullup() may have given us a new mbuf so reset ip. */
2539 ip_tos = ip->ip_tos;
2542 m->m_data += iphlen;
2543 m->m_len -= iphlen;
2553 if (PIM_VT_T(pim->pim_vt) == PIM_REGISTER && in_cksum(m, PIM_MINLEN) == 0) {
2563 if (PIM_VT_V(pim->pim_vt) < PIM_VERSION) {
2566 (int)PIM_VT_V(pim->pim_vt), PIM_VERSION);
2572 m->m_data -= iphlen;
2573 m->m_len += iphlen;
2575 if (PIM_VT_T(pim->pim_vt) == PIM_REGISTER) {
2614 __func__, ntohl(encap_ip->ip_src.s_addr),
2615 ntohs(encap_ip->ip_len));
2618 if (encap_ip->ip_v != IPVERSION) {
2626 if (!IN_MULTICAST(ntohl(encap_ip->ip_dst.s_addr))) {
2629 ntohl(encap_ip->ip_dst.s_addr));
2641 if (encap_ip->ip_tos != ip_tos) {
2642 /* Outer TOS -> inner TOS */
2643 encap_ip->ip_tos = ip_tos;
2647 m->m_data += (iphlen + PIM_MINLEN);
2648 m->m_len -= (iphlen + PIM_MINLEN);
2650 encap_ip->ip_sum = 0;
2651 encap_ip->ip_sum = in_cksum(m, encap_ip->ip_hl << 2);
2654 m->m_data -= (iphlen + PIM_MINLEN);
2655 m->m_len += (iphlen + PIM_MINLEN);
2664 * XXX: here m->m_data points to the outer IP header.
2676 PIMSTAT_ADD(pims_rcv_registers_bytes, ntohs(encap_ip->ip_len));
2686 (u_long)ntohl(encap_ip->ip_src.s_addr),
2687 (u_long)ntohl(encap_ip->ip_dst.s_addr),
2690 /* NB: vifp was collected above; can it change on us? */
2701 * outer IP header, PIM header, PIM-Register header and the
2715 if (req->newptr)
2746 if (req->newptr)
2755 /* Copy out user-visible portion of vif entry. */
2847 * Typically module unload happens after the user-level