dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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