History log of /freebsd-10.1-release/usr.bin/netstat/mroute.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 263335 19-Mar-2014 glebius

Merge r259562,r259566,r259638,r259645,r260124 by melifaro:

Switch netstat -rn to use standard API for retrieving list
of routes instead of peeking inside in-kernel radix via kget.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 253084 09-Jul-2013 ae

Migrate structs arpstat, icmpstat, mrtstat, pimstat and udpstat to PCPU
counters.


# 253081 09-Jul-2013 ae

Prepare network statistics structures for migration to PCPU counters.
Use uint64_t as type for all fields of structures.

Changed structures: ahstat, arpstat, espstat, icmp6_ifstat, icmp6stat,
in6_ifstat, ip6stat, ipcompstat, ipipstat, ipsecstat, mrt6stat, mrtstat,
pfkeystat, pim6stat, pimstat, rip6stat, udpstat.

Discussed with: arch@


# 191356 21-Apr-2009 bms

Bracket struct mfc and struct rtdetq with #ifdef _KERNEL.
Match the bracketing in netstat.
Since the cleanup of MROUTING, ports have broken because they
expect to include <netinet/ip_mroute.h> without including
<sys/queue.h>. Fix breakage at source.

The real fix, of course, is to fix the MROUTING APIs by blowing them
away and replacing them with something else...


# 190024 19-Mar-2009 bms

Fix size_t merge-o.


# 190012 18-Mar-2009 bms

Introduce a number of changes to the MROUTING code.
This is purely a forwarding plane cleanup; no control plane
code is involved.

Summary:
* Split IPv4 and IPv6 MROUTING support. The static compile-time
kernel option remains the same, however, the modules may now
be built for IPv4 and IPv6 separately as ip_mroute_mod and
ip6_mroute_mod.
* Clean up the IPv4 multicast forwarding code to use BSD queue
and hash table constructs. Don't build our own timer abstractions
when ratecheck() and timevalclear() etc will do.
* Expose the multicast forwarding cache (MFC) and virtual interface
table (VIF) as sysctls, to reduce netstat's dependence on libkvm
for this information for running kernels.
* bandwidth meters however still require libkvm.
* Make the MFC hash table size a boot/load-time tunable ULONG,
net.inet.ip.mfchashsize (defaults to 256).
* Remove unused members from struct vif and struct mfc.
* Kill RSVP support, as no current RSVP implementation uses it.
These stubs could be moved to raw_ip.c.
* Don't share locks or initialization between IPv4 and IPv6.
* Don't use a static struct route_in6 in ip6_mroute.c.
The v6 code is still using a cached struct route_in6, this is
moved to mif6 for the time being.
* More cleanup remains to be merged from ip_mroute.c to ip6_mroute.c.

v4 path tested using ports/net/mcast-tools.
v6 changes are mostly mechanical locking and *have not* been tested.
As these changes partially break some kernel ABIs, they will not
be MFCed. There is a lot more work to be done here.

Reviewed by: Pavlin Radoslavov


# 175061 02-Jan-2008 obrien

style(9)
+ kread is not a boolean, so check it as such
+ fix $FreeBSD$ Ids
+ denote copyrights with /*-
+ misc whitespace changes.


# 171465 16-Jul-2007 jhb

Restore netstat -M functionality for most statistics on core dumps. In
general, when support was added to netstat for fetching data using sysctl,
no provision was left for fetching equivalent data from a core dump, and
in fact, netstat would _always_ fetch data from the live kernel using
sysctl even when -M was specified resulting in the user believing they
were getting data from coredumps when they actually weren't. Some specific
changes:
- Add a global 'live' variable that is true if netstat is running against
the live kernel and false if -M has been specified.
- Stop abusing the sysctl flag in the protocol tables to hold the protocol
number. Instead, the protocol is now its own field in the tables, and
it is passed as a separate parameter to the PCB and stat routines rather
than overloading the KVM offset parameter.
- Don't run PCB or stats functions who don't have a namelist offset if we
are being run against a crash dump (!live).
- For the inet and unix PCB routines, we generate the same buffer from KVM
that the sysctl usually generates complete with the header and trailer.
- Don't run bpf stats for !live (before it would just silently always run
live).
- kread() no longer trashes memory when opening the buffer if there is an
error on open and the passed in buffer is smaller than _POSIX2_LINE_MAX.
- The multicast routing code doesn't fallback to kvm on live kernels if
the sysctl fails. Keeping this made the code rather hairy, and netstat
is already tied to the kernel ABI anyway (even when using sysctl's since
things like xinpcb contain an inpcb) so any kernels this is run against
that have the multicast routing stuff should have the sysctls.
- Don't try to dig around in the kernel linker in the netgraph PCB routine
for core dumps.

Other notes:
- sctp's PCB routine only works on live kernels, it looked rather
complicated to generate all the same stuff via KVM. Someone can always
add it later if desired though.
- Fix the ipsec removal bug where N_xxx for IPSEC stats weren't renumbered.
- Use sysctlbyname() everywhere rather than hardcoded mib values.

MFC after: 1 week
Approved by: re (rwatson)


# 166951 24-Feb-2007 bms

Use the names 'IPv4' and 'Forwarding Table' in program output, not
'Routing Table', to be consistent with what the code actually does and is.


# 166950 24-Feb-2007 bms

Add comments about where netstat is using KVM to read things which
should really be available via sysctl for a running system.


# 166869 21-Feb-2007 bms

Change wording of warnings when there is no ip_mroute.ko module
loaded into the system.
Change wording of comments to reflect the fact we should unconditionally
use KVM if the -M option is used to specify a core file.
Add comments to document the fact that IPv6 multicast forwarding
information display still relies on KVM for gathering information.


# 162797 29-Sep-2006 bms

Nits.

Submitted by: ru


# 162794 29-Sep-2006 bms

Push removal of mrouted down to the rest of the tree.


# 160787 28-Jul-2006 yar

Achieve WARNS=2 by using uintmax_t to pass around 64-bit quantities,
including to printf(). Using uintmax_t is also robust to further
extensions in both the C language and the bitwidth of kernel counters.

Tested on: i386 amd64 ia64


# 160781 28-Jul-2006 yar

Both fields of struct timeval are of a non-basic type,
so we should cast them to a type printf() knows about.


# 132671 26-Jul-2004 charnier

Add __FBSDID. Replace local variable sin by sockin to not conflict with sin(3).
Use warnx() instead of warn() when error message is not of any interest. Add
prototypes.


# 118627 07-Aug-2003 hsu

1. Add support for printing PIM-related statistics with
netstat -s -p pim

2. Print information about the bandwidth meters installed in the kernel with
netstat -g

Submitted by: Pavlin Radoslavov <pavlin@icir.org>


# 118502 05-Aug-2003 hsu

* 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>


# 102975 05-Sep-2002 dwmalone

Warns cleanups for netstat:
1) Include arpa/inet.h for ntohs.
2) Constness fixes.
3) Fix shadowing except for "sin" which shouldn't be in scope.
4) Remove register keyword.
5) Add missing initialsers to user defined structs.
5) Make prototype of netname6 globally visable.
6) Use right macros for printing syncache stats (even though entrie isn't
a word).


# 83204 07-Sep-2001 ru

If -s -s is specified, don't show zero multicast routing statistics.


# 80351 25-Jul-2001 fenner

Use sysctl to export multicast routing stats


# 78314 15-Jun-2001 assar

remove K&R support


# 78309 15-Jun-2001 assar

revert removal of warning and K&R support

Requested by: bde


# 78245 14-Jun-2001 assar

remove most of the warnings


# 78238 14-Jun-2001 assar

add the option -S for printing port numbers symbolically but addresses
numerically. clean up the CFLAGS in Makefile.


# 62584 04-Jul-2000 itojun

sync with latest kame netstat. basically, more statistics


# 56722 28-Jan-2000 shin

IPv6 multicast routing.
kernel IPv6 multicast routing support.
pim6 dense mode daemon
pim6 sparse mode daemon
netstat support of IPv6 multicast routing statistics

Merging to the current and testing with other existing multicast routers
is done by Tatsuya Jinmei <jinmei@kame.net>, who writes and maintainances
the base code in KAME distribution.

Make world check and kernel build check was also successful.


# 52415 21-Oct-1999 julian

Cleanup towards -Wall


# 42778 18-Jan-1999 fenner

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)


# 21263 03-Jan-1997 wollman

Update to match changes in <net/if.h> and <netinet/ip_mroute.h>.


# 20287 10-Dec-1996 wollman

Fix up programs which expect <net/if.h> to include <sys/time.h> to instead
do it themselves. (Some of these programs actually depended on this
beyond compiling the definition of struct ifinfo!) Also fix up some
other #include messes while we're at it.


# 16080 02-Jun-1996 alex

Code cleanup: remove unused variables, use correct *printf format
specifiers (some unsigned values were printed as signed, some longs
were printed as ints), and place parentheses around assignments in
if statements.


# 14543 11-Mar-1996 dg

Move #include of queue.h before #include of socketvar.h in preparation for
struct socket changes.


# 13430 14-Jan-1996 peter

Merge in Lite-2 changes.


# 9215 13-Jun-1995 wollman

Re-write `netstat -g' code to match the 3.5 data structures.


# 2553 07-Sep-1994 wollman

Tell netstat about the new multicast forwarding statistics. For the moment,
don't try to do any multicast forwarding cache printouts; it's not clear
that netstat can do anything particularly useful or meaningful.


# 1591 27-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1590,
which included commits to RCS files with non-trunk default branches.


# 1590 27-May-1994 rgrimes

BSD 4.4 Lite Usr.bin Sources