Received: from list by lists.gnu.org with archive (Exim 4.71) id 1W9IVG-0001OX-8h for mharc-grub-devel@gnu.org; Fri, 31 Jan 2014 13:07:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9IV6-0001KP-Va for grub-devel@gnu.org; Fri, 31 Jan 2014 13:07:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9IUz-0005MI-BT for grub-devel@gnu.org; Fri, 31 Jan 2014 13:07:36 -0500 Received: from e24smtp02.br.ibm.com ([32.104.18.86]:60017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9IUy-0005MD-Ve for grub-devel@gnu.org; Fri, 31 Jan 2014 13:07:29 -0500 Received: from /spool/local by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 31 Jan 2014 16:07:26 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 31 Jan 2014 16:07:24 -0200 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.13.184.25]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 6235A3520064 for ; Fri, 31 Jan 2014 13:07:22 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay03.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0VI6n5s43253796 for ; Fri, 31 Jan 2014 16:06:49 -0200 Received: from d24av02.br.ibm.com (localhost [127.0.0.1]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0VI7NYa002566 for ; Fri, 31 Jan 2014 16:07:23 -0200 Received: from beren.vexwifi.com.br (travia.br.ibm.com [9.18.203.16] (may be forged)) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s0VI76eL002214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 31 Jan 2014 16:07:23 -0200 Date: Fri, 31 Jan 2014 16:07:04 -0200 From: Paulo Flabiano Smorigo To: The development of GNU GRUB Subject: Re: [PATCH] grub-core/net/arp.c: trim arp packets with abnormal size. Message-ID: <20140131180704.GA13625@beren.vexwifi.com.br> References: <20140131153509.GA26154@beren.br.ibm.com> <20140131200207.29a96bbc@opensuse.site> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20140131200207.29a96bbc@opensuse.site> User-Agent: Mutt/null+5621 (d3096e8796e7) (2012-12-30) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14013118-2194-0000-0000-000007CD7447 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.104.18.86 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, 31 Jan 2014 18:07:44 -0000 Fri, Jan 31, 2014 at 08:02:07PM +0400, Andrey Borzenkov wrote: > В Fri, 31 Jan 2014 13:35:11 -0200 > Paulo Flabiano Smorigo пишет: > > > * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with abnormal size. > > > > GRUB uses arp request to create the arp response. If the incoming packet is > > foobared, GRUB needs to trim the arp response packet before sending it. > > > > This is just a fix in time for 2.02. I'm planning to rewrite the arp response code > > after the release. > > > > diff --git a/ChangeLog b/ChangeLog > > index cfa9c83..10e9c3d 100644 > > --- a/ChangeLog > > +++ b/ChangeLog > > @@ -1,3 +1,11 @@ > > +2014-01-31 Paulo Flabiano Smorigo > > + > > + * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with > > + abnormal size. > > + > > + GRUB uses arp request to create the arp response. If the incoming packet is > > + foobared, GRUB needs to trim the arp response packet before sending it. > > + > > 2014-01-29 Vladimir Serbinenko > > > > * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to > > diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c > > index d62d0cc..77581f4 100644 > > --- a/grub-core/net/arp.c > > +++ b/grub-core/net/arp.c > > @@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb, > > if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 > > && grub_be_to_cpu16 (arp_header->op) == ARP_REQUEST) > > { > > + if ((nb->tail - nb->data) > 50) > > Using large ping size is quite common during network troubleshooting. > This looks like rather arbitrary restriction. I'd say - if we were able > to receive packet we should be able to also send packet of the same > size; what problem does it fix? I hit a firmware bug where after a while every packet comes with MTU size (~1500 bytes). GRUB handles those foobared packets well and the only problem is the case that I described above: ARP responses are built using ARP request as its base. ARP responses with trash are usually ignored by the network and my patch only trim the arp responses to the corrent size, nothing more. > > > + { > > + grub_dprintf ("net", "arp packet with abnormal size (%ld bytes).\n", > > + nb->tail - nb->data); > > + nb->tail = nb->data + 50; > > + } > > grub_net_link_level_address_t target; > > /* We've already checked that pln is either 4 or 16. */ > > char tmp[16]; > > > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel -- Paulo Flabiano Smorigo IBM Linux Technology Center