* Use sysctlbyname(3) to print statistics about the MFC and

multicast VIF tables.
  This change is needed for consistency with the rest of the
  netstat/mroute.c implementation, and because in some
  cases "netstat -g" may fail to report the multicast forwarding
  information (e.g., if we run a multicast router on PicoBSD).

* Remove "DVMRP" from the head comment of file netstat/mroute.c,
  because the printed multicast-related statistics are not
  DVMRP-specific anymore.

Submitted by:	Pavlin Radoslavov <pavlin@icir.org>
This commit is contained in:
Jeffrey Hsu 2003-08-05 17:07:04 +00:00
parent 1b6002ec30
commit 0ae2b7649e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118502

View File

@ -43,7 +43,7 @@ static const char rcsid[] =
#endif /* not lint */
/*
* Print DVMRP multicast routing structures and statistics.
* Print multicast routing structures and statistics.
*
* MROUTING 1.0
*/
@ -80,16 +80,35 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
int banner_printed;
int saved_numeric_addr;
vifi_t maxvif = 0;
size_t len;
if (mfcaddr == 0 || vifaddr == 0) {
printf("No IPv4 multicast routing compiled into this system.\n");
return;
len = sizeof(mfctable);
if (sysctlbyname("net.inet.ip.mfctable", mfctable, &len, NULL, 0) < 0) {
warn("sysctl: net.inet.ip.mfctable");
/* Compatability with older kernels - candidate for removal */
if (mfcaddr == 0) {
printf("No IPv4 multicast routing compiled into this system.\n");
return;
}
kread(mfcaddr, (char *)mfctable, sizeof(mfctable));
}
len = sizeof(viftable);
if (sysctlbyname("net.inet.ip.viftable", viftable, &len, NULL, 0) < 0) {
warn("sysctl: net.inet.ip.viftable");
/* Compatability with older kernels - candidate for removal */
if (vifaddr == 0) {
printf("No IPv4 multicast routing compiled into this system.\n");
return;
}
kread(vifaddr, (char *)viftable, sizeof(viftable));
}
saved_numeric_addr = numeric_addr;
numeric_addr = 1;
kread(vifaddr, (char *)&viftable, sizeof(viftable));
banner_printed = 0;
for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) {
if (v->v_lcl_addr.s_addr == 0)
@ -115,7 +134,6 @@ mroutepr(u_long mfcaddr, u_long vifaddr)
if (!banner_printed)
printf("\nVirtual Interface Table is empty\n");
kread(mfcaddr, (char *)&mfctable, sizeof(mfctable));
banner_printed = 0;
for (i = 0; i < MFCTBLSIZ; ++i) {
m = mfctable[i];