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: 140711 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2850753ljj; Sun, 1 Jul 2018 04:13:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJthdVzpMPCfFZNrHyZyAPzuMcnxxkAZUmXnRpjEcPHpWD+/yHdO0cZCKIfo1RXIMIvet09 X-Received: by 2002:a17:902:b08d:: with SMTP id p13-v6mr21717854plr.344.1530443609226; Sun, 01 Jul 2018 04:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530443609; cv=none; d=google.com; s=arc-20160816; b=dgwaOxuoQ4qVgVzicbvVT2lcJwzQPn13jmgHjxVwT6pMNmSkPNV2yD7gT9bCxXQlMC 8ev0mUOzKlhm5lTmFjy2tlHYe+ophhZxYIK516xlg5sbei6MowAciweSuwpMW/S4blKh Cj2J/A0uf3/g37+XmQ1Th5QwWkLvDOJBiwzPhyF7iZ76r3nnoHdyZLP5Nj17h4j/FCXl 0IMFo+ZFeMHIYsC6K/pUgqlMdnc3tUzDPPeIOzj3BnZErieyA4xLJafsKVGASxr5qinW h3uYLZV3OqzCsrd03lqPTaaVn48jqItnAfoxfSSbcwGzVVLUrQZ+w9YPyfbmkr6h5Ic3 YiUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SnBjGgHwy6bFzIRl66ufncbnlwOqkOlB2e460Qd7CIw=; b=gAPjlq5ecJslsCs/scIDudGe4yg2JbYycHulwauA7o8BuzWZQyQGTMfcMhNJRHJOlz snGHBenfEAjtZHFXUJObv+IhT1PLbgW9PdGBJV8yPAveoVsv393CGraDFVmdCfDhb5+T wkIZKjpdBBG08pYSB/t0Rzf6sxwsYymarvLPbB9L2gVjWEk7tDECnEA1QnwYNmi3xnNj gFzA1N6zDOjsyEexhiF1QP8UAkhP6TQDbvr5caRrbUi16hngbeHRYfOd3xXnng9ZyuHG OtrkDLGi0FHmQGZXK4N/okjgoeHmprJNGOw2ftbpfCATIIhsC8NeLWjgY4gnX0iVk/lz dh8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a21-v6si13219161pls.237.2018.07.01.04.13.28; Sun, 01 Jul 2018 04:13:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752756AbeGALM5 (ORCPT + 31 others); Sun, 1 Jul 2018 07:12:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:47740 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752039AbeGALI7 (ORCPT ); Sun, 1 Jul 2018 07:08:59 -0400 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_F=C3=A4rber?= To: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jian-Hong Pan , Jiri Pirko , Marcel Holtmann , "David S . Miller" , Matthias Brugger , Janus Piwek , =?utf-8?q?Michael_R=C3=B6der?= , Dollar Chen , Ken Yu , =?utf-8?q?Andreas_F=C3=A4rber?= , Paul Moore , Stephen Smalley , Eric Paris , selinux@tycho.nsa.gov 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.16.4 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