Skip to content

Commit 907282e

Browse files
authored
Update setup_ipv6.go
1 parent 0a716d4 commit 907282e

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

drivers/bridge/setup_ipv6.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const (
2020
ipv6ForwardConfAll = "/proc/sys/net/ipv6/conf/all/forwarding"
2121
ndpProxyConfPerm = 0644
2222
ndpProxyConfDefault = "/proc/sys/net/ipv6/conf/default/proxy_ndp"
23-
ndpProxyConfAll = "/proc/sys/net/ipv6/conf/all/proxy_ndp"
2423
)
2524

2625
func init() {
@@ -133,17 +132,12 @@ func setupNDPProxying(config *networkConfiguration, i *bridgeInterface) error {
133132
logrus.Warnf("Unable to enable NDP default proxying: %v", err)
134133
}
135134
}
136-
137-
// Get current NDP all proxying setup
138-
ndpProxyDataAll, err := ioutil.ReadFile(ndpProxyConfAll)
139-
if err != nil {
140-
return fmt.Errorf("Cannot read NDP all proxying setup: %v", err)
141-
}
142-
// Enable NDP all proxying only if it is not already enabled
143-
if ndpProxyDataAll[0] != '1' {
144-
if err := ioutil.WriteFile(ndpProxyConfAll, []byte{'1', '\n'}, ndpProxyConfPerm); err != nil {
145-
logrus.Warnf("Unable to enable NDP all proxying: %v", err)
146-
}
135+
136+
// Get interface with proxy_ndp enabled.
137+
ndpProxyConfPath := fmt.Sprintf("/proc/sys/net/ipv6/conf/%s/proxy_ndp", config.NDPProxyInterface)
138+
// Enable NDP proxying only if it is not already enabled
139+
if err := ioutil.WriteFile(ndpProxyConfPath, []byte{'1', '\n'}, ndpProxyConfPerm); err != nil {
140+
logrus.Warnf("Unable to enable NDP proxying for interface %s: %v", config.NDPProxyInterface,err)
147141
}
148142

149143
return nil

0 commit comments

Comments
 (0)