Skip to content

Commit 825d75d

Browse files
Michael ZappaMichael Zappa
authored andcommitted
Add boolean to enable/disable dad
Signed-off-by: Michael Zappa <[email protected]>
1 parent b2f348e commit 825d75d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugins/main/bridge/bridge.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type NetConf struct {
5656
PromiscMode bool `json:"promiscMode"`
5757
Vlan int `json:"vlan"`
5858
MacSpoofChk bool `json:"macspoofchk,omitempty"`
59+
EnableDad bool `json:"enabledad,omitempty"`
5960

6061
Args struct {
6162
Cni BridgeArgs `json:"cni,omitempty"`
@@ -501,7 +502,11 @@ func cmdAdd(args *skel.CmdArgs) error {
501502

502503
// Configure the container hardware address and IP address(es)
503504
if err := netns.Do(func(_ ns.NetNS) error {
504-
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_dad", args.IfName), "0")
505+
if n.EnableDad {
506+
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_dad", args.IfName), "1")
507+
} else {
508+
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_dad", args.IfName), "0")
509+
}
505510
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv4/conf/%s/arp_notify", args.IfName), "1")
506511

507512
// Add the IP to the interface

0 commit comments

Comments
 (0)