From patchwork Thu Mar 2 13:23:32 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: 9600249 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 0C38E60453 for ; Thu, 2 Mar 2017 13:32:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2DFD27F93 for ; Thu, 2 Mar 2017 13:32:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E78F227FA8; Thu, 2 Mar 2017 13:32:11 +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 2060E27FA6 for ; Thu, 2 Mar 2017 13:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859AbdCBNcF (ORCPT ); Thu, 2 Mar 2017 08:32:05 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33672 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752618AbdCBNcB (ORCPT ); Thu, 2 Mar 2017 08:32:01 -0500 Received: by mail-lf0-f67.google.com with SMTP id r36so5754568lfi.0; Thu, 02 Mar 2017 05:32:00 -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=e2BPD8aa58uKf6pezllSQg1jSoFTdJz9VIj4bmCeUcWG4z/ZeMpcsbERCAtwRma4kh cBo4lfrdmwxyaJnmWq2Ux5qtsR+i/c9YE66UdaWZ2oc+WWV7XmXwXUDX2FcJXOUF+T0w dT4kgzcXD0CZvNZ2NB47x1O0csom2zHl1EqgFKYIPabMPjf5ZTWgAbhs+I7Rj8BcIzQw SptClrD14XAPz6HLvl0QlEzqgj/UH7dKGECR4rKG7tzYx01rYVBmEJpYx3FwfYCy6njr WlsW2NeYmDbs5VEGYb344jjcseP7olTid8ewNsdw702Mv+FjA7A/J/KZrCktMjzhscWo 9IVA== 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=hakMgdAAfYd8ca2KyaSzyGAGLOFHsKBeO+tFtmPIhaGN3VL7KUcrXKsUTEGzqGnk4e PPU68W3h78KZBD/sfYkGZS8K/DFWFJ2KsL2+ZLPJ9ObMXR7ND88aPHzO1KLiW4SNn4jm 1Un38KoGeQyHDivFVVKCsn5ssitX+nS/0jfijVbONhZqUH9wWyB4JHTS7Fef4i3e7Gn2 66dY38oMbYJ0h1A1mw+55E5jLUFD9kbGpJBWcFalQWxfJo1pdigmyWpDeMEbjCNE4ZQI 21KeuIzK4w7oPbyMlgZTJXWhMJ3XXAPEwee9JFgXU3gsuxPRVlZIimwaF0dlsSXfFHQB 2J7w== X-Gm-Message-State: AMke39lZ9LngO0B2M8NdJd53e0zqhTImxoCsSKerIUH8lf0ClNahhvEMYZwEBnbFQ/jUPg== X-Received: by 10.25.234.71 with SMTP id i68mr4449063lfh.25.1488461023137; Thu, 02 Mar 2017 05:23:43 -0800 (PST) Received: from localhost.localdomain (85-76-69-169-nat.elisa-mobile.fi. [85.76.69.169]) by smtp.gmail.com with ESMTPSA id b72sm1700349lfb.24.2017.03.02.05.23.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 05:23:42 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Cc: patrik.flykt@linux.intel.com, aar@pengutronix.de, jukka.rissanen@linux.intel.com, linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v6 3/6] 6lowpan: iphc: override l2 packet information Date: Thu, 2 Mar 2017 15:23:32 +0200 Message-Id: <20170302132335.21192-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170302132335.21192-1-luiz.dentz@gmail.com> References: <20170302132335.21192-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);