Bug 246626

Summary: netstat -g IPv4 Virtual Interface Table data wrong
Product: Base System Reporter: Ozkan KIRIK <ozkan.kirik>
Component: kernAssignee: Bjoern A. Zeeb <bz>
Status: Closed FIXED    
Severity: Affects Some People CC: bz
Priority: --- Keywords: regression
Version: 12.1-STABLEFlags: bz: mfc-stable12?
bz: mfc-stable11-
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246629
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206583

Description Ozkan KIRIK 2020-05-21 10:21:45 UTC
I'm not runnging any daemons on system. No multicast software or router running. But netstat output is scrambled.

# uname -a
FreeBSD test.test.com 12.1-STABLE FreeBSD 12.1-STABLE #8 1f999e39f46(v2)-dirty: Wed Apr 22 08:40:36 +03 2020    test@test.test.com:/usr/obj/usr/src/amd64.amd64/sys/amd64

# netstat -g
IPv4 Virtual Interface Table
 Vif   Thresh   Local-Address   Remote-Address    Pkts-In   Pkts-Out
  0       192   1.248.255.255                           0          0
  5       137   0.254.255.255                   18446741874692295056  18446741874692295040

IPv4 Multicast Forwarding Table is empty


IPv6 Multicast Interface Table is empty

IPv6 Multicast Forwarding Table is empty
Comment 1 Ozkan KIRIK 2020-05-23 06:43:38 UTC
There is no problem FreeBSD 12.1-p5

Latest SVN base/stable/12 kernel produces this problem.
Comment 2 Ozkan KIRIK 2020-05-23 11:58:31 UTC
Problem started after this commit:
https://svnweb.freebsd.org/base?view=revision&revision=356621
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2020-05-24 00:11:59 UTC
Notify committer of r356621.
Comment 4 Ozkan KIRIK 2020-10-10 18:20:35 UTC
problem still exists on FreeBSD stable/12, even on 12.2
Comment 5 Bjoern A. Zeeb freebsd_committer freebsd_triage 2020-10-10 23:09:17 UTC
Sorry, the apparent Cc: on a bug report never reached my personal attention.

Confirmed it.  Not sure it'll make 12.2 anymore; really sorry about it.

I'll have a look and fix this; I guess quickly switching this to SYSCTL_PROC will do; need to test stuff again with mrouting however as well.
Comment 6 commit-hook freebsd_committer freebsd_triage 2020-10-11 00:01:53 UTC
A commit references this bug:

Author: bz
Date: Sun Oct 11 00:01:00 UTC 2020
New revision: 366623
URL: https://svnweb.freebsd.org/changeset/base/366623

Log:
  ip_mroute: fix the viftable export sysctl

  It seems that in r354857 I got more than one thing wrong.
  Convert the SYSCTL_OPAQUE to a SYSCTL_PROC to properly export the these
  days allocated and not longer static per-vnet viftable array.
  This fixes a problem with netstat -g which would show bogus information
  for the IPv4 Virtual Interface Table.

  PR:		246626
  Reported by:	Ozkan KIRIK (ozkan.kirik gmail.com)
  MFC after:	3 days

Changes:
  head/sys/netinet/ip_mroute.c
Comment 7 commit-hook freebsd_committer freebsd_triage 2020-11-05 13:43:20 UTC
A commit references this bug:

Author: bz
Date: Thu Nov  5 13:43:07 UTC 2020
New revision: 367381
URL: https://svnweb.freebsd.org/changeset/base/367381

Log:
  MFC r366623:

   ip_mroute: fix the viftable export sysctl

    It seems that in r354857 I got more than one thing wrong.
    Convert the SYSCTL_OPAQUE to a SYSCTL_PROC to properly export the these
    days allocated and not longer static per-vnet viftable array.
    This fixes a problem with netstat -g which would show bogus information
    for the IPv4 Virtual Interface Table.

  PR:		246626

Changes:
_U  stable/12/
  stable/12/sys/netinet/ip_mroute.c
Comment 8 Bjoern A. Zeeb freebsd_committer freebsd_triage 2020-11-05 13:55:28 UTC
Thanks a lot for reporting and tracking the commit down!
Sorry that the fix was delayed.
Comment 9 Ozkan KIRIK 2020-11-12 11:48:32 UTC
Thank you