Skip to content

Commit 35b5f32

Browse files
committed
Update bridge.go, setup_ipv6.go
Signed-off-by: mostolog <[email protected]>
1 parent cc9c97c commit 35b5f32

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

drivers/bridge/bridge.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
10301030
if config.NDPProxyInterface != "" && config.EnableIPv6 {
10311031
link, err := d.nlh.LinkByName(config.NDPProxyInterface)
10321032
if err != nil {
1033-
return err
1033+
return fmt.Errorf("could not find link for ndp proxy interface %q: %v", config.NDPProxyInterface, err)
10341034
}
10351035
neighbor := netlink.Neigh{
10361036
LinkIndex: link.Attrs().Index,
@@ -1109,7 +1109,9 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
11091109
// Also make sure defer does not see this error either.
11101110
if n.config.NDPProxyInterface != "" && n.config.EnableIPv6 {
11111111
link, err := d.nlh.LinkByName(n.config.NDPProxyInterface)
1112-
if err == nil {
1112+
if err != nil {
1113+
Logrus.Warnf("could not remove ndp neighbour, because could not find link for ndp proxy interface %q: %v", config.NDPProxyInterface, err)
1114+
} else {
11131115
neighbor := netlink.Neigh{
11141116
LinkIndex: link.Attrs().Index,
11151117
Family: netlink.FAMILY_V6,

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)