Skip to content

Commit

Permalink
enable routes for ipv6 (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
hopkiw authored Mar 21, 2022
1 parent a592540 commit 19e16b1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions google_guest_agent/addresses.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 Google Inc. All Rights Reserved.
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -442,7 +442,7 @@ func (a *addressMgr) set() error {
return nil
}

// Enables or disables IPv6 on the primary interface.
// Enables or disables IPv6 on network interfaces.
func configureIPv6() error {
var newNi, oldNi networkInterfaces
if len(newMetadata.Instance.NetworkInterfaces) == 0 {
Expand Down Expand Up @@ -561,6 +561,13 @@ func enableNetworkInterfaces() error {
if len(googleIpv6Interfaces) == 0 {
return nil
}
for _, iface := range googleIpv6Interfaces {
// Enable kernel to accept to route advertisements.
val := fmt.Sprintf("net.ipv6.conf.%s.accept_ra_rt_info_max_plen=128", iface)
if err := runCmd(exec.Command("sysctl", val)); err != nil {
return err
}
}

var dhclientArgs6 []string
dhclientArgs6 = append([]string{"-6"}, googleIpv6Interfaces...)
Expand Down

0 comments on commit 19e16b1

Please sign in to comment.