Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: Skip inet6 addresses matching ::1 #1838

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ohai/plugins/freebsd/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
end
end
if line =~ /\s+inet6 ([a-f0-9\:]+)%?(\w*)\s+prefixlen\s+(\d+)\s*\w*\s*([\da-fx]*)/
next if $1 == "::1"

Check failure on line 71 in lib/ohai/plugins/freebsd/network.rb

View workflow job for this annotation

GitHub Actions / chefstyle

[Correctable] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the right approach. Is ::1 the only inet6 line in your ifconfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I have fe80 addresses on all the interfaces and those are properly excluded.

Sometimes ::1 is on lo1 and not lo0, but it should always see my inet6 addresses starting with 2600 first and it doesn't pick them up. It always takes the ::1 as the default address for some strange reason.

On a very vanilla out-of-the-box FreeBSD install with IPv6 enabled Chef will pick up ::1 as the IPv6 address. This is the only way I found to fix it.

iface[cint][:addresses] ||= Mash.new
if $4.empty?
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $3 }
Expand Down
Loading