Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1887393imm; Thu, 23 Aug 2018 10:21:33 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz9ZZJDOR+hDwvZ+4DOMNmA4WSzsXeRaaMeqHMAb8rNVFjXNL+RvNocxlKfqzniTCOFCHgE X-Received: by 2002:a63:ca09:: with SMTP id n9-v6mr56119739pgi.287.1535044893460; Thu, 23 Aug 2018 10:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535044893; cv=none; d=google.com; s=arc-20160816; b=hUAFZ2KPZSWpesMeFv7HWjp8drT9jZjU+hZ7IXSlEcdq+Q5ALQIo4W0LA3bKSbjVeD e/KhRtf2D2hlkQLzAZLQug86zrCa0qHn/+m/dDPPESol30IsF0Elnr8shRtKPMcQZPJJ J8oPmZdrQBzGwailRWK1y+b36s5X5OZUfGpL6RXn6CeZL6vRU0JccNt77/8lMWGRCyEX BWnRiPx9o8z0RbB5VaBzfBdkCfwzFgxOc+L3/36x/uJLoWM7OJrhcCaYLilsrVI/3Lc7 NJbpRUCanHY78pTShxx8tduQeOdtvgS2BAnTzmOhzrTU1aAoqUiCje1ZS3DNzeJEiknW 5o5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=KoHEYW9wxzKxZkT9cZKzsJNfwrFeb6lfM11FdkwBbY8=; b=sOivomNTP7a6GN8EL6mfBKkj+1TkOGfzggiNRrXAbCEmZq89id3QFgWf7x7FK9vqTm iEKr0u01lm36a/9CPkJE/7yxnFeocb+a+BhRmH56xeauk+iRUOtn/ZxIFymV9M0Nou6v 9aOlEIQI1WHVaXfhAeQBGJC8JP86jvr1iSo1W/KUw71bvUi2KwGEYDx0PvMAfI0531by hVpGM6zgiDbUU9aYfZSY1A1Bdmgje9MtBWDRnoiallcRrY6WN6ezzG06qCba0/gbOT/i oNsvQdlSA9QYN0hUgwQr2t6sw5Z70c4idIa2bL0K7F2BVxRAJXDL4JKwvmgHxqXrezl5 0pMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@g.ncu.edu.tw header.s=google header.b=G6vRKlUY; 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 w2-v6si4266335pgl.105.2018.08.23.10.21.18; Thu, 23 Aug 2018 10:21:33 -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; dkim=pass header.i=@g.ncu.edu.tw header.s=google header.b=G6vRKlUY; 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 S1727105AbeHWUuG (ORCPT + 99 others); Thu, 23 Aug 2018 16:50:06 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43173 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726636AbeHWUuF (ORCPT ); Thu, 23 Aug 2018 16:50:05 -0400 Received: by mail-pg1-f196.google.com with SMTP id v66-v6so2931694pgb.10 for ; Thu, 23 Aug 2018 10:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=g.ncu.edu.tw; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KoHEYW9wxzKxZkT9cZKzsJNfwrFeb6lfM11FdkwBbY8=; b=G6vRKlUYiBiXKW+qTPQQvE4PaTUWEtyVk0sx31c4WeLc1BeBZbtoctqOoHfRKhhpKf F/fUT4U4JrTqC5JZ8UwKJyuJv9ysH2RANyGTNdNPG4l7Rqs43QctBQlRigtByxtUJ/8V h8dzOtvd0QaC5camoiw5yUxP/9pRZwFKAlTeg= 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=KoHEYW9wxzKxZkT9cZKzsJNfwrFeb6lfM11FdkwBbY8=; b=Rm6bfuJPPRscHb6aPJdFsNHxDDu7ZV/vX9p/7rMwCD4NpJ17qZUAnb4VOGWmwaeJi9 KMxmkC/YgIlRiGznjWS8f6S/pgUO+VkpzB3AGTCwLoepL4216VAmz/fxBYryFqJ0E9v7 h72/DXWzUmvBo+LPgwhxAXS20LNSjS5mfoxkF42+jlppoKpRJ42oy4RC3leL3KJM5kus kjLxeQD9us9nGXGacOHXwZ0nrOZAyIwCZcn4YBtakQv2BL4d+t/5iv13D9pUN0dD68ik hFL7ajBdYe+eR4r246cZ8FPlJnXfxCZfOJpLecBPrjyy1aOssaCv0rU/FRzHhXGRyn61 EAxg== X-Gm-Message-State: AOUpUlHDOP/mOnNs6HRT+dpa53+6PFe/FGKDovIVHhpAQcDLaTCXGn+5 WLIkHX2NuxotzbbCIs5k0I3TIg== X-Received: by 2002:a63:4386:: with SMTP id q128-v6mr56171429pga.353.1535044763492; Thu, 23 Aug 2018 10:19:23 -0700 (PDT) Received: from starnight.local ([150.116.244.148]) by smtp.gmail.com with ESMTPSA id n9-v6sm7483404pfg.21.2018.08.23.10.19.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 10:19:23 -0700 (PDT) From: Jian-Hong Pan To: =?UTF-8?q?Andreas=20F=C3=A4rber?= , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiri Pirko , Marcel Holtmann , "David S. Miller" , Matthias Brugger , Janus Piwek , =?UTF-8?q?Michael=20R=C3=B6der?= , Dollar Chen , Ken Yu , =?UTF-8?q?Konstantin=20B=C3=B6hm?= , Jan Jongboom , Jon Ortego , "contact@snootlab.com" , Ben Whitten , Brian Ray , lora@globalsat.com.tw, Alexander Graf , =?UTF-8?q?Michal=20Kube=C4=8Dek?= , Rob Herring , devicetree@vger.kernel.org, Steve deRosier , Mark Brown , linux-spi@vger.kernel.org, Pieter ROBYNS , Hasnain Virk , linux-wpan - ML , Stefan Schmidt , Daniele Comel , shess@hessware.de, Xue Liu Cc: Jian-Hong Pan Subject: [RFC 2/3 net] lorawan: Add macro and definition for LoRaWAN class modlue Date: Fri, 24 Aug 2018 01:15:42 +0800 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch add the macro and definition for the implementation of LoRaWAN protocol. Signed-off-by: Jian-Hong Pan --- include/linux/socket.h | 5 ++++- include/uapi/linux/if_arp.h | 1 + include/uapi/linux/if_ether.h | 1 + net/core/dev.c | 4 ++-- security/selinux/hooks.c | 4 +++- security/selinux/include/classmap.h | 4 +++- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/linux/socket.h b/include/linux/socket.h index aa1e288b1659..e5c8381fd1aa 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -209,8 +209,9 @@ struct ucred { */ #define AF_XDP 44 /* XDP sockets */ #define AF_LORA 45 /* LoRa sockets */ +#define AF_LORAWAN 46 /* LoRaWAN sockets */ -#define AF_MAX 46 /* For now.. */ +#define AF_MAX 47 /* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC @@ -261,6 +262,7 @@ struct ucred { #define PF_SMC AF_SMC #define PF_XDP AF_XDP #define PF_LORA AF_LORA +#define PF_LORAWAN AF_LORAWAN #define PF_MAX AF_MAX /* Maximum queue length specifiable by listen. */ @@ -343,6 +345,7 @@ struct ucred { #define SOL_KCM 281 #define SOL_TLS 282 #define SOL_XDP 283 +#define SOL_LORAWAN 284 /* IPX options */ #define IPX_TYPE 1 diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h index 1ed7cb3f2129..2376f7839355 100644 --- a/include/uapi/linux/if_arp.h +++ b/include/uapi/linux/if_arp.h @@ -99,6 +99,7 @@ #define ARPHRD_6LOWPAN 825 /* IPv6 over LoWPAN */ #define ARPHRD_VSOCKMON 826 /* Vsock monitor header */ #define ARPHRD_LORA 827 /* LoRa */ +#define ARPHRD_LORAWAN 828 /* LoRaWAN */ #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 45644dcf5b39..b1ac70d4a377 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -148,6 +148,7 @@ * aggregation protocol */ #define ETH_P_LORA 0x00FA /* LoRa */ +#define ETH_P_LORAWAN 0x00FB /* LoRaWAN */ /* * This is an Ethernet frame header. diff --git a/net/core/dev.c b/net/core/dev.c index f68122f0ab02..b95ce79ec5a8 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -297,7 +297,7 @@ static const unsigned short netdev_lock_type[] = { ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL, ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM, ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE, - ARPHRD_IEEE802154, ARPHRD_VOID, ARPHRD_NONE}; + ARPHRD_IEEE802154, ARPHRD_LORAWAN, ARPHRD_VOID, ARPHRD_NONE}; static const char *const netdev_lock_name[] = { "_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25", @@ -314,7 +314,7 @@ static const char *const netdev_lock_name[] = { "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL", "_xmit_FCFABRIC", "_xmit_IEEE80211", "_xmit_IEEE80211_PRISM", "_xmit_IEEE80211_RADIOTAP", "_xmit_PHONET", "_xmit_PHONET_PIPE", - "_xmit_IEEE802154", "_xmit_VOID", "_xmit_NONE"}; + "_xmit_IEEE802154", "_xmit_LORAWAN", "_xmit_VOID", "_xmit_NONE"}; static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)]; static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)]; diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index aaf520a689d8..0da3a1d69cb8 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1477,7 +1477,9 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc return SECCLASS_XDP_SOCKET; case PF_LORA: return SECCLASS_LORA_SOCKET; -#if PF_MAX > 46 + case PF_LORAWAN: + return SECCLASS_LORAWAN_SOCKET; +#if PF_MAX > 47 #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 060d4bf8385e..fa0151fe6f32 100644 --- a/security/selinux/include/classmap.h +++ b/security/selinux/include/classmap.h @@ -244,9 +244,11 @@ struct security_class_mapping secclass_map[] = { { COMMON_SOCK_PERMS, NULL } }, { "lora_socket", { COMMON_SOCK_PERMS, NULL } }, + { "lorawan_socket", + { COMMON_SOCK_PERMS, NULL } }, { NULL } }; -#if PF_MAX > 46 +#if PF_MAX > 47 #error New address family defined, please update secclass_map. #endif -- 2.18.0