From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZzjSW-0003av-BU for mharc-grub-devel@gnu.org; Fri, 20 Nov 2015 06:02:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzjSQ-0003aN-D7 for grub-devel@gnu.org; Fri, 20 Nov 2015 06:02:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzjSN-0002fQ-5B for grub-devel@gnu.org; Fri, 20 Nov 2015 06:02:22 -0500 Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:33709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzjSM-0002eg-Ta for grub-devel@gnu.org; Fri, 20 Nov 2015 06:02:19 -0500 Received: by lfaz4 with SMTP id z4so66662733lfa.0 for ; Fri, 20 Nov 2015 03:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=/rTLnJ8J0Msfm2Sr+tVEu1/JuZ0282kSTbzyHibp2rY=; b=JxTdXKz0lkQNFEkxxnqguB94c13+Y/lqtDFluIgSynYC7YvqdS4Pefe86kCwahyPWQ mbasrK4GTyLczhligduzNHn2lT0FkdbtX2IP857otuBKRnYQPUgzX6ExxE91HbqEj79a /tGoIgHM7Wi/IGcsxIf2eiJYqN6kH+vSMH8dotSK+FSD1A7rlHu+UkW7jgw/Vcq9I4pc G+pmRkMGB4fEG+xCAeHtij00FqkfBsKK7bWnE7S7o5flxaoZL+nzHJwTXccWnVLtc2W2 uChXgMkeIIbE4H/YnxE78sYjjX8xRPWfNHFOHnbt4fKHrK+An8MKKdnxxa3icVcGF02Z ovmw== X-Received: by 10.25.40.138 with SMTP id o132mr5547397lfo.148.1448017337733; Fri, 20 Nov 2015 03:02:17 -0800 (PST) Received: from [192.168.1.41] (ppp91-76-25-247.pppoe.mtu-net.ru. [91.76.25.247]) by smtp.gmail.com with ESMTPSA id v1sm1864796lfd.25.2015.11.20.03.02.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 Nov 2015 03:02:16 -0800 (PST) Subject: Re: [PATCH] efinet: filter multicast traffic based on addresses To: The development of GNU GRUB , kernel-team@fb.com References: <1447785313-1383440-1-git-send-email-jbacik@fb.com> From: Andrei Borzenkov Message-ID: <564EFDB7.8060009@gmail.com> Date: Fri, 20 Nov 2015 14:02:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1447785313-1383440-1-git-send-email-jbacik@fb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c07::22c Cc: Josef Bacik X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2015 11:02:26 -0000 17.11.2015 21:35, Josef Bacik пишет: > We have some hardware that claims to support PROMISCUOUS_MULTICAST but doesn't > actually work. Instead utilize the multicast filters and specifically enable > the multicast traffic we care about. In reality we only care about ipv6 > multicast traffic but enable ipv4 multicast as well just in case. Whenever we > add a new address to the card we calculate the solicited node multicast address > to the multicast filter. With this patch my broken hardware is still broken but > functional. Thanks, > > Signed-off-by: Josef Bacik > --- > grub-core/net/drivers/efi/efinet.c | 84 ++++++++++++++++++++++++++++++++++---- > grub-core/net/net.c | 2 + > include/grub/net.h | 54 ++++++++++++------------ > 3 files changed, 105 insertions(+), 35 deletions(-) > > diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c > index c8f80a1..bbbadd2 100644 > --- a/grub-core/net/drivers/efi/efinet.c > +++ b/grub-core/net/drivers/efi/efinet.c > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include > > GRUB_MOD_LICENSE ("GPLv3+"); > > @@ -183,8 +184,9 @@ open_card (struct grub_net_card *dev) > We need unicast and broadcast and additionaly all nodes and > solicited multicast for IPv6. Solicited multicast is per-IPv6 > address and we currently do not have API to do it so simply > - try to enable receive of all multicast packets or evertyhing in > - the worst case (i386 PXE driver always enables promiscuous too). > + enable the all node addresses and the link local address. We do this > + because some firmware has been found to not do promiscuous multicast > + mode properly. > > This does trust firmware to do what it claims to do. > */ > @@ -192,14 +194,25 @@ open_card (struct grub_net_card *dev) > { > grub_uint32_t filters = GRUB_EFI_SIMPLE_NETWORK_RECEIVE_UNICAST | > GRUB_EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST | > - GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST; > + GRUB_EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST; > + grub_efi_status_t st; > + grub_efi_mac_address_t mac_filter[2] = { > + { 0x1, 0, 0x5e, 0, 0, 1, }, > + { 0x33, 0x33, 0, 0, 0, 1, },}; > > filters &= net->mode->receive_filter_mask; > - if (!(filters & GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST)) > - filters |= (net->mode->receive_filter_mask & > - GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS); > - could you do a favor and test whether enabling lone GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS (without any additional filters flags) works for you? I.e. just do efi_call_6 (net->receive_filters, net, GRUB_EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS, 0, 0, 0, NULL); It is possible that attempt to set promiscuous together with other filters does not work. I still believe it is better workaround in general to avoid increasing complexity.