From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1gwsyW-00067u-Ms for mharc-grub-devel@gnu.org; Thu, 21 Feb 2019 13:21:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwsyS-000671-Ij for grub-devel@gnu.org; Thu, 21 Feb 2019 13:21:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwsyR-0005Tq-Nw for grub-devel@gnu.org; Thu, 21 Feb 2019 13:21:32 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:44130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gwsyR-0005Rt-Es for grub-devel@gnu.org; Thu, 21 Feb 2019 13:21:31 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1LI8nv5188929; Thu, 21 Feb 2019 18:21:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=QZbLqXBcQulvOcxyT06B0cGIsDfPMsPg8s6KMGYSPjM=; b=K50u+SEuHot1NKhYfNvMu3TlIvAP4LaZTRdO8lTlrnuuyUmswFlYOsSOgB7VU/jM9DWI jbCLfA6B8dKbROqNvIkgcPqG2WiZYlWsZUVSxkN2KrJHEQuEqZpUzaci79OaoQfzZxm3 pGBV5y4rtgk3DvnlmBqulK08m/7grzHNOy84GdAa5naJ4f/piqksrGYWc9jQHgDopTr5 FspgePx44fwoLIAbd96oRhDXIaQFL8zj3yJAAKfnSXdW+ywLpp9gsX/ZL9+W8jZj4EKy d5fr+2RsQFQLxq+usbT3q1T4lty/C6Kdgv9uBxOJBWpZl5MM1PMwLMS30OA94+biERd1 WA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2qpb5rsru0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Feb 2019 18:21:25 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1LILO9h004005 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Feb 2019 18:21:25 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x1LILOJe020227; Thu, 21 Feb 2019 18:21:24 GMT Received: from tomti.i.net-space.pl (/10.175.187.233) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Feb 2019 10:21:23 -0800 Date: Thu, 21 Feb 2019 19:21:19 +0100 From: Daniel Kiper To: Andre Przywara Cc: Daniel Kiper , Vladimir Serbinenko , Andrei Borzenkov , Mark Rutland , grub-devel@gnu.org Subject: Re: [PATCH v2 4/9] net: dhcp: make grub_net_process_dhcp take an interface Message-ID: <20190221182119.jrtvtnqcsnpp6obp@tomti.i.net-space.pl> References: <20190212174700.184741-1-andre.przywara@arm.com> <20190212174700.184741-5-andre.przywara@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190212174700.184741-5-andre.przywara@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9174 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902210128 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Feb 2019 18:21:36 -0000 On Tue, Feb 12, 2019 at 05:46:55PM +0000, Andre Przywara wrote: > From: Andrei Borzenkov > > Change the interface of the function dealing with incoming BOOTP packets > to take an interface instead of a card, to allow more fine per-interface > state (timeout, handshake state) later on. > > Signed-off-by: Andre Przywara In general Reviewed-by: Daniel Kiper However, please add a blurb to the commit message that you are also cleaning up the code a bit... > --- > grub-core/net/bootp.c | 29 ++++++++++++++++------------- > grub-core/net/ip.c | 2 +- > include/grub/net.h | 2 +- > 3 files changed, 18 insertions(+), 15 deletions(-) > > diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c > index fd56de907..573398aa4 100644 > --- a/grub-core/net/bootp.c > +++ b/grub-core/net/bootp.c > @@ -396,12 +396,19 @@ out: > return err; > } > > +/* > + * This is called directly from net/ip.c:handle_dgram(), because those > + * BOOTP/DHCP packets are a bit special due to their improper > + * sender/receiver IP fields. > + */ > void > grub_net_process_dhcp (struct grub_net_buff *nb, > - struct grub_net_card *card) > + struct grub_net_network_level_interface *iface) > { > char *name; > - struct grub_net_network_level_interface *inf; > + struct grub_net_card *card = iface->card; > + const struct grub_net_bootp_packet *bp = (const struct grub_net_bootp_packet *) nb->data; > + grub_size_t size = nb->tail - nb->data; > > name = grub_xasprintf ("%s:dhcp", card->name); > if (!name) > @@ -409,22 +416,18 @@ grub_net_process_dhcp (struct grub_net_buff *nb, > grub_print_error (); > return; > } > - grub_net_configure_by_dhcp_ack (name, card, > - 0, (const struct grub_net_bootp_packet *) nb->data, > - (nb->tail - nb->data), 0, 0, 0); > + grub_net_configure_by_dhcp_ack (name, card, 0, bp, size, 0, 0, 0); > grub_free (name); > if (grub_errno) > grub_print_error (); > else > { > - FOR_NET_NETWORK_LEVEL_INTERFACES(inf) > - if (grub_memcmp (inf->name, card->name, grub_strlen (card->name)) == 0 > - && grub_memcmp (inf->name + grub_strlen (card->name), > - ":dhcp_tmp", sizeof (":dhcp_tmp") - 1) == 0) > - { > - grub_net_network_level_interface_unregister (inf); > - break; > - } > + if (grub_memcmp (iface->name, card->name, grub_strlen (card->name)) == 0 > + && grub_memcmp (iface->name + grub_strlen (card->name), > + ":dhcp_tmp", sizeof (":dhcp_tmp") - 1) == 0) > + { > + grub_net_network_level_interface_unregister (iface); > + } > } And I think that you can drop four curly braces here. Daniel