diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-24 09:18:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-24 09:18:52 +0000 |
commit | 97903bd358992530d458fc14acf81f79b85c2061 (patch) | |
tree | ad513831d23d240448365372bc5baff0b6591c7c /usr.bin/netstat | |
parent | 2356f80f0b2c081a1f1f8ba650a52de77ea8f346 (diff) |
do not print a non-existant mfc
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/mroute.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index a398f6858dd..1d00b3dc6db 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -1,4 +1,4 @@ -/* $NetBSD: mroute.c,v 1.9 1995/10/03 21:42:42 thorpej Exp $ */ +/* $NetBSD: mroute.c,v 1.10 1996/05/11 13:51:27 mycroft Exp $ */ /* * Copyright (c) 1989 Stephen Deering @@ -167,31 +167,33 @@ mroutepr(mrpaddr, mfchashtbladdr, mfchashaddr, vifaddr) banner_printed = 0; nmfc = 0; - for (i = 0; i <= mfchash; ++i) { - kread((u_long)&mfchashtbl[i], (char *)&mfcp, sizeof(mfcp)); - - for (; mfcp != 0; mfcp = mfc.mfc_hash.le_next) { - if (!banner_printed) { - printf("\nMulticast Forwarding Cache\n %s%s", - "Hash Origin Mcastgroup ", - "Traffic In-Vif Out-Vifs/Forw-ttl\n"); - banner_printed = 1; + if (mfchashtbl != 0) + for (i = 0; i <= mfchash; ++i) { + kread((u_long)&mfchashtbl[i], (char *)&mfcp, sizeof(mfcp)); + + for (; mfcp != 0; mfcp = mfc.mfc_hash.le_next) { + if (!banner_printed) { + printf("\nMulticast Forwarding Cache\n %s%s", + "Hash Origin Mcastgroup ", + "Traffic In-Vif Out-Vifs/Forw-ttl\n"); + banner_printed = 1; + } + + kread((u_long)mfcp, (char *)&mfc, sizeof(mfc)); + printf(" %3u %-15.15s", + i, routename(mfc.mfc_origin.s_addr)); + printf(" %-15.15s %7s %3u ", + routename(mfc.mfc_mcastgrp.s_addr), + pktscale(mfc.mfc_pkt_cnt), mfc.mfc_parent); + for (vifi = 0; vifi <= numvifs; ++vifi) + if (mfc.mfc_ttls[vifi]) + printf(" %u/%u", vifi, + mfc.mfc_ttls[vifi]); + + printf("\n"); + nmfc++; } - - kread((u_long)mfcp, (char *)&mfc, sizeof(mfc)); - printf(" %3u %-15.15s", - i, routename(mfc.mfc_origin.s_addr)); - printf(" %-15.15s %7s %3u ", - routename(mfc.mfc_mcastgrp.s_addr), - pktscale(mfc.mfc_pkt_cnt), mfc.mfc_parent); - for (vifi = 0; vifi <= numvifs; ++vifi) - if (mfc.mfc_ttls[vifi]) - printf(" %u/%u", vifi, mfc.mfc_ttls[vifi]); - - printf("\n"); - nmfc++; } - } if (!banner_printed) printf("\nMulticast Forwarding Cache is empty\n"); else |