From patchwork Fri Mar 11 00:18:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 596017 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 87A8D140C39 for ; Fri, 11 Mar 2016 11:18:45 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id B4EEC10A1C; Thu, 10 Mar 2016 16:18:36 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 6CCEA10A12 for ; Thu, 10 Mar 2016 16:18:35 -0800 (PST) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id EB314161817 for ; Thu, 10 Mar 2016 17:18:34 -0700 (MST) X-ASG-Debug-ID: 1457655514-0b323742fd13400001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar6.cudamail.com with ESMTP id UP3IBz1YYEp4KGDl (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 10 Mar 2016 17:18:34 -0700 (MST) X-Barracuda-Envelope-From: blp@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO relay2-d.mail.gandi.net) (217.70.183.194) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 11 Mar 2016 00:18:33 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at ovn.org designates 217.70.183.194 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.194 X-Barracuda-RBL-IP: 217.70.183.194 Received: from mfilter32-d.gandi.net (mfilter32-d.gandi.net [217.70.178.163]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 6829AC5A4F; Fri, 11 Mar 2016 01:18:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter32-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter32-d.gandi.net (mfilter32-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 554UPDXu8y2H; Fri, 11 Mar 2016 01:18:31 +0100 (CET) X-Originating-IP: 208.91.2.3 Received: from ovn.org (unknown [208.91.2.3]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 8D6D3C5A3C; Fri, 11 Mar 2016 01:18:29 +0100 (CET) Date: Thu, 10 Mar 2016 16:18:26 -0800 X-CudaMail-Envelope-Sender: blp@ovn.org From: Ben Pfaff To: Pravin B Shelar X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-309097924 X-CudaMail-DTE: 031016 X-CudaMail-Originating-IP: 217.70.183.194 Message-ID: <20160311001826.GP1684@ovn.org> X-ASG-Orig-Subj: [##CM-E1-309097924##]Re: [ovs-dev] [PATCH 3/6] lib: Fix compose nd References: <1457570445-68542-1-git-send-email-pshelar@ovn.org> <1457570445-68542-3-git-send-email-pshelar@ovn.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1457570445-68542-3-git-send-email-pshelar@ovn.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1457655514 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: dev@openvswitch.org Subject: Re: [ovs-dev] [PATCH 3/6] lib: Fix compose nd X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" On Wed, Mar 09, 2016 at 04:40:42PM -0800, Pravin B Shelar wrote: > Following patch fixes number of issues with compose nd, like > setting ip packet header, set ICMP opt-len, checksum. > > Signed-off-by: Pravin B Shelar sparse says: ../lib/packets.c:1332:45: warning: incorrect type in argument 2 (different base types) ../lib/packets.c:1332:45: expected restricted ovs_be32 [usertype] ../lib/packets.c:1332:45: got restricted ovs_be16 to fix: > @@ -845,7 +845,7 @@ packet_rh_present(struct dp_packet *packet) > size_t remaining; > uint8_t *data = dp_packet_l3(packet); > > - remaining = packet->l4_ofs - packet->l3_ofs; > + remaining = dp_packet_size(packet) - packet->l3_ofs; Isn't this only correct if the packet has no header, that is, if packet->data_ofs == 0? > if (remaining < sizeof *nh) { > return false; > +/* This function expect packet with ehernet header with correct s/ehernet/Ethernet/ > + * l3 pointer set. */ > +static void * > +compose_ipv6(struct dp_packet *packet, uint8_t proto, const ovs_be32 src[4], > + const ovs_be32 dst[4], uint8_t key_tc, ovs_be32 key_fl, > + uint8_t key_hl, int size) The indentation of the two lines above is a few spaces too far to the right and doesn't align with the (. It would be nice to add a test for the composition functions, so that any regression later gets noticed. diff --git a/lib/packets.c b/lib/packets.c index 6e2c68b..c414694 100644 --- a/lib/packets.c +++ b/lib/packets.c @@ -1329,7 +1329,7 @@ compose_nd(struct dp_packet *b, const struct eth_addr eth_src, ns->icmph.icmp6_type = ND_NEIGHBOR_SOLICIT; ns->icmph.icmp6_code = 0; - put_16aligned_be32(&ns->rco_flags, htons(0)); + put_16aligned_be32(&ns->rco_flags, htonl(0)); nd_opt = &ns->options[0]; nd_opt->nd_opt_type = ND_OPT_SOURCE_LINKADDR;