Skip to content

Commit

Permalink
Merge pull request #732 from stgraber/network
Browse files Browse the repository at this point in the history
Relax restrictions on extended syntax for bridge.external_interfaces
  • Loading branch information
hallyn authored Apr 4, 2024
2 parents bb69873 + de81e4c commit dbfe053
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doc/reference/network_bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ Key | Type | Condition | Defau
`user.*` | string | - | - | User-provided free-form key/value pairs

```{note}
The `bridge.external_interfaces` option supports extended format for the external interfaces when using the `native` driver. The extended format is `<interfaceName>/<parentInterfaceName>/<vlanId>`. When the external interface is added to the list with the extended format, the system will automatically create the interface upon the network's creation and subsequently delete it when the network is terminated. The system verifies that the <interfaceName> does not already exist. If the interface name is in use with a different parent or VLAN ID, or if the creation of the interface is unsuccessful, the system will revert with an error message.
The `bridge.external_interfaces` option supports an extended format allowing the creation of missing VLAN interfaces.
The extended format is `<interfaceName>/<parentInterfaceName>/<vlanId>`.
When the external interface is added to the list with the extended format, the system will automatically create the interface upon the network's creation and subsequently delete it when the network is terminated. The system verifies that the <interfaceName> does not already exist. If the interface name is in use with a different parent or VLAN ID, or if the creation of the interface is unsuccessful, the system will revert with an error message.
```

(network-bridge-features)=
Expand Down
2 changes: 1 addition & 1 deletion internal/server/network/driver_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ func (n *bridge) setup(oldConfig map[string]string) error {
ifParent := ""
vlanID := 0

if len(entryParts) == 3 && n.config["bridge.driver"] == "native" {
if len(entryParts) == 3 {
vlanID, err = strconv.Atoi(entryParts[2])
if err != nil || vlanID < 1 || vlanID > 4094 {
vlanID = 0
Expand Down

0 comments on commit dbfe053

Please sign in to comment.