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

lxd/network/driver/bridge: Improve comments for accept_ra #12501

Merged
merged 1 commit into from
Nov 4, 2023
Merged
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
10 changes: 9 additions & 1 deletion lxd/network/driver_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,13 +1147,21 @@ func (n *bridge) setup(oldConfig map[string]string) error {
return err
}

// First set accept_ra to 2 for everything.
// First set accept_ra to 2 for all interfaces (if not disabled).
// This ensures that the host can still receive IPv6 router advertisements even with
// forwarding enabled (which enable below), as the default is to ignore router adverts
// when forward is enabled, and this could render the host unreachable if it uses
// SLAAC generated IPs.
for _, entry := range entries {
// Check that IPv6 router advertisement acceptance is enabled currently.
// If its set to 0 then we don't want to enable, and if its already set to 2 then
// we don't need to do anything.
content, err := os.ReadFile(fmt.Sprintf("/proc/sys/net/ipv6/conf/%s/accept_ra", entry.Name()))
if err == nil && string(content) != "1\n" {
continue
}

// If IPv6 router acceptance is enabled (set to 1) then we now set it to 2.
err = util.SysctlSet(fmt.Sprintf("net/ipv6/conf/%s/accept_ra", entry.Name()), "2")
if err != nil && !os.IsNotExist(err) {
return err
Expand Down
Loading