From patchwork Fri Feb 17 15:50:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 9580255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0DADE6043A for ; Fri, 17 Feb 2017 15:50:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 002A128721 for ; Fri, 17 Feb 2017 15:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E89E928724; Fri, 17 Feb 2017 15:50:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9740A28723 for ; Fri, 17 Feb 2017 15:50:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934626AbdBQPuQ (ORCPT ); Fri, 17 Feb 2017 10:50:16 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36608 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934226AbdBQPuN (ORCPT ); Fri, 17 Feb 2017 10:50:13 -0500 Received: by mail-lf0-f66.google.com with SMTP id h65so4122709lfi.3; Fri, 17 Feb 2017 07:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oz7Lo3DzWj+T8QeDZ7jHK9It0Htp/2l61LXjFV9mjlA=; b=Xu+kuybn4ocflAPL2tYtuws/zSTFFOjR2bNNqnp1A+mezlldN/Pmnnm6Kb+rBJZgbk FqsMsDLoL+AR/e1pmK0xoKZD9CLqkgkZBV8kOQKeQcRuqQEunC+v3x4dfhSXt7joySAA 3/q2beGUagG38T/e4FfOz8iAoQilzPa6rSmLwQjOf7RrTxYUyRrkVr++d2p+vGvH5EsT YEi+aApnok+aFTqrK6HX8GJzinfQkydB/CwrI2I87NFIW1JELatmSZRiyBL5ikQKAv/c grCD6rD6ROph6HJ1+7ZfcSfj+1Tz1NK0Ur4cTq55sodj6smWIQSYzMf2YEfTnvgyJpIO OdmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oz7Lo3DzWj+T8QeDZ7jHK9It0Htp/2l61LXjFV9mjlA=; b=jxssyGfqrqlrT/b1eCITJ9ikOb65rNR1S2Ds+lXUqLep+iSwxlvUrKMQUaX04ueWKz QkzpHihTkBPHMFWJgG/m/HNtTdRO+Di/bLPKWcqSRTtfQTLuO+/fmMQh7qACVl8VIwx9 ll5wJhZl6dADKyFJPMqBtnShN+Hw2f8gCvJBkJA+SWvnfBH7Rrv2bz/7pI3sgK9Nbewo GYlWJTpyEdhVvWeZNUeOb2UiHEjRxifvpm6omDsGO/VZS7D4YfRDSv8yWEBydyQ73EUe ZVQ0B+WhNLh5bV3Lm98OleiUHRaUkRM9mSJyz9zwbtnDmOJgGKoVKSDmL/O0wW+VnxqI UlCQ== X-Gm-Message-State: AMke39mygi+gJkBHaDoFppi/KH3d1CoQ7ueiabcLMu0ZxerhM6fI3vSamtfKlRpfSOzbGA== X-Received: by 10.25.115.3 with SMTP id o3mr326668lfc.162.1487346611649; Fri, 17 Feb 2017 07:50:11 -0800 (PST) Received: from vudentzs-t460s.pp.htv.fi (89-27-7-11.bb.dnainternet.fi. [89.27.7.11]) by smtp.gmail.com with ESMTPSA id c18sm2600726ljd.52.2017.02.17.07.50.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2017 07:50:10 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Cc: patrik.flykt@linux.intel.com, aar@pengutronix.de, linux-wpan@vger.kernel.org Subject: [PATCH v3 3/5] 6lowpan: iphc: override l2 packet information Date: Fri, 17 Feb 2017 17:50:01 +0200 Message-Id: <20170217155003.4594-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170217155003.4594-1-luiz.dentz@gmail.com> References: <20170217155003.4594-1-luiz.dentz@gmail.com> Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alexander Aring The skb->pkt_type need to be set by L2, but on 6LoWPAN there exists L2 e.g. BTLE which doesn't has multicast addressing. If it's a multicast or not is detected by IPHC headers multicast bit. The IPv6 layer will evaluate this pkt_type, so we force set this type while uncompressing. Should be okay for 802.15.4 as well. Signed-off-by: Alexander Aring Reviewed-by: Stefan Schmidt --- net/6lowpan/iphc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c index 79f1fa2..fb5f6fa 100644 --- a/net/6lowpan/iphc.c +++ b/net/6lowpan/iphc.c @@ -666,6 +666,8 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev, switch (iphc1 & (LOWPAN_IPHC_M | LOWPAN_IPHC_DAC)) { case LOWPAN_IPHC_M | LOWPAN_IPHC_DAC: + skb->pkt_type = PACKET_BROADCAST; + spin_lock_bh(&lowpan_dev(dev)->ctx.lock); ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid)); if (!ci) { @@ -681,11 +683,15 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev, spin_unlock_bh(&lowpan_dev(dev)->ctx.lock); break; case LOWPAN_IPHC_M: + skb->pkt_type = PACKET_BROADCAST; + /* multicast */ err = lowpan_uncompress_multicast_daddr(skb, &hdr.daddr, iphc1 & LOWPAN_IPHC_DAM_MASK); break; case LOWPAN_IPHC_DAC: + skb->pkt_type = PACKET_HOST; + spin_lock_bh(&lowpan_dev(dev)->ctx.lock); ci = lowpan_iphc_ctx_get_by_id(dev, LOWPAN_IPHC_CID_DCI(cid)); if (!ci) { @@ -701,6 +707,8 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev, spin_unlock_bh(&lowpan_dev(dev)->ctx.lock); break; default: + skb->pkt_type = PACKET_HOST; + err = lowpan_iphc_uncompress_addr(skb, dev, &hdr.daddr, iphc1 & LOWPAN_IPHC_DAM_MASK, daddr);