From patchwork Fri Feb 24 12:14:37 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: 9590005 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 B4A9860578 for ; Fri, 24 Feb 2017 12:15:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF9872872D for ; Fri, 24 Feb 2017 12:15:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2D2A28783; Fri, 24 Feb 2017 12:15:56 +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 207BC2877F for ; Fri, 24 Feb 2017 12:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751402AbdBXMPX (ORCPT ); Fri, 24 Feb 2017 07:15:23 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:32875 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751239AbdBXMPB (ORCPT ); Fri, 24 Feb 2017 07:15:01 -0500 Received: by mail-lf0-f66.google.com with SMTP id j2so1349594lfe.0; Fri, 24 Feb 2017 04:14:47 -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=yQ6MOUQvRMIMMqXBEq+Y8CbRwzklRu1Hu8+xuUvjOls=; b=FNfistD2o1kvVUxmyu17vETxJOQrPZVpsgaUmVVB24xMgxpyuU43NjK/cX5MECBwra oXBDjduC4GSgoVZ/y7n0VdanOlvXf7jzIh7Qhtq0w5m+fXLC55ckgORYkMiiDpLlLUST 8ro10Sup34zmH6pfxoAx5dR1qi9eOMv/jorbZhOdxeK44tAPLlSCoTiO3dXY9TMkG2/T uj5g0wHk2LdtNLLmDZV4Jc1/qTX99sNCJwic0TX/zLa2JaTYQadfFxdCBING9umeKKAv Thcx8OloCU/TnMtypnuZ//pSueHuizJbQlPimkD3/AxSqKMYFRiZlc5ADctrC0PqTfXc wF+A== 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=yQ6MOUQvRMIMMqXBEq+Y8CbRwzklRu1Hu8+xuUvjOls=; b=hCXXo4bOTxiwfIm8EeO7Xbxkz3JFZ9t7HsvuL3QJEHZX8rVKe/lYDpQhZcS7K1QvDa kzK36JJgJaH0qChQfKrPymK1FWd1ZXkFG0QGeViRS3oteQgW0ySiNNyYT+g+QJJlbSTl pPw8P8dYFu/GDlyIOuFlRL1ifxj9JhL6+yCT939schE/n1fsq3aIxt7HmLZFhvaR51pU 5msr/5596MrCUAp25/nk5DCWneVmTj5C9MutPmSp6sQ/YN9MJ/BYCTglGQO3JDOI/oWN 5LNgDdADzrY2LL6rsUS214rNqvvP02iQld+e/0P9FQloHEt+vI+am1LWwP87yMU8u25m K4JA== X-Gm-Message-State: AMke39mIxFZuQvB8pwZZ5he81Us3m2gUepD0gNWKST//fpoDYdUAk6lXRtJ9Db5VQC4IOg== X-Received: by 10.46.83.15 with SMTP id h15mr635317ljb.72.1487938486010; Fri, 24 Feb 2017 04:14:46 -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 26sm8569196ljo.21.2017.02.24.04.14.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 04:14:45 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Cc: patrik.flykt@linux.intel.com, jukka.rissanen@linux.intel.com, stefan@osg.samsung.com, aar@pengutronix.de, linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 3/6] 6lowpan: iphc: override l2 packet information Date: Fri, 24 Feb 2017 14:14:37 +0200 Message-Id: <20170224121440.32269-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170224121440.32269-1-luiz.dentz@gmail.com> References: <20170224121440.32269-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);