Deleted Added
sdiff udiff text old ( 166952 ) new ( 171465 )
full compact
1/*
2 * Copyright (C) 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 53 unchanged lines hidden (view full) ---

62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)mroute.c 8.2 (Berkeley) 4/28/95
67 */
68
69#include <sys/cdefs.h>
70__FBSDID("$FreeBSD: head/usr.bin/netstat/mroute6.c 166952 2007-02-24 21:58:30Z bms $");
71
72#ifdef INET6
73#include <sys/param.h>
74#include <sys/queue.h>
75#include <sys/socket.h>
76#include <sys/socketvar.h>
77#include <sys/sysctl.h>
78#include <sys/protosw.h>

--- 32 unchanged lines hidden (view full) ---

111 int i;
112 int banner_printed;
113 int saved_numeric_addr;
114 mifi_t maxmif = 0;
115 long int waitings;
116 size_t len;
117
118 len = sizeof(mif6table);
119 if (sysctlbyname("net.inet6.ip6.mif6table", mif6table, &len,
120 NULL, 0) < 0) {
121 warn("sysctl: net.inet6.ip6.mif6table");
122 if (mifaddr == 0) {
123 printf("No IPv6 multicast forwarding configured in "
124 "the running system.\n");
125 return;
126 }
127 kread(mifaddr, (char *)mif6table, sizeof(mif6table));
128 }
129
130 saved_numeric_addr = numeric_addr;
131 numeric_addr = 1;
132 banner_printed = 0;
133
134 for (mifi = 0, mifp = mif6table; mifi < MAXMIFS; ++mifi, ++mifp) {
135 struct ifnet ifnet;
136 char ifname[IFNAMSIZ];

--- 19 unchanged lines hidden (view full) ---

156
157 printf(" %9ju %9ju\n", (uintmax_t)mifp->m6_pkt_in,
158 (uintmax_t)mifp->m6_pkt_out);
159 }
160 if (!banner_printed)
161 printf("\nIPv6 Multicast Interface Table is empty\n");
162
163 len = sizeof(mf6ctable);
164 if (sysctlbyname("net.inet6.ip6.mf6ctable", mf6ctable, &len,
165 NULL, 0) < 0) {
166 warn("sysctl: net.inet6.ip6.mf6ctable");
167 if (mfcaddr == 0) {
168 printf("No IPv6 multicast forwarding configured in "
169 "the running system.\n");
170 return;
171 }
172 /*
173 * XXX: Try KVM if the module is neither compiled nor loaded.
174 * The correct behaviour would be to always use KVM if
175 * the -M option is specified to netstat(1).
176 */
177 kread(mfcaddr, (char *)mf6ctable, sizeof(mf6ctable));
178 }
179
180 banner_printed = 0;
181
182 for (i = 0; i < MF6CTBLSIZ; ++i) {
183 mfcp = mf6ctable[i];
184 while(mfcp) {
185 kread((u_long)mfcp, (char *)&mfc, sizeof(mfc));
186 if (!banner_printed) {

--- 40 unchanged lines hidden (view full) ---

227}
228
229void
230mrt6_stats(u_long mstaddr)
231{
232 struct mrt6stat mrtstat;
233 size_t len = sizeof mrtstat;
234
235 if (sysctlbyname("net.inet6.ip6.mrt6stat", &mrtstat, &len,
236 NULL, 0) < 0) {
237 warn("sysctl: net.inet6.ip6.mrt6stat");
238 if (mstaddr == 0) {
239 printf("No IPv6 multicast forwarding configured in the "
240 "running system.\n");
241 return;
242 }
243 kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat));
244 }
245 printf("IPv6 multicast forwarding:\n");
246
247#define p(f, m) if (mrtstat.f || sflag <= 1) \
248 printf(m, (uintmax_t)mrtstat.f, plural(mrtstat.f))
249#define p2(f, m) if (mrtstat.f || sflag <= 1) \
250 printf(m, (uintmax_t)mrtstat.f, plurales(mrtstat.f))
251
252 p(mrt6s_mfc_lookups, "\t%ju multicast forwarding cache lookup%s\n");

--- 19 unchanged lines hidden ---