Ohai not picking up any interfaces when an IPv6 gateway ending in :: is used


I’m seeing an issue with Ohai 8.11.1 (chef-client 12.8.1) where if there is an IP alias set up, no network interfaces are returned by Ohai:

# ifconfig -a
bond0     Link encap:Ethernet  HWaddr 0c:c4:7a:13:ae:02
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::ec4:7aff:fe13:ae02/64 Scope:Link
          RX packets:5202980 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7789857 errors:0 dropped:2 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2129596141 (2.1 GB)  TX bytes:1524177501 (1.5 GB)

bond0:0   Link encap:Ethernet  HWaddr 0c:c4:7a:13:ae:02
          inet addr:  Bcast:  Mask:
# ohai | grep -A 10 network
  "network": {
    "interfaces": {

    "default_interface": "bond0",
    "default_gateway": ""

Any advice on fixing this is appreciated as it makes the server appear to have no network interfaces in Chef Server.


This actually looks like it’s a bug in Ohai parsing an IPv6 address: https://gist.github.com/williamsjj/c6f5bbefa9d15e4b523b

Any advice on working around this?

It looks like the Ohai crashes when the gateway address ends in 0 and gets shortened to ::


And then discards ALL of the network info it didn’t have a problem with as well.


Just pinging to see if anyone else is seeing Ohai 8.11.1 blow up when the IPv6 gateway ends in ::? (as in 2604:1380:0:9900::slight_smile:


I’ve worked a lot in that code. It always feels risky changing it’s behavior because it feels very likely there will be unintended consequences, so we take it one use case at a time.

It’d be best if you filed a bug over at https://github.com/chef/ohai/issues with your platform, platform version, ohai version, output of ohai -l debug, and output of all these commands (linux, right?):

ip -f inet6 neigh show 
ip -o -f inet6 route show table main
ip -d -s link
ip addr

And of course any other information about your network setup that seems unique to you.

Alright. I’ll file it because the issue is not just that it’s just ignoring
the IPv6 gateway, it refuses to add ANY network interfaces (including IPv4)
on the box that it doesn’t have problem with too because of the exception
so node[:network][:interfaces] is empty.


Done: https://github.com/chef/ohai/issues/791