From patchwork Tue Feb 21 10:38:09 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: 9584217 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 CA9E96042F for ; Tue, 21 Feb 2017 10:38:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD0EB28805 for ; Tue, 21 Feb 2017 10:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9ED6E288DD; Tue, 21 Feb 2017 10:38:43 +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 08E6A28805 for ; Tue, 21 Feb 2017 10:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751582AbdBUKig (ORCPT ); Tue, 21 Feb 2017 05:38:36 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:33462 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751804AbdBUKiV (ORCPT ); Tue, 21 Feb 2017 05:38:21 -0500 Received: by mail-lf0-f65.google.com with SMTP id 86so4518700lfv.0; Tue, 21 Feb 2017 02:38:20 -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=js1DvovP8UD+oWneyLw5Fi49qkB57dmTZVoIwDbbXyUmT1s0D9RA4sU6J9i/T82ze6 lAbIC74IdZozEupiNp5qBC+idSr3ax55o3P1bPajFW36K1zt87hpjfYubw/iNKLE4aVW 1YrfBSlZmORAUeaEibaDTLJbKx40LVBhkDbVVOYWmgc9BvhzTr4goU1sp7nl/SRisMEo U3jo3qr0LtMb52IV1/n6wnNqyrSLVQy01qnJDUyOIctbRNg64Jf/8oMiVidvlDxmlZca ckpPya6joeXy3febTFhCQ4f1xB9mug8VsnQ6zGmGCdzdjVwjQMylWoToFRTO/YEkgEDr yT2A== 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=aRYtuhSjcuTxUTp+neP6rmZTk4jG1AxD0L4FwET0Zi/c7cHonzJDQAZcTJjrTxK7ei yfGXxw8bTrAwP6NfUzCnyZ0Cza4QbkAt1axp+rNzddG9bED75dralbFJfgj8rECyhLr8 /kcOecNiHimJ3WOONhb44zOxuvDRyakttpqLjC8OUEAXgk/2TOeyd6nqHJGhBMIpaikc NKm3GfddTPyxF688JHnRq5rVBXuPnLR0SjFPO1ZHX2PwyrNg69aoF7DwnFXI2US9eG69 2K2mOuFyS7wIYvqzhWAPD7nr6qd7fIjoU/KjRqS3nupEqhhXvEjmCWkq5SGL1z8ROIl+ K0yQ== X-Gm-Message-State: AMke39mA3nyij42EQF2vVMThRrXeAFFwJ6OipPm5krhPFQWBWhMLGgBAxn9Pcsm7kqACWA== X-Received: by 10.25.156.213 with SMTP id f204mr7214803lfe.27.1487673499085; Tue, 21 Feb 2017 02:38:19 -0800 (PST) Received: from localhost.localdomain ([2001:998:22:0:4f7c:5e8e:5bc:71bd]) by smtp.gmail.com with ESMTPSA id f137sm469811lff.21.2017.02.21.02.38.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Feb 2017 02:38:18 -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, netdev@vger.kernel.org Subject: [PATCH v4 3/5] 6lowpan: iphc: override l2 packet information Date: Tue, 21 Feb 2017 12:38:09 +0200 Message-Id: <20170221103811.1506-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170221103811.1506-1-luiz.dentz@gmail.com> References: <20170221103811.1506-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);