Blame SOURCES/0184-efinet-add-filter-for-the-first-exclusive-reopen-of-.patch

f731ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f731ee
From: RHEL Ninjas <example@example.com>
f731ee
Date: Fri, 25 Sep 2015 16:24:23 +0900
f731ee
Subject: [PATCH] efinet: add filter for the first exclusive reopen of SNP
f731ee
f731ee
---
f731ee
 grub-core/net/drivers/efi/efinet.c | 24 ++++++++++++++++++++++++
f731ee
 1 file changed, 24 insertions(+)
f731ee
f731ee
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
f731ee
index c3a128cd1dc..d8099a59855 100644
f731ee
--- a/grub-core/net/drivers/efi/efinet.c
f731ee
+++ b/grub-core/net/drivers/efi/efinet.c
f731ee
@@ -407,6 +407,30 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
f731ee
       if (net->mode->state == GRUB_EFI_NETWORK_STARTED
f731ee
 	  && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
f731ee
 	continue;
f731ee
+
f731ee
+      /* Enable hardware receive filters if driver declares support for it.
f731ee
+	 We need unicast and broadcast and additionaly all nodes and
f731ee
+	 solicited multicast for IPv6. Solicited multicast is per-IPv6
f731ee
+	 address and we currently do not have API to do it so simply
f731ee
+	 try to enable receive of all multicast packets or evertyhing in
f731ee
+	 the worst case (i386 PXE driver always enables promiscuous too).
f731ee
+
f731ee
+	 This does trust firmware to do what it claims to do.
f731ee
+       */
f731ee
+      if (net->mode->receive_filter_mask)
f731ee
+	{
f731ee
+	  grub_uint32_t filters = GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST   |
f731ee
+				  GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST |
f731ee
+				  GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
f731ee
+
f731ee
+	  filters &= net->mode->receive_filter_mask;
f731ee
+	  if (!(filters & GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST))
f731ee
+	    filters |= (net->mode->receive_filter_mask &
f731ee
+			GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS);
f731ee
+
f731ee
+	  efi_call_6 (net->receive_filters, net, filters, 0, 0, 0, NULL);
f731ee
+	}
f731ee
+
f731ee
       card->efi_net = net;
f731ee
     }
f731ee
     return;