From patchwork Tue Apr 12 16:53:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: web+oss@zopieux.com X-Patchwork-Id: 8812761 Return-Path: X-Original-To: patchwork-linux-wpan@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B29A7C0553 for ; Tue, 12 Apr 2016 16:53:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5B132034C for ; Tue, 12 Apr 2016 16:53:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C41DA20320 for ; Tue, 12 Apr 2016 16:53:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933272AbcDLQxq (ORCPT ); Tue, 12 Apr 2016 12:53:46 -0400 Received: from r0.smtpout1.alwaysdata.com ([176.31.58.0]:53032 "EHLO r0.smtpout1.alwaysdata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933090AbcDLQxq (ORCPT ); Tue, 12 Apr 2016 12:53:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alwaysdata.net; s=zopieux; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=eJH7JZLIcRgaqr6bmKkXfSbreZoBbOXU2UqzM1rydnM=; b=kvvHZ4fOmpH6YLX6v71JmLcy6SR7P0yDsVFk+g+4RTJ4OXm6mvlTP8VCZpA3VZn/vs4k+x6bwfxfeDO42/uKvfYlmklvoKf4S1jWA93y9UgoX3dg1HeKkBfuSVzcsNXAXeZrXq2dHDve75mtEZJesJAULVK9TaMPjF7HpQMyDac=; Received: from [2a01:cb15:82ab:3a00:290:f5ff:fecd:4ad7] (helo=alex-arch-laptop.localdomain) by smtpout1.roubaix1.alwaysdata.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84) (envelope-from ) id 1aq1ZG-0002qA-Tb; Tue, 12 Apr 2016 18:53:34 +0200 From: Alexandre Macabies To: linux-wpan@vger.kernel.org Cc: marcel@holtmann.org, Alexandre Macabies , Alexander Aring Subject: [PATCH v3 1/3] ieee802154: add security bit check function Date: Tue, 12 Apr 2016 18:53:00 +0200 Message-Id: <1460479982-4955-1-git-send-email-web+oss@zopieux.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1457988374-31220-1-git-send-email-web+oss@zopieux.com> References: <1457988374-31220-1-git-send-email-web+oss@zopieux.com> X-alwaysdata-ID: 138702651 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ieee802154_is_secen checks if the 802.15.4 security bit is set in the frame control field. Signed-off-by: Alexander Aring Signed-off-by: Alexandre Macabies Reviewed-by: Stefan Schmidt Acked-by: Alan Ott --- include/linux/ieee802154.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h index d3e4156..56090f1 100644 --- a/include/linux/ieee802154.h +++ b/include/linux/ieee802154.h @@ -218,6 +218,7 @@ enum { /* frame control handling */ #define IEEE802154_FCTL_FTYPE 0x0003 #define IEEE802154_FCTL_ACKREQ 0x0020 +#define IEEE802154_FCTL_SECEN 0x0004 #define IEEE802154_FCTL_INTRA_PAN 0x0040 #define IEEE802154_FTYPE_DATA 0x0001 @@ -233,6 +234,15 @@ static inline int ieee802154_is_data(__le16 fc) } /** + * ieee802154_is_secen - check if Security bit is set + * @fc: frame control bytes in little-endian byteorder + */ +static inline bool ieee802154_is_secen(__le16 fc) +{ + return fc & cpu_to_le16(IEEE802154_FCTL_SECEN); +} + +/** * ieee802154_is_ackreq - check if acknowledgment request bit is set * @fc: frame control bytes in little-endian byteorder */