question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ifconfig parsing of freebsd silently skips most fields

See original GitHub issue

I’m trying to use jc to parse ifconfig output from a variety of FreeBSD systems. Unfortunately, most of the fields in the command output are being silently skipped by jc:

>>> import jc.parsers.ifconfig
>>> ifc0 = '''cxl3: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
...     options=6ec07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6,HWRXTSTMP,NOMAP>
...     ether 00:07:43:3d:b7:70
...     hwaddr 00:07:43:3d:b7:88
...     media: Ethernet 10Gbase-LR <full-duplex,rxpause,txpause>
...     status: active
...     nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
...     plugged: SFP/SFP+/SFP28 10G Base-LR (LC)
...     vendor: INNOLIGHT PN: TR-PX13L-N00 SN: INJBL0431986 DATE: 2020-01-04
...     module temperature: 21.20 C voltage: 3.16 Volts
...     lane 1: RX power: 0.49 mW (-3.10 dBm) TX bias: 23.85 mA'''
>>> r0 = jc.parsers.ifconfig.parse(ifc0)
>>> r0
[{'name': 'cxl3', 'flags': 8843, 'state': ['UP', 'BROADCAST', 'RUNNING', 'SIMPLEX', 'MULTICAST'], 'metric': 0, 'mtu': 1500, 'mac_addr': '00:07:43:3d:b7:70', 'type': None, 'ipv4_addr': None, 'ipv4_bcast': None, 'ipv4_mask': None, 'ipv6_addr': None, 'ipv6_mask': None, 'ipv6_scope': None, 'rx_packets': None, 'rx_errors': None, 'rx_dropped': None, 'rx_overruns': None, 'rx_frame': None, 'tx_packets': None, 'tx_errors': None, 'tx_dropped': None, 'tx_overruns': None, 'tx_carrier': None, 'tx_collisions': None, 'rx_bytes': None, 'tx_bytes': None}]

Its unclear whether this is a bug, or expected behavior?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
netllamacommented, Nov 28, 2022

Apologies for the delay responding here, I was travelling for much of the past month.

The lane line is not vendor specific, and does refer to optical attenuation metrics. The lane is an integer. Here are a few more examples:

net3: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	description: mce3
	options RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6,HWSTATS,TXRTLMT,HWRXTSTMP,MEXTPG,VXLAN_HWCSUM,VXLAN_HWTSO
	ether 00:07:43:5d:5a:30
	hwaddr 0c:42:a1:b4:56:1d
	media: Ethernet 10Gbase-LR <full-duplex,rxpause,txpause>
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	plugged: SFP/SFP+/SFP28 10G Base-LR (LC)
	vendor: INNOLIGHT PN: TR-PX13L-N00 SN: INKBU0371003 DATE: 2020-11-21
	module temperature: 37.36 C voltage: 3.28 Volts
	lane 1: RX power: 0.91 mW (-0.42 dBm) TX bias: 29.76 mA
mce0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWFILTER,VLAN_HWTSO,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6,HWSTATS,TXRTLMT,HWRXTSTMP,MEXTPG,TXTLS4,TXTLS6,VXLAN_HWCSUM,VXLAN_HWTSO,TXTLS_RTLMT,RXTLS4,RXTLS6
	ether 0c:42:a1:2b:03:74
	inet 23.246.26.130 netmask 0xffffff80 broadcast 23.246.26.255
	inet6 fe80::e42:a1ff:fe2b:374%mce0 prefixlen 64 scopeid 0x4
	inet6 2a00:86c0:1026:1026::130 prefixlen 64
	media: Ethernet 100GBase-SR4 <full-duplex,rxpause,txpause>
	status: active
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
	plugged: QSFP28 Unknown (MPO 1x12 Parallel Optic)
	vendor: INNOLIGHT PN: TR-FC85S-N00 SN: INKAT2930248 DATE: 2020-05-20
	module temperature: 49.41 C voltage: 3.29 Volts
	lane 1: RX power: 0.98 mW (-0.11 dBm) TX bias: 7.60 mA
	lane 2: RX power: 0.98 mW (-0.07 dBm) TX bias: 7.60 mA
	lane 3: RX power: 1.01 mW (0.03 dBm) TX bias: 7.60 mA
	lane 4: RX power: 0.92 mW (-0.34 dBm) TX bias: 7.60 mA
0reactions
kellyjonbrazilcommented, Nov 28, 2022

Thanks! I should be able to add the lane lines to the next release of jc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 32. Firewalls | FreeBSD Documentation Portal
FreeBSD has three firewalls built into the base system: PF, IPFW, and IPFILTER. This chapter covers how to define packet filtering rules, ...
Read more >
ipfw(8) - FreeBSD
-s [field] When listing pipes, sort according to one of the four counters (total or current packets or bytes). -t When listing, show...
Read more >
ifconfig(8) - FreeBSD
The ifconfig utility must be used at boot time to define the network address of each interface ... See the prefixlen parameter below...
Read more >
pf.conf(5) - FreeBSD Manual Pages
For example: set fingerprints "/etc/pf.os.devel" set skip on <ifspec> List ... generate their dont-fragment packets with a zero IP identification field.
Read more >
FreeBSD Network Administrators Guide
If you already know how IP routing works and how address resolution is performed, you can skip this chapter. Chapter 3., Configuringthe NetworkingHardware, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found