Skip to content

Commit

Permalink
libnetwork: support mode option for bridge
Browse files Browse the repository at this point in the history
L2 will be used to allow using existing bridges which netavark will
neither create nor delete.

Signed-off-by: Michael Zimmermann <[email protected]>
  • Loading branch information
M1cha committed Nov 13, 2024
1 parent 305e9ce commit cbfbe24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libnetwork/netavark/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ func (n *netavarkNetwork) networkCreate(newNetwork *types.Network, defaultNet bo
if len(value) == 0 {
return nil, errors.New("invalid vrf name")
}
case types.ModeOption:
if !slices.Contains(types.ValidBridgeModes, value) {
return nil, fmt.Errorf("unknown bridge mode %q", value)
}
default:
return nil, fmt.Errorf("unsupported bridge network option %s", key)
}
Expand Down
3 changes: 3 additions & 0 deletions libnetwork/types/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ const (
Netavark NetworkBackend = "netavark"
)

// ValidBridgeModes is the list of valid mode options for the bridge driver
var ValidBridgeModes = []string{IPVLANModeL2, IPVLANModeL3}

// ValidMacVLANModes is the list of valid mode options for the macvlan driver
var ValidMacVLANModes = []string{MacVLANModeBridge, MacVLANModePrivate, MacVLANModeVepa, MacVLANModePassthru}

Expand Down

0 comments on commit cbfbe24

Please sign in to comment.