@@ -18,7 +18,6 @@ import (
18
18
"encoding/json"
19
19
"errors"
20
20
"fmt"
21
- "io/ioutil"
22
21
"net"
23
22
"os"
24
23
"runtime"
@@ -402,20 +401,6 @@ func setupBridge(n *NetConf) (*netlink.Bridge, *current.Interface, error) {
402
401
}, nil
403
402
}
404
403
405
- // disableIPV6DAD disables IPv6 Duplicate Address Detection (DAD)
406
- // for an interface, if the interface does not support enhanced_dad.
407
- // We do this because interfaces with hairpin mode will see their own DAD packets
408
- func disableIPV6DAD (ifName string ) error {
409
- // ehanced_dad sends a nonce with the DAD packets, so that we can safely
410
- // ignore ourselves
411
- enh , err := ioutil .ReadFile (fmt .Sprintf ("/proc/sys/net/ipv6/conf/%s/enhanced_dad" , ifName ))
412
- if err == nil && string (enh ) == "1\n " {
413
- return nil
414
- }
415
- f := fmt .Sprintf ("/proc/sys/net/ipv6/conf/%s/accept_dad" , ifName )
416
- return ioutil .WriteFile (f , []byte ("0" ), 0644 )
417
- }
418
-
419
404
func enableIPForward (family int ) error {
420
405
if family == netlink .FAMILY_V4 {
421
406
return ip .EnableIP4Forward ()
@@ -516,18 +501,7 @@ func cmdAdd(args *skel.CmdArgs) error {
516
501
517
502
// Configure the container hardware address and IP address(es)
518
503
if err := netns .Do (func (_ ns.NetNS ) error {
519
- // Disable IPv6 DAD just in case hairpin mode is enabled on the
520
- // bridge. Hairpin mode causes echos of neighbor solicitation
521
- // packets, which causes DAD failures.
522
- for _ , ipc := range result .IPs {
523
- if ipc .Address .IP .To4 () == nil && (n .HairpinMode || n .PromiscMode ) {
524
- if err := disableIPV6DAD (args .IfName ); err != nil {
525
- return err
526
- }
527
- break
528
- }
529
- }
530
-
504
+ _ , _ = sysctl .Sysctl (fmt .Sprintf ("net/ipv6/conf/%s/accept_dad" , args .IfName ), "0" )
531
505
_ , _ = sysctl .Sysctl (fmt .Sprintf ("net/ipv4/conf/%s/arp_notify" , args .IfName ), "1" )
532
506
533
507
// Add the IP to the interface
0 commit comments