From patchwork Mon Mar 14 20:46:12 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: 8583801 Return-Path: X-Original-To: patchwork-linux-wpan@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6E8AC9F54C for ; Mon, 14 Mar 2016 20:47:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAFCB20154 for ; Mon, 14 Mar 2016 20:47:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99FF92021B for ; Mon, 14 Mar 2016 20:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756131AbcCNUrY (ORCPT ); Mon, 14 Mar 2016 16:47:24 -0400 Received: from r0.smtpout1.alwaysdata.com ([176.31.58.0]:56917 "EHLO r0.smtpout1.alwaysdata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbcCNUrX (ORCPT ); Mon, 14 Mar 2016 16:47:23 -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=p6NF6oEqS7oyOIznk96DMaGdw/BLqILJuJqfaNFXEFE=; b=PZe6uPAPUKYbA3X6NfjVQDUBHFRn39A+qcCQ9Uo5Vlzo999I8YYwnkIMoJh2zKlpJyYI8jATNGhrKnOQ9dmGBLc1PJAp2fjIN9OBU/HasY39F6UVnkhbNUEDPPLfmb4SCbemjzS/xJpzOjPdnL6oMqjsn4tmIJzAg/053kxTwXg=; Received: from agrenoble-651-1-452-143.w82-122.abo.wanadoo.fr ([82.122.156.143] 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 1afZOV-00086z-OC; Mon, 14 Mar 2016 21:47:15 +0100 From: Alexandre Macabies To: linux-wpan@vger.kernel.org Cc: Alexandre Macabies , Alexander Aring Subject: [PATCH v2 1/3] ieee802154: add security bit check function Date: Mon, 14 Mar 2016 21:46:12 +0100 Message-Id: <1457988374-31220-1-git-send-email-web+oss@zopieux.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1457633643-12535-1-git-send-email-web+oss@zopieux.com> References: <1457633643-12535-1-git-send-email-web+oss@zopieux.com> X-alwaysdata-ID: 132956218 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Spam-Status: No, score=-6.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 */