return 0;
}
+static int nw_port_vlan_validate(nw_port* port) {
+ // Check if the VLAN ID is within range
+ if (port->vlan.id < NW_VLAN_ID_MIN || port->vlan.id > NW_VLAN_ID_MAX) {
+ ERROR("%s: Invalid VLAN ID %d\n", port->name, port->vlan.id);
+ return 1;
+ }
+
+ // Validate protocol
+ switch (port->vlan.proto) {
+ case NW_VLAN_PROTO_8021Q:
+ case NW_VLAN_PROTO_8021AD:
+ break;
+
+ default:
+ ERROR("%p: Invalid VLAN protocol\n", port->name);
+ return 1;
+ }
+
+ return 0;
+}
+
static int nw_port_vlan_create_link(nw_port* port, sd_netlink_message* m) {
int r;
// Configuration
.setup = nw_port_vlan_setup,
+ .validate = nw_port_vlan_validate,
.get_parent_port = nw_port_get_vlan_parent,