cvs commit: src/usr.bin/netstat atalk.c bpf.c if.c inet.c inet6.c ipsec.c ipx.c main.c mbuf.c mcast.c mroute.c mroute6.c netgraph.c netstat.h pfkey.c route.c sctp.c unix.c

John Baldwin jhb at
Mon Jul 16 17:15:56 UTC 2007

jhb         2007-07-16 17:15:55 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/netstat      atalk.c bpf.c if.c inet.c inet6.c ipsec.c 
                         ipx.c main.c mbuf.c mcast.c mroute.c 
                         mroute6.c netgraph.c netstat.h pfkey.c 
                         route.c sctp.c unix.c 
  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
  - 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
  - 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)
  Revision  Changes    Path
  1.26      +4 -2      src/usr.bin/netstat/atalk.c
  1.9       +1 -0      src/usr.bin/netstat/bpf.c
  1.69      +13 -9     src/usr.bin/netstat/if.c
  1.78      +306 -97   src/usr.bin/netstat/inet.c
  1.29      +51 -43    src/usr.bin/netstat/inet6.c
  1.17      +6 -4      src/usr.bin/netstat/ipsec.c
  1.26      +4 -4      src/usr.bin/netstat/ipx.c
  1.86      +134 -83   src/usr.bin/netstat/main.c
  1.53      +2 -2      src/usr.bin/netstat/mbuf.c
  1.9       +1 -0      src/usr.bin/netstat/mcast.c
  1.30      +16 -27    src/usr.bin/netstat/mroute.c
  1.21      +16 -26    src/usr.bin/netstat/mroute6.c
  1.13      +6 -1      src/usr.bin/netstat/netgraph.c
  1.51      +45 -43    src/usr.bin/netstat/netstat.h
  1.5       +3 -1      src/usr.bin/netstat/pfkey.c
  1.82      +1 -0      src/usr.bin/netstat/route.c
  1.5       +13 -10    src/usr.bin/netstat/sctp.c
  1.20      +133 -19   src/usr.bin/netstat/unix.c

More information about the cvs-src mailing list