Date: Mon, 17 May 2010 13:29:26 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 178391 for review Message-ID: <201005171329.o4HDTQN3026237@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@178391?ac=10 Change 178391 by zec@zec_nxlab on 2010/05/17 13:29:06 V_irtualize variables mrt_api_config and pim_assert_enabled, as it looks like they both may be modified on per-vnet basis. NB I have no clue whatsoever what is the purpose of those vars. Affected files ... .. //depot/projects/vimage/src/sys/netinet/ip_mroute.c#38 edit Differences ... ==== //depot/projects/vimage/src/sys/netinet/ip_mroute.c#38 (text+ko) ==== @@ -367,9 +367,10 @@ MRT_MFC_FLAGS_BORDER_VIF | MRT_MFC_RP | MRT_MFC_BW_UPCALL); -static uint32_t mrt_api_config = 0; - -static int pim_assert_enabled; +static VNET_DEFINE(uint32_t, mrt_api_config); +#define V_mrt_api_config VNET(mrt_api_config) +static VNET_DEFINE(int, pim_assert_enabled); +#define V_pim_assert_enabled VNET(pim_assert_enabled) static struct timeval pim_assert_interval = { 3, 0 }; /* Rate limit */ /* @@ -442,7 +443,7 @@ * select data size depending on API version. */ if (sopt->sopt_name == MRT_ADD_MFC && - mrt_api_config & MRT_API_FLAGS_ALL) { + V_mrt_api_config & MRT_API_FLAGS_ALL) { error = sooptcopyin(sopt, &mfc, sizeof(struct mfcctl2), sizeof(struct mfcctl2)); } else { @@ -507,8 +508,8 @@ break; case MRT_ASSERT: - error = sooptcopyout(sopt, &pim_assert_enabled, - sizeof pim_assert_enabled); + error = sooptcopyout(sopt, &V_pim_assert_enabled, + sizeof V_pim_assert_enabled); break; case MRT_API_SUPPORT: @@ -516,7 +517,7 @@ break; case MRT_API_CONFIG: - error = sooptcopyout(sopt, &mrt_api_config, sizeof mrt_api_config); + error = sooptcopyout(sopt, &V_mrt_api_config, sizeof V_mrt_api_config); break; default: @@ -607,8 +608,8 @@ ip_mrouter_reset(void) { - pim_assert_enabled = 0; - mrt_api_config = 0; + V_pim_assert_enabled = 0; + V_mrt_api_config = 0; callout_init(&V_expire_upcalls_ch, CALLOUT_MPSAFE); @@ -733,7 +734,7 @@ */ V_ip_mrouter = NULL; ip_mrouter_cnt--; - mrt_api_config = 0; + V_mrt_api_config = 0; VIF_LOCK(); @@ -755,7 +756,7 @@ } bzero((caddr_t)V_viftable, sizeof(V_viftable)); V_numvifs = 0; - pim_assert_enabled = 0; + V_pim_assert_enabled = 0; VIF_UNLOCK(); @@ -804,7 +805,7 @@ if ((i != 1) && (i != 0)) return EINVAL; - pim_assert_enabled = i; + V_pim_assert_enabled = i; return 0; } @@ -828,7 +829,7 @@ *apival = 0; return EPERM; } - if (pim_assert_enabled) { + if (V_pim_assert_enabled) { *apival = 0; return EPERM; } @@ -844,8 +845,8 @@ MFC_UNLOCK(); - mrt_api_config = *apival & mrt_api_support; - *apival = mrt_api_config; + V_mrt_api_config = *apival & mrt_api_support; + *apival = V_mrt_api_config; return 0; } @@ -1012,11 +1013,11 @@ rt->mfc_parent = mfccp->mfcc_parent; for (i = 0; i < V_numvifs; i++) { rt->mfc_ttls[i] = mfccp->mfcc_ttls[i]; - rt->mfc_flags[i] = mfccp->mfcc_flags[i] & mrt_api_config & + rt->mfc_flags[i] = mfccp->mfcc_flags[i] & V_mrt_api_config & MRT_MFC_FLAGS_ALL; } /* set the RP address */ - if (mrt_api_config & MRT_MFC_RP) + if (V_mrt_api_config & MRT_MFC_RP) rt->mfc_rp = mfccp->mfcc_rp; else rt->mfc_rp.s_addr = INADDR_ANY; @@ -1541,7 +1542,8 @@ * can complete the SPT switch, regardless of the type * of the iif (broadcast media, GRE tunnel, etc). */ - if (pim_assert_enabled && (vifi < V_numvifs) && V_viftable[vifi].v_ifp) { + if (V_pim_assert_enabled && (vifi < V_numvifs) && + V_viftable[vifi].v_ifp) { if (ifp == &V_multicast_register_if) PIMSTAT_INC(pims_rcv_registers_wrongiif); @@ -1784,7 +1786,7 @@ struct bw_meter *x; uint32_t flags; - if (!(mrt_api_config & MRT_MFC_BW_UPCALL)) + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; /* Test if the flags are valid */ @@ -1872,7 +1874,7 @@ struct mfc *mfc; struct bw_meter *x; - if (!(mrt_api_config & MRT_MFC_BW_UPCALL)) + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; MFC_LOCK(); @@ -2320,7 +2322,7 @@ { CURVNET_SET((struct vnet *) arg); - if (mrt_api_config & MRT_MFC_BW_UPCALL) + if (V_mrt_api_config & MRT_MFC_BW_UPCALL) bw_meter_process(); callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, @@ -2346,7 +2348,7 @@ * Do not send IGMP_WHOLEPKT notifications to userland, if the * rendezvous point was unspecified, and we were told not to. */ - if (pim_squelch_wholepkt != 0 && (mrt_api_config & MRT_MFC_RP) && + if (pim_squelch_wholepkt != 0 && (V_mrt_api_config & MRT_MFC_RP) && in_nullhost(rt->mfc_rp)) return 0; @@ -2364,7 +2366,7 @@ mm = m_pullup(mm, sizeof(struct ip)); if (mm != NULL) { ip = mtod(mm, struct ip *); - if ((mrt_api_config & MRT_MFC_RP) && !in_nullhost(rt->mfc_rp)) { + if ((V_mrt_api_config & MRT_MFC_RP) && !in_nullhost(rt->mfc_rp)) { pim_register_send_rp(ip, vifp, mm, rt); } else { pim_register_send_upcall(ip, vifp, mm, rt); @@ -2532,7 +2534,7 @@ + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; /* If the iif crosses a border, set the Border-bit */ - if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & mrt_api_config) + if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & V_mrt_api_config) pimhdr->flags |= htonl(PIM_BORDER_REGISTER); mb_first->m_data += sizeof(pim_encap_iphdr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005171329.o4HDTQN3026237>