summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_mroute.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2008-08-17 23:27:27 +0000
committerbz <bz@FreeBSD.org>2008-08-17 23:27:27 +0000
commit1021d43b569bfc8d2c5544bde2f540fa432b011f (patch)
tree1496da534aec03cf2f9d2d0735d80e4c1e3b5715 /sys/netinet/ip_mroute.c
parent7fc341305a3e341fca7f202fc1219358f8d9dbbd (diff)
downloadFreeBSD-src-1021d43b569bfc8d2c5544bde2f540fa432b011f.zip
FreeBSD-src-1021d43b569bfc8d2c5544bde2f540fa432b011f.tar.gz
Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
Diffstat (limited to 'sys/netinet/ip_mroute.c')
-rw-r--r--sys/netinet/ip_mroute.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index d60e8bd..0476a36 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$");
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/time.h>
+#include <sys/vimage.h>
#include <net/if.h>
#include <net/netisr.h>
#include <net/route.h>
@@ -428,7 +429,7 @@ X_ip_mrouter_set(struct socket *so, struct sockopt *sopt)
struct bw_upcall bw_upcall;
uint32_t i;
- if (so != ip_mrouter && sopt->sopt_name != MRT_INIT)
+ if (so != V_ip_mrouter && sopt->sopt_name != MRT_INIT)
return EPERM;
error = 0;
@@ -654,7 +655,7 @@ if_detached_event(void *arg __unused, struct ifnet *ifp)
struct rtdetq *npq;
MROUTER_LOCK();
- if (ip_mrouter == NULL) {
+ if (V_ip_mrouter == NULL) {
MROUTER_UNLOCK();
}
@@ -720,7 +721,7 @@ ip_mrouter_init(struct socket *so, int version)
MROUTER_LOCK();
- if (ip_mrouter != NULL) {
+ if (V_ip_mrouter != NULL) {
MROUTER_UNLOCK();
return EADDRINUSE;
}
@@ -738,7 +739,7 @@ ip_mrouter_init(struct socket *so, int version)
expire_bw_upcalls_send, NULL);
callout_reset(&bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, NULL);
- ip_mrouter = so;
+ V_ip_mrouter = so;
MROUTER_UNLOCK();
@@ -763,7 +764,7 @@ X_ip_mrouter_done(void)
MROUTER_LOCK();
- if (ip_mrouter == NULL) {
+ if (V_ip_mrouter == NULL) {
MROUTER_UNLOCK();
return EINVAL;
}
@@ -771,7 +772,7 @@ X_ip_mrouter_done(void)
/*
* Detach/disable hooks to the reset of the system.
*/
- ip_mrouter = NULL;
+ V_ip_mrouter = NULL;
mrt_api_config = 0;
VIF_LOCK();
@@ -1449,7 +1450,7 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m,
mrtstat.mrts_upcalls++;
k_igmpsrc.sin_addr = ip->ip_src;
- if (socket_send(ip_mrouter, mm, &k_igmpsrc) < 0) {
+ if (socket_send(V_ip_mrouter, mm, &k_igmpsrc) < 0) {
log(LOG_WARNING, "ip_mforward: ip_mrouter socket queue full\n");
++mrtstat.mrts_upq_sockfull;
fail1:
@@ -1668,7 +1669,7 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif)
mrtstat.mrts_upcalls++;
k_igmpsrc.sin_addr = im->im_src;
- if (socket_send(ip_mrouter, mm, &k_igmpsrc) < 0) {
+ if (socket_send(V_ip_mrouter, mm, &k_igmpsrc) < 0) {
log(LOG_WARNING,
"ip_mforward: ip_mrouter socket queue full\n");
++mrtstat.mrts_upq_sockfull;
@@ -1829,7 +1830,7 @@ X_ip_rsvp_vif(struct socket *so, struct sockopt *sopt)
*/
if (!viftable[vifi].v_rsvp_on) {
viftable[vifi].v_rsvp_on = 1;
- rsvp_on++;
+ V_rsvp_on++;
}
} else { /* must be VIF_OFF */
/*
@@ -1844,7 +1845,7 @@ X_ip_rsvp_vif(struct socket *so, struct sockopt *sopt)
*/
if (viftable[vifi].v_rsvp_on) {
viftable[vifi].v_rsvp_on = 0;
- rsvp_on--;
+ V_rsvp_on--;
}
}
VIF_UNLOCK();
@@ -1873,7 +1874,7 @@ X_ip_rsvp_force_done(struct socket *so)
*/
if (viftable[vifi].v_rsvp_on) {
viftable[vifi].v_rsvp_on = 0;
- rsvp_on--;
+ V_rsvp_on--;
}
}
}
@@ -1890,13 +1891,13 @@ X_rsvp_input(struct mbuf *m, int off)
struct ifnet *ifp;
if (rsvpdebug)
- printf("rsvp_input: rsvp_on %d\n",rsvp_on);
+ printf("rsvp_input: rsvp_on %d\n",V_rsvp_on);
/* Can still get packets with rsvp_on = 0 if there is a local member
* of the group to which the RSVP packet is addressed. But in this
* case we want to throw the packet away.
*/
- if (!rsvp_on) {
+ if (!V_rsvp_on) {
m_freem(m);
return;
}
@@ -1928,7 +1929,7 @@ X_rsvp_input(struct mbuf *m, int off)
* then use it. Otherwise, drop packet since there
* is no specific socket for this vif.
*/
- if (ip_rsvpd != NULL) {
+ if (V_ip_rsvpd != NULL) {
if (rsvpdebug)
printf("rsvp_input: Sending packet up old-style socket\n");
rip_input(m, off); /* xxx */
@@ -2323,7 +2324,7 @@ bw_upcalls_send(void)
* XXX do we need to set the address in k_igmpsrc ?
*/
mrtstat.mrts_upcalls++;
- if (socket_send(ip_mrouter, m, &k_igmpsrc) < 0) {
+ if (socket_send(V_ip_mrouter, m, &k_igmpsrc) < 0) {
log(LOG_WARNING, "bw_upcalls_send: ip_mrouter socket queue full\n");
++mrtstat.mrts_upq_sockfull;
}
@@ -2677,7 +2678,7 @@ pim_register_send_upcall(struct ip *ip, struct vif *vifp,
mrtstat.mrts_upcalls++;
- if (socket_send(ip_mrouter, mb_first, &k_igmpsrc) < 0) {
+ if (socket_send(V_ip_mrouter, mb_first, &k_igmpsrc) < 0) {
if (mrtdebug & DEBUG_PIM)
log(LOG_WARNING,
"mcast: pim_register_send_upcall: ip_mrouter socket queue full");
@@ -3094,7 +3095,7 @@ ip_mroute_modevent(module_t mod, int type, void *unused)
* just loaded and then unloaded w/o starting up a user
* process we still need to cleanup.
*/
- if (ip_mrouter
+ if (V_ip_mrouter
#ifdef INET6
|| ip6_mrouter
#endif
OpenPOWER on IntegriCloud