Skip to content
jc-rs
GitHub

ifconfig

--ifconfigv2.4.0

Converts `ifconfig` command output to JSON

LinuxmacOSFreeBSDcommandslurpable
$ ifconfig | jc-rs --ifconfig

A real pair

From the reference corpus (freebsd12/ifconfig-extra-fields3.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

ifconfigfreebsd12
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
     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
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "name": "cxl3",
    "flags": 8843,
    "state": [
      "UP",
      "BROADCAST",
      "RUNNING",
      "SIMPLEX",
      "MULTICAST"
    ],
    "mtu": 1500,
    "type": null,
    "mac_addr": "00:07:43:3d:b7:70",
    "ipv4_addr": null,
    "ipv4_mask": null,
    "ipv4_bcast": null,
    "ipv6_addr": null,
    "ipv6_mask": null,
    "ipv6_scope": null,
    "ipv6_type": null,
    "metric": 0,
    "rx_packets": null,
    "rx_errors": null,
    "rx_dropped": null,
    "rx_overruns": null,
    "rx_frame": null,
    "tx_packets": null,
    "tx_errors": null,
    "tx_dropped": null,
    "tx_overruns": null,
    "tx_carrier": null,
    "tx_collisions": null,
    "rx_bytes": null,
    "tx_bytes": null,
    "options": "6ec07bb",
    "options_flags": [
      "RXCSUM",
      "TXCSUM",
      "VLAN_MTU",
      "VLAN_HWTAGGING",
      "JUMBO_MTU",
      "VLAN_HWCSUM",
      "TSO4",
      "TSO6",
      "LRO",
      "VLAN_HWTSO",
      "LINKSTATE",
      "RXCSUM_IPV6",
      "TXCSUM_IPV6",
      "HWRXTSTMP",
      "NOMAP"
    ],
    "hw_address": "00:07:43:3d:b7:88",
    "media": null,
    "media_flags": null,
    "status": "active",
    "nd6_options": 29,
    "nd6_flags": [
      "PERFORMNUD",
      "IFDISABLED",
      "AUTO_LINKLOCAL"
    ],
    "plugged": "SFP/SFP+/SFP28 10G Base-LR (LC)",
    "vendor": "INNOLIGHT",
    "vendor_pn": "TR-PX13L-N00",
    "vendor_sn": "INJBL0431986",
    "vendor_date": "2020-01-04",
    "module_temperature": "21.20 C",
    "module_voltage": "3.16 Volts",
    "lanes": [
      {
        "lane": 1,
        "rx_power_mw": 0.49,
        "rx_power_dbm": -3.1,
        "tx_bias_ma": 23.85
      }
    ]
  }
]

Fixture coverage

9/9oracle-valid pairs match under the published structural JSON comparison

Magic syntax

jc-rs ifconfigjc-rs runs the command itself and parses what it prints. Recognised for: `ifconfig`

Source: crates/jc-rs-parsers/src/network/ifconfig.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare