Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions plugins/main/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,10 +1016,14 @@ func cmdCheck(args *skel.CmdArgs) error {
}
defer netns.Close()

// run the IPAM plugin and get back the config to apply
err = ipam.ExecCheck(n.IPAM.Type, args.StdinData)
if err != nil {
return err
isLayer3 := n.IPAM.Type != ""

if isLayer3 {
// run the IPAM plugin and get back the config to apply
err = ipam.ExecCheck(n.IPAM.Type, args.StdinData)
if err != nil {
return err
}
}

// Parse previous result.
Expand Down
14 changes: 12 additions & 2 deletions plugins/main/bridge/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1835,8 +1835,10 @@ func cmdAddDelCheckTest(origNS, targetNS ns.NetNS, tc testCase, dataDir string)
err = json.Unmarshal([]byte(confString), &conf)
Expect(err).NotTo(HaveOccurred())

conf.IPAM, _, err = allocator.LoadIPAMConfig([]byte(confString), "")
Expect(err).NotTo(HaveOccurred())
if !tc.isLayer2 {
conf.IPAM, _, err = allocator.LoadIPAMConfig([]byte(confString), "")
Expect(err).NotTo(HaveOccurred())
}

newConf, err := buildOneConfig("testConfig", tc.cniVersion, conf, prevResult)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -2718,6 +2720,14 @@ var _ = Describe("bridge Operations", func() {
cmdAddDelCheckTest(originalNS, targetNS, tc, dataDir)
})
}

It(fmt.Sprintf("[%s] configures and deconfigures a l2 bridge and veth with ADD/DEL/CHECK", ver), func() {
tc := testCase{
cniVersion: ver,
isLayer2: true,
}
cmdAddDelCheckTest(originalNS, targetNS, tc, dataDir)
})
}

It(fmt.Sprintf("[%s] configures mac spoof-check (no mac spoofing)", ver), func() {
Expand Down
Loading