Skip to content
Open
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
13 changes: 10 additions & 3 deletions plugins/main/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"sort"
"syscall"
"time"
"strings"

"github.com/vishvananda/netlink"

Expand Down Expand Up @@ -456,9 +457,15 @@ func setupVeth(
return nil, nil, fmt.Errorf("failed to setup hairpin mode for %v: %v", hostVeth.Attrs().Name, err)
}

// set isolation mode
if err = netlink.LinkSetIsolated(hostVeth, portIsolation); err != nil {
return nil, nil, fmt.Errorf("failed to set isolated on for %v: %v", hostVeth.Attrs().Name, err)
if portIsolation {
name := hostVeth.Attrs().Name
if strings.HasPrefix(name, "veth") || strings.HasPrefix(name, "vnet") || strings.HasPrefix(name, "tap") {
if err = netlink.LinkSetIsolated(hostVeth, true); err != nil {
fmt.Fprintf(os.Stderr, "[WARN] Failed to set isolated on %s: %v\n", name, err)
} else {
fmt.Fprintf(os.Stderr, "[DEBUG] Isolation set on %s\n", name)
}
}
}

if (vlanID != 0 || len(vlans) > 0) && !preserveDefaultVlan {
Expand Down
Loading