Skip to content

Commit ad10b6f

Browse files
authored
Merge pull request #484 from squeed/disable-ra
ptp, bridge: disable accept_ra on the host-side interface
2 parents f7a2fc9 + 219eb9e commit ad10b6f

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

pkg/ip/link_linux.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ import (
2121
"net"
2222
"os"
2323

24-
"github.com/containernetworking/plugins/pkg/ns"
25-
"github.com/containernetworking/plugins/pkg/utils/hwaddr"
2624
"github.com/safchain/ethtool"
2725
"github.com/vishvananda/netlink"
26+
27+
"github.com/containernetworking/plugins/pkg/ns"
28+
"github.com/containernetworking/plugins/pkg/utils/hwaddr"
29+
"github.com/containernetworking/plugins/pkg/utils/sysctl"
2830
)
2931

3032
var (
@@ -158,6 +160,9 @@ func SetupVethWithName(contVethName, hostVethName string, mtu int, hostNS ns.Net
158160
if err = netlink.LinkSetUp(hostVeth); err != nil {
159161
return fmt.Errorf("failed to set %q up: %v", hostVethName, err)
160162
}
163+
164+
// we want to own the routes for this interface
165+
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_ra", hostVethName), "0")
161166
return nil
162167
})
163168
if err != nil {

plugins/main/bridge/bridge.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"github.com/containernetworking/plugins/pkg/ns"
3737
"github.com/containernetworking/plugins/pkg/utils"
3838
bv "github.com/containernetworking/plugins/pkg/utils/buildversion"
39+
"github.com/containernetworking/plugins/pkg/utils/sysctl"
3940
)
4041

4142
// For testcases to force an error after IPAM has been performed
@@ -248,6 +249,9 @@ func ensureBridge(brName string, mtu int, promiscMode, vlanFiltering bool) (*net
248249
return nil, err
249250
}
250251

252+
// we want to own the routes for this interface
253+
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_ra", brName), "0")
254+
251255
if err := netlink.LinkSetUp(br); err != nil {
252256
return nil, err
253257
}

0 commit comments

Comments
 (0)