Repository navigation
Use the shared BSD netstat parser for NetBSD network interfaces - #3807
Conversation
NetBsdNetworkIF read netstat -bI and -iI by fixed column position and gave up when the link-level row had fewer than six fields. Rows with no address, such as lo0 and npflog0, have five, so those interfaces reported no traffic at all. NetBSD's format is OpenBSD's: -bnI prints only the byte counts, and -nI the packet, Ierrs/Oerrs and Colls columns. BsdNetworkIF already handles that, matching values to headings from the end of the row, so NetBSD now uses it and NetBsdNetworkIF is removed. Tested with output captured on NetBSD 10.1.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3807 +/- ##
============================================
- Coverage 80.89% 80.85% -0.05%
- Complexity 418 644 +226
============================================
Files 725 725
Lines 25981 25981
Branches 4416 4416
============================================
- Hits 21017 21006 -11
- Misses 2744 2756 +12
+ Partials 2220 2219 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
NetBsdNetworkIFreadnetstat -bIandnetstat -iIby fixed column position and returned without updating when the link-level row had fewer than six fields. Interfaces with no link-level address print five, so they reported no traffic. From cfarm428 (NetBSD 10.1):lo0andnpflog0both read as zero on master.NetBSD's
netstatformat is the oneBsdNetworkIFalready handles for OpenBSD:-bnIprints onlyIbytes/Obytes, and-nIprintsIpkts Ierrs Opkts Oerrs Colls.BsdNetworkIF.parseNetstatmaps values to headings from the end of the row, which is what makes an empty Address column harmless. So NetBSD's hardware layer now usesBsdNetworkIF,NetBsdNetworkIFis removed, and the javadoc and comments inBsdNetworkIFname NetBSD. The class lived in an implementation package, notoshi.hardware, and is not@PublicApi.Verification
BsdNetworkIFTest.testParseNetstatNetBsduses output captured on cfarm428:vioif0with-bnIand-nI, the address-lesslo0row, andnpflog0.oshi-common,oshi-core,oshi-core-ffmincluding-Perror-prone. Nothing else referenced the removed class, including the comparison tests.Summary by CodeRabbit
netstatoutput.