BridgeVLANSetDefaultPVID sets the VLAN default port VLAN ID (PVID).
(interfaceName string, vlanID string)
| 43 | |
| 44 | // BridgeVLANSetDefaultPVID sets the VLAN default port VLAN ID (PVID). |
| 45 | func BridgeVLANSetDefaultPVID(interfaceName string, vlanID string) error { |
| 46 | err := os.WriteFile(fmt.Sprintf("/sys/class/net/%s/bridge/default_pvid", interfaceName), []byte(vlanID), 0) |
| 47 | if err != nil { |
| 48 | return fmt.Errorf("Failed setting bridge VLAN default PVID for %q: %w", interfaceName, err) |
| 49 | } |
| 50 | |
| 51 | return nil |
| 52 | } |
| 53 | |
| 54 | // IsNativeBridge returns whether the bridge name specified is a Linux native bridge. |
| 55 | func IsNativeBridge(bridgeName string) bool { |