]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
tools/libs/light: Add vlan field to libxl_device_nic
authorLeigh Brown <leigh@solinno.co.uk>
Wed, 8 May 2024 21:38:20 +0000 (22:38 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 15 May 2024 18:59:52 +0000 (19:59 +0100)
Add `vlan' string field to libxl_device_nic, to allow a VLAN
configuration to be specified for the VIF when adding it to the
bridge device.

Update libxl_nic.c to read and write the vlan field from the
xenstore.

This provides the capability for supported operating systems (e.g.
Linux) to perform VLAN filtering on bridge ports.  The Xen
hotplug scripts need to be updated to read this information from
the xenstore and perform the required configuration.

Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
tools/libs/light/libxl_nic.c
tools/libs/light/libxl_types.idl

index d6bf06fc34069424e41fb6d07af965280d7a40e1..d861e3726db26081fbb4c66b6a09f6084df87b13 100644 (file)
@@ -233,6 +233,11 @@ static int libxl__set_xenstore_nic(libxl__gc *gc, uint32_t domid,
         flexarray_append(back, GCSPRINTF("%u", nic->mtu));
     }
     
+    if (nic->vlan) {
+        flexarray_append(back, "vlan");
+        flexarray_append(back, libxl__strdup(gc, nic->vlan));
+    }
+
     flexarray_append(back, "bridge");
     flexarray_append(back, libxl__strdup(gc, nic->bridge));
     flexarray_append(back, "handle");
@@ -313,6 +318,11 @@ static int libxl__nic_from_xenstore(libxl__gc *gc, const char *libxl_path,
         nic->mtu = LIBXL_DEVICE_NIC_MTU_DEFAULT;
     }
 
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
+                                GCSPRINTF("%s/vlan", libxl_path),
+                               (const char **)(&nic->vlan));
+    if (rc) goto out;
+
     rc = libxl__xs_read_checked(gc, XBT_NULL,
                                 GCSPRINTF("%s/mac", libxl_path), &tmp);
     if (rc) goto out;
index 470122e76898016a402d4778f8862189baba0468..79e9c656cc0e2ffce63b407b49a2fd7a0ef0ba61 100644 (file)
@@ -817,6 +817,7 @@ libxl_device_nic = Struct("device_nic", [
     ("backend_domname", string),
     ("devid", libxl_devid),
     ("mtu", integer),
+    ("vlan", string),
     ("model", string),
     ("mac", libxl_mac),
     ("ip", string),