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

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