Skip to contentSkip to conversation

efinet: Skip virtual VLAN devices during card enumeration

PATCH In review Michael Chang via Grub-devel 2 participants 2 messages Oct 3, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efinet: Skip virtual VLAN devices during card enumeration

Similar to the fix in commit "c52ae4057 efinet: skip virtual IPv4 and IPv6 devices during card enumeration", the UEFI PXE driver creates additional VLAN child devices when a VLAN ID is configured on a network interface associated with a physical NIC. These virtual VLAN devices must be skipped during card enumeration to ensure that the subsequent SNP exclusive open operation targets the correct physical card instances, otherwise packet transfer would fail.

Example device path with VLAN nodes:

/MAC(123456789ABC,0x1)/Vlan(20)/IPv4(0.0.0.0,0x0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)

---
 grub-core/net/drivers/efi/efinet.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
grub-core/net/drivers/efi/efinet.c +11 -1
index 3ea25cf98..58fe381ab 100644
@@ -276,7 +276,8 @@ grub_efinet_findcards (void)
 	      || GRUB_EFI_DEVICE_PATH_SUBTYPE (child) == GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)
 	  && parent
 	  && GRUB_EFI_DEVICE_PATH_TYPE (parent) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
-	  && GRUB_EFI_DEVICE_PATH_SUBTYPE (parent) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)
+	  && (GRUB_EFI_DEVICE_PATH_SUBTYPE (parent) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE
+	      || GRUB_EFI_DEVICE_PATH_SUBTYPE (parent) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE))
 	continue;
 
       net = grub_efi_open_protocol (*handle, &net_io_guid,
@@ -389,6 +390,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
 	dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
 	dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
 	dup_ldp->length = sizeof (*dup_ldp);
+
+	dup_ldp = grub_efi_find_last_device_path (dup_dp);
+	if (GRUB_EFI_DEVICE_PATH_SUBTYPE (dup_ldp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE)
+	  {
+	    dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
+	    dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
+	    dup_ldp->length = sizeof (*dup_ldp);
+	  }
+
 	match = grub_efi_compare_device_paths (dup_dp, cdp) == 0;
 	grub_free (dup_dp);
 	if (!match)
Signature · 7 lines
2.46.1


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Michael Chang via Grub-devel

Similar to the fix in commit "c52ae4057 efinet: skip virtual IPv4 and IPv6 devices during card enumeration", the UEFI PXE driver creates additional VLAN child devices when a VLAN ID is configured on a network interface associated with a physical NIC. These virtual VLAN devices must be skipped during card enumeration to ensure that the subsequent SNP exclusive open operation targets the correct physical card instances, otherwise packet transfer would fail.

Quoted 5 lines

Example device path with VLAN nodes:

/MAC(123456789ABC,0x1)/Vlan(20)/IPv4(0.0.0.0,0x0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel