Don't use ip_mrtproto to determine whether multicast routing is in
the kernel; this was left over from the earlier protocol-dependent kernel multicast routing code. Learn how to handle the malloc'd multicast routing table (instead of expecting it to be in mbufs)
This commit is contained in:
parent
01b7c0826f
commit
67a451cc89
@ -42,7 +42,7 @@ char const copyright[] =
|
||||
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: main.c,v 1.21 1998/08/05 13:54:07 phk Exp $";
|
||||
"$Id: main.c,v 1.22 1998/08/08 08:13:04 phk Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -105,23 +105,21 @@ static struct nlist nl[] = {
|
||||
{ "_nfile" },
|
||||
#define N_FILE 18
|
||||
{ "_file" },
|
||||
#define N_MRTPROTO 19
|
||||
{ "_ip_mrtproto" },
|
||||
#define N_MRTSTAT 20
|
||||
#define N_MRTSTAT 19
|
||||
{ "_mrtstat" },
|
||||
#define N_MFCTABLE 21
|
||||
#define N_MFCTABLE 20
|
||||
{ "_mfctable" },
|
||||
#define N_VIFTABLE 22
|
||||
#define N_VIFTABLE 21
|
||||
{ "_viftable" },
|
||||
#define N_IPX 23
|
||||
#define N_IPX 22
|
||||
{ "_ipxpcb"},
|
||||
#define N_IPXSTAT 24
|
||||
#define N_IPXSTAT 23
|
||||
{ "_ipxstat"},
|
||||
#define N_SPXSTAT 25
|
||||
#define N_SPXSTAT 24
|
||||
{ "_spx_istat"},
|
||||
#define N_DDPSTAT 26
|
||||
#define N_DDPSTAT 25
|
||||
{ "_ddpstat"},
|
||||
#define N_DDPCB 27
|
||||
#define N_DDPCB 26
|
||||
{ "_ddpcb"},
|
||||
{ "" },
|
||||
};
|
||||
@ -390,11 +388,9 @@ main(argc, argv)
|
||||
if (gflag) {
|
||||
kread(0, 0, 0);
|
||||
if (sflag)
|
||||
mrt_stats(nl[N_MRTPROTO].n_value,
|
||||
nl[N_MRTSTAT].n_value);
|
||||
mrt_stats(nl[N_MRTSTAT].n_value);
|
||||
else
|
||||
mroutepr(nl[N_MRTPROTO].n_value,
|
||||
nl[N_MFCTABLE].n_value,
|
||||
mroutepr(nl[N_MFCTABLE].n_value,
|
||||
nl[N_VIFTABLE].n_value);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -62,14 +62,13 @@
|
||||
#include "netstat.h"
|
||||
|
||||
void
|
||||
mroutepr(mrpaddr, mfcaddr, vifaddr)
|
||||
u_long mrpaddr, mfcaddr, vifaddr;
|
||||
mroutepr(mfcaddr, vifaddr)
|
||||
u_long mfcaddr, vifaddr;
|
||||
{
|
||||
u_int mrtproto;
|
||||
struct mbuf *mfctable[MFCTBLSIZ];
|
||||
struct mfc *mfctable[MFCTBLSIZ];
|
||||
struct vif viftable[MAXVIFS];
|
||||
struct mbuf mb, *m;
|
||||
struct mfc smfc;
|
||||
struct mfc mfc, *m;
|
||||
register struct vif *v;
|
||||
register vifi_t vifi;
|
||||
register int i;
|
||||
@ -77,32 +76,8 @@ mroutepr(mrpaddr, mfcaddr, vifaddr)
|
||||
register int saved_nflag;
|
||||
vifi_t maxvif = 0;
|
||||
|
||||
if (mrpaddr == 0) {
|
||||
printf("ip_mrtproto: symbol not in namelist\n");
|
||||
return;
|
||||
}
|
||||
|
||||
kread(mrpaddr, (char *)&mrtproto, sizeof(mrtproto));
|
||||
switch (mrtproto) {
|
||||
|
||||
case 0:
|
||||
printf("no multicast routing compiled into this system\n");
|
||||
return;
|
||||
|
||||
case IGMP_DVMRP:
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("multicast routing protocol %u, unknown\n", mrtproto);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mfcaddr == 0) {
|
||||
printf("mfctable: symbol not in namelist\n");
|
||||
return;
|
||||
}
|
||||
if (vifaddr == 0) {
|
||||
printf("viftable: symbol not in namelist\n");
|
||||
if (mfcaddr == 0 || vifaddr == 0) {
|
||||
printf("No multicast routing compiled into this system.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -124,7 +99,8 @@ mroutepr(mrpaddr, mfcaddr, vifaddr)
|
||||
}
|
||||
|
||||
printf(" %2u %6u %4d %-15.15s",
|
||||
vifi, v->v_threshold, v->v_rate_limit,
|
||||
/* opposite math of add_vif() */
|
||||
vifi, v->v_threshold, v->v_rate_limit * 1000 / 1024,
|
||||
routename(v->v_lcl_addr.s_addr));
|
||||
printf(" %-15.15s", (v->v_flags & VIFF_TUNNEL) ?
|
||||
routename(v->v_rmt_addr.s_addr) : "");
|
||||
@ -139,8 +115,7 @@ mroutepr(mrpaddr, mfcaddr, vifaddr)
|
||||
for (i = 0; i < MFCTBLSIZ; ++i) {
|
||||
m = mfctable[i];
|
||||
while(m) {
|
||||
kread((u_long)m, (char *)&mb, sizeof mb);
|
||||
m = &mb;
|
||||
kread((u_long)m, (char *)&mfc, sizeof mfc);
|
||||
|
||||
if (!banner_printed) {
|
||||
printf("\nMulticast Forwarding Cache\n"
|
||||
@ -149,19 +124,17 @@ mroutepr(mrpaddr, mfcaddr, vifaddr)
|
||||
banner_printed = 1;
|
||||
}
|
||||
|
||||
kread((u_long)mtod(m, char *),
|
||||
(char *)&smfc, sizeof smfc);
|
||||
printf(" %-15.15s", routename(smfc.mfc_origin.s_addr));
|
||||
printf(" %-15.15s", routename(smfc.mfc_mcastgrp.s_addr));
|
||||
printf(" %9lu", smfc.mfc_pkt_cnt);
|
||||
printf(" %3d ", smfc.mfc_parent);
|
||||
printf(" %-15.15s", routename(mfc.mfc_origin.s_addr));
|
||||
printf(" %-15.15s", routename(mfc.mfc_mcastgrp.s_addr));
|
||||
printf(" %9lu", mfc.mfc_pkt_cnt);
|
||||
printf(" %3d ", mfc.mfc_parent);
|
||||
for (vifi = 0; vifi <= maxvif; vifi++) {
|
||||
if (smfc.mfc_ttls[vifi] > 0)
|
||||
if (mfc.mfc_ttls[vifi] > 0)
|
||||
printf(" %u:%u", vifi,
|
||||
smfc.mfc_ttls[vifi]);
|
||||
mfc.mfc_ttls[vifi]);
|
||||
}
|
||||
printf("\n");
|
||||
m = m->m_act;
|
||||
m = mfc.mfc_next;
|
||||
}
|
||||
}
|
||||
if (!banner_printed)
|
||||
@ -173,33 +146,13 @@ mroutepr(mrpaddr, mfcaddr, vifaddr)
|
||||
|
||||
|
||||
void
|
||||
mrt_stats(mrpaddr, mstaddr)
|
||||
u_long mrpaddr, mstaddr;
|
||||
mrt_stats(mstaddr)
|
||||
u_long mstaddr;
|
||||
{
|
||||
u_int mrtproto;
|
||||
struct mrtstat mrtstat;
|
||||
|
||||
if(mrpaddr == 0) {
|
||||
printf("ip_mrtproto: symbol not in namelist\n");
|
||||
return;
|
||||
}
|
||||
|
||||
kread(mrpaddr, (char *)&mrtproto, sizeof(mrtproto));
|
||||
switch (mrtproto) {
|
||||
case 0:
|
||||
printf("no multicast routing compiled into this system\n");
|
||||
return;
|
||||
|
||||
case IGMP_DVMRP:
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("multicast routing protocol %u, unknown\n", mrtproto);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mstaddr == 0) {
|
||||
printf("mrtstat: symbol not in namelist\n");
|
||||
printf("No multicast routing compiled into this system.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,6 @@ void tp_protopr __P((u_long, char *));
|
||||
void tp_inproto __P((u_long));
|
||||
void tp_stats __P((caddr_t, caddr_t));
|
||||
|
||||
void mroutepr __P((u_long, u_long, u_long));
|
||||
void mrt_stats __P((u_long, u_long));
|
||||
void mroutepr __P((u_long, u_long));
|
||||
void mrt_stats __P((u_long));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user