From patchwork Thu Feb 16 17:19:44 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: 9577755 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 1B00660244 for ; Thu, 16 Feb 2017 17:19:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D6FA2040D for ; Thu, 16 Feb 2017 17:19:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 027962862C; Thu, 16 Feb 2017 17:19:57 +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 61BD72040D for ; Thu, 16 Feb 2017 17:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932644AbdBPRT4 (ORCPT ); Thu, 16 Feb 2017 12:19:56 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35215 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932585AbdBPRTz (ORCPT ); Thu, 16 Feb 2017 12:19:55 -0500 Received: by mail-lf0-f67.google.com with SMTP id v186so1984296lfa.2; Thu, 16 Feb 2017 09:19:54 -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=JG4/YP6XeYDZXpQG8NXFExGiyKXdVwGnxm81fzfmoy6qmqS+wp+DHoT8mM0hQih02T UddbaQ/6WLa1iwiRp2jwoyiNakSGxryJDQl/Wc/C0svu9GwOtXc9WVyTQyqW9qXIU9Dr IugMJZ0UWgOTvhn/OCbTCxmKfR/Tz6F36QbgOJzIxeT6SnAyd7rTtQas93Zx9xZ9TlZH /LQRbuFod4tu/WRHaY0E8DFqXcuXi2v64APWfzsEPNToLu8ae696SZJ/ZoH+jxqnUcib ijLIbVZGflJZuy+wiHAMzROVtlouFOB3Rnt28nfKEN7ym49dje9R2HYWHRoSvqqaDfJW utBQ== 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=YBJDqpI3EUdd3cbP2BOM8FgLyVMVleEvyBRgb/DbCRTPBSx4aV6vIFSLNIufXW8wnj UfBikPVO0bdESBDYIvTpTPbLpGYTPbwVSfcuGrCIzJMbiWQ3lge0Z95h4e5wacspyAMF GGQp/AVwVDpdusGv9DkCRDWaDRiryOxh2n95dlWjsfVCeNSRh4XqoFcBMVRwW7E4BYoO IU1HNOi12I0fwejLrL6IICWGErHUh91RDM8l3nIEenBTfCYcbDpc89KPTemAUuIt8jvL /cacI6Af6Vu/f46rmpcTyqThOq7dZJrUhnxwzjMyHEY915VnSpBxdiYf1vPx3rJsN9bG VG0Q== X-Gm-Message-State: AMke39kKPp7NwlW1ouqpZHJfbjpzGoMj1ThPz3srHTjlVN+5eNPVwg0EqqZisJ1v+LidmA== X-Received: by 10.25.76.85 with SMTP id z82mr934071lfa.181.1487265593150; Thu, 16 Feb 2017 09:19:53 -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 187sm1874292ljj.7.2017.02.16.09.19.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 09:19:52 -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 v2 3/5] 6lowpan: iphc: override l2 packet information Date: Thu, 16 Feb 2017 19:19:44 +0200 Message-Id: <20170216171946.5105-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170216171946.5105-1-luiz.dentz@gmail.com> References: <20170216171946.5105-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 --- 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);