From patchwork Sun Jul 1 11:07:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 10498619 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 BE5A260284 for ; Sun, 1 Jul 2018 11:10:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF8A128AF3 for ; Sun, 1 Jul 2018 11:10:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A38BA28AFB; Sun, 1 Jul 2018 11:10:40 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3983E28AF3 for ; Sun, 1 Jul 2018 11:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6iPuXqNt/Xeq9LX4WfvSFlIx9Sx8+HPgSYuaspRVxNk=; b=DliU/Z0XjOzfx+ zeYdYtD91kJSuGYt1Frjq49hp6N7d/Alq3ampfTYzdH2m+q+mtTpSB4G9P/VcnqPhEPT0IbeQIGQU 6c9p5EtKUifwbP2+sYZB9pgnbD2+gueNsrrSt4dM3wvq07jxY0wE0/vhed6BnQkQ+oOWFcdj3rY91 prxCzH43bIMcV9WVFvTdBKwToWuAXpoWYtJucALtIKlpmrmQqsG0lrrPpT78UoFnHuh03GIoaPJiE hwPZbVviQ6XseDzAT9CE5ujcKw9lJZyjQ5UYG396pbipOclwfwgJyqnVUDLW8xwsjBpPW0Yfs43IS l/0Z8fIy2QMx4q8N31wQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fZaFS-0005bF-Fi; Sun, 01 Jul 2018 11:10:30 +0000 Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fZaEC-0004Vm-BC for linux-arm-kernel@lists.infradead.org; Sun, 01 Jul 2018 11:09:16 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7BAEDAE53; Sun, 1 Jul 2018 11:08:57 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: netdev@vger.kernel.org Subject: [RFC net-next 01/15] net: Reserve protocol numbers for LoRa Date: Sun, 1 Jul 2018 13:07:50 +0200 Message-Id: <20180701110804.32415-2-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180701110804.32415-1-afaerber@suse.de> References: <20180701110804.32415-1-afaerber@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180701_040912_802255_8CD4A507 X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthias Brugger , Jiri Pirko , Paul Moore , Marcel Holtmann , Dollar Chen , linux-kernel@vger.kernel.org, =?UTF-8?q?Michael=20R=C3=B6der?= , Janus Piwek , selinux@tycho.nsa.gov, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Eric Paris , Jian-Hong Pan , Ken Yu , Stephen Smalley , "David S . Miller" , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP LoRa is a long-range, low-power wireless network technology by Semtech. It serves as base for LoRaWAN as well as multiple proprietary protocols. AF_LORA PF_LORA ARPHRD_LORA ETH_P_LORA Signed-off-by: Andreas Färber --- include/linux/socket.h | 4 +++- include/uapi/linux/if_arp.h | 1 + include/uapi/linux/if_ether.h | 1 + security/selinux/hooks.c | 4 +++- security/selinux/include/classmap.h | 4 +++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/linux/socket.h b/include/linux/socket.h index 7ed4713d5337..aa1e288b1659 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -208,8 +208,9 @@ struct ucred { * reuses AF_INET address family */ #define AF_XDP 44 /* XDP sockets */ +#define AF_LORA 45 /* LoRa sockets */ -#define AF_MAX 45 /* For now.. */ +#define AF_MAX 46 /* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC @@ -259,6 +260,7 @@ struct ucred { #define PF_QIPCRTR AF_QIPCRTR #define PF_SMC AF_SMC #define PF_XDP AF_XDP +#define PF_LORA AF_LORA #define PF_MAX AF_MAX /* Maximum queue length specifiable by listen. */ diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h index 4605527ca41b..1ed7cb3f2129 100644 --- a/include/uapi/linux/if_arp.h +++ b/include/uapi/linux/if_arp.h @@ -98,6 +98,7 @@ #define ARPHRD_NETLINK 824 /* Netlink header */ #define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ #define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ +#define ARPHRD_LORA 827 /* LoRa */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ #define ARPHRD_NONE 0xFFFE /* zero header length */ diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 3a45b4ad71a3..45644dcf5b39 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -147,6 +147,7 @@ #define ETH_P_MAP 0x00F9 /* Qualcomm multiplexing and * aggregation protocol */ +#define ETH_P_LORA 0x00FA /* LoRa */ /* * This is an Ethernet frame header. diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 10a5d2ce3870..b62bb0389d70 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1473,7 +1473,9 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc return SECCLASS_SMC_SOCKET; case PF_XDP: return SECCLASS_XDP_SOCKET; -#if PF_MAX > 45 + case PF_LORA: + return SECCLASS_LORA_SOCKET; +#if PF_MAX > 46 #error New address family defined, please update this function. #endif } diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h index bd5fe0d3204a..060d4bf8385e 100644 --- a/security/selinux/include/classmap.h +++ b/security/selinux/include/classmap.h @@ -242,9 +242,11 @@ struct security_class_mapping secclass_map[] = { {"map_create", "map_read", "map_write", "prog_load", "prog_run"} }, { "xdp_socket", { COMMON_SOCK_PERMS, NULL } }, + { "lora_socket", + { COMMON_SOCK_PERMS, NULL } }, { NULL } }; -#if PF_MAX > 45 +#if PF_MAX > 46 #error New address family defined, please update secclass_map. #endif