From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1W9GY1-0006Oh-B7 for mharc-grub-devel@gnu.org; Fri, 31 Jan 2014 11:02:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9GXr-00064H-2V for grub-devel@gnu.org; Fri, 31 Jan 2014 11:02:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9GXi-000706-LH for grub-devel@gnu.org; Fri, 31 Jan 2014 11:02:19 -0500 Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:55445) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9GXi-0006wj-Eb for grub-devel@gnu.org; Fri, 31 Jan 2014 11:02:10 -0500 Received: by mail-la0-f53.google.com with SMTP id e16so3553250lan.26 for ; Fri, 31 Jan 2014 08:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=ddPRIz7tRIAwqHcF0UleB+MPKpaRvn0XzlG6IA9Lhd0=; b=US67oAgyWPvMJ7Pn2pig1Z23pr/0rmjkMUidU9hlttz/KnaqiKNvcQS8XtvY5uNL6Z Tz7//dkcKIFXzG27CcDeJWImAqn2YzCc8Ms0ORYMS+63sodGMRjrFtX1XJZ2qA6k9Sa5 UAqPnPzajz60F+owu/V6WP4yLTfrYl9x3M7ixnyORb4PcynvIP/6SvRdooqGWpNrA8J/ heOQQ7rX/b9/lFEMXs0PsyG5eKjsyTdootsh1x2N01u3uH/tbb80zQcVVlCGhflzNxzP gQk/N2u7WltTLoRBUeGXvnH6Qh3kHJI7Xt0c6MjD7D5XD6G8U9AwkFeSyZBMpb3sUY5A +drg== X-Received: by 10.152.28.229 with SMTP id e5mr1352874lah.57.1391184128833; Fri, 31 Jan 2014 08:02:08 -0800 (PST) Received: from opensuse.site (ppp91-76-154-95.pppoe.mtu-net.ru. [91.76.154.95]) by mx.google.com with ESMTPSA id k1sm10706385lbc.5.2014.01.31.08.02.08 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 31 Jan 2014 08:02:08 -0800 (PST) Date: Fri, 31 Jan 2014 20:02:07 +0400 From: Andrey Borzenkov To: The development of GNU GRUB Subject: Re: [PATCH] grub-core/net/arp.c: trim arp packets with abnormal size. Message-ID: <20140131200207.29a96bbc@opensuse.site> In-Reply-To: <20140131153509.GA26154@beren.br.ibm.com> References: <20140131153509.GA26154@beren.br.ibm.com> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R 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:c03::235 Cc: pfsmorigo@linux.vnet.ibm.com 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 16:02:27 -0000 В 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? > + { > + 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]; >