From patchwork Sun Mar 12 08:19:35 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: 9619261 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 C280B604CC for ; Sun, 12 Mar 2017 08:19:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B03CC28511 for ; Sun, 12 Mar 2017 08:19:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A266D28546; Sun, 12 Mar 2017 08:19:58 +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 07A9E28511 for ; Sun, 12 Mar 2017 08:19:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933643AbdCLITv (ORCPT ); Sun, 12 Mar 2017 04:19:51 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34140 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755716AbdCLITr (ORCPT ); Sun, 12 Mar 2017 04:19:47 -0400 Received: by mail-lf0-f66.google.com with SMTP id y193so9693583lfd.1; Sun, 12 Mar 2017 00:19:45 -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=bNtdMkq/7OggCUsTwfZRD0PErI0LiVjz/jfVnbUE5wgJ1AwNVgvL50Hm/pBFIG6vts Twj2IvYgABgkdKy0KgVyVyBT/QppqF0j91B4dxPwa9fStpVxI8s7wNxT/Q/90/wCyayq 3kBpw1LMNEBJmvghMUET6sfs7KoQpwigBrUaNiTJqgruEJd6o5GYwvt0uWyQx67guXP7 cjb1kFptWQWKQ9AxJK9HCPWGvEV6/COBW/9nFYNmTcdcvuA1T5jUZZY/VQjcYTvmoKLX G74i2mBWYkExGMlXWgTotPkcdu/bkSSXCUnZBKpYa/q54GQD5sLTas4WKIALXiu6TSYq 2xjw== 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=M+rR/a6bwFqCrqOodHMGHWVDxcDwlI34jaLOwrlGSAC3cUcU9ByDHfpqUpn0JsBqgZ dU6PQLW9Yhzh/RAXlV6raKtxUL0EgFdy9N5g+GhYvtXadHpR+5nvv9I98f+GJrIa7y9J zYUOJL+r524DVQOmDuX/+r3HKY+2mxr1Kb+8vYqxPnFm5mEOYNMfutVlgfiRTzXVJcwz wDd0btMQtKq5ZSrXh+IUZU6ZNJAS5aaJeFtoTbmCRwNGrKGwFElweSM5yf2Bcw164Jy3 G8sEMXv1WJ/EAQeVZX8NrNyZjVuYGyge1k3SILQClzmU5lWi262i9DQIU7CcxoQUySgE 5xwQ== X-Gm-Message-State: AFeK/H3+jTao84KZem7hSVRb15sDDiMVMIRsMTHrWBP56D7Vbl6MEH9aPnCd4ZC3+vGXMg== X-Received: by 10.46.69.130 with SMTP id s124mr1023841lja.71.1489306784388; Sun, 12 Mar 2017 00:19:44 -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 i24sm2874937lfk.50.2017.03.12.00.19.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2017 00:19:43 -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 v7 3/6] 6lowpan: iphc: override l2 packet information Date: Sun, 12 Mar 2017 10:19:35 +0200 Message-Id: <20170312081938.11700-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170312081938.11700-1-luiz.dentz@gmail.com> References: <20170312081938.11700-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);