Skip to content

Commit

Permalink
Add boolean to enable/disable dad
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Zappa <Michael.Zappa@stateless.net>
  • Loading branch information
Michael Zappa authored and Michael Zappa committed Feb 9, 2022
1 parent b2f348e commit 825d75d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/main/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type NetConf struct {
PromiscMode bool `json:"promiscMode"`
Vlan int `json:"vlan"`
MacSpoofChk bool `json:"macspoofchk,omitempty"`
EnableDad bool `json:"enabledad,omitempty"`

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

// Configure the container hardware address and IP address(es)
if err := netns.Do(func(_ ns.NetNS) error {
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_dad", args.IfName), "0")
if n.EnableDad {
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_dad", args.IfName), "1")
} else {
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv6/conf/%s/accept_dad", args.IfName), "0")
}
_, _ = sysctl.Sysctl(fmt.Sprintf("net/ipv4/conf/%s/arp_notify", args.IfName), "1")

// Add the IP to the interface
Expand Down

0 comments on commit 825d75d

Please sign in to comment.